49c9e27502
Avatar fest auf /avatar.vrm (frontend/public/avatar.vrm → dist). Galerie/Upload/URL raus; AvatarPicker → reine VoiceControls (nur Stimme). vrmStore.ts gelöscht. avatar.vrm ist gitignored (23 MB, lizenz-/redistributionssensibel) — liegt auf der Box, nicht in git. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
5445 lines
1.8 MiB
Plaintext
5445 lines
1.8 MiB
Plaintext
var yW=Object.defineProperty;var UN=t=>{throw TypeError(t)};var xW=(t,e,n)=>e in t?yW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var fo=(t,e,n)=>xW(t,typeof e!="symbol"?e+"":e,n),KM=(t,e,n)=>e.has(t)||UN("Cannot "+n);var me=(t,e,n)=>(KM(t,e,"read from private field"),n?n.call(t):e.get(t)),Wt=(t,e,n)=>e.has(t)?UN("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),wt=(t,e,n,r)=>(KM(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),_n=(t,e,n)=>(KM(t,e,"access private method"),n);var cb=(t,e,n,r)=>({set _(i){wt(t,e,i,n)},get _(){return me(t,e,r)}});function bW(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in t)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();function z1(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var YM={exports:{}},Jv={},ZM={exports:{}},gn={};/**
|
||
* @license React
|
||
* react.production.min.js
|
||
*
|
||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var jN;function _W(){if(jN)return gn;jN=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),o=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),c=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),f=Symbol.iterator;function m($){return $===null||typeof $!="object"?null:($=f&&$[f]||$["@@iterator"],typeof $=="function"?$:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,S={};function _($,Z,ge){this.props=$,this.context=Z,this.refs=S,this.updater=ge||y}_.prototype.isReactComponent={},_.prototype.setState=function($,Z){if(typeof $!="object"&&typeof $!="function"&&$!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,$,Z,"setState")},_.prototype.forceUpdate=function($){this.updater.enqueueForceUpdate(this,$,"forceUpdate")};function w(){}w.prototype=_.prototype;function A($,Z,ge){this.props=$,this.context=Z,this.refs=S,this.updater=ge||y}var T=A.prototype=new w;T.constructor=A,x(T,_.prototype),T.isPureReactComponent=!0;var C=Array.isArray,O=Object.prototype.hasOwnProperty,N={current:null},D={key:!0,ref:!0,__self:!0,__source:!0};function F($,Z,ge){var ae,fe={},_e=null,Se=null;if(Z!=null)for(ae in Z.ref!==void 0&&(Se=Z.ref),Z.key!==void 0&&(_e=""+Z.key),Z)O.call(Z,ae)&&!D.hasOwnProperty(ae)&&(fe[ae]=Z[ae]);var $e=arguments.length-2;if($e===1)fe.children=ge;else if(1<$e){for(var Me=Array($e),He=0;He<$e;He++)Me[He]=arguments[He+2];fe.children=Me}if($&&$.defaultProps)for(ae in $e=$.defaultProps,$e)fe[ae]===void 0&&(fe[ae]=$e[ae]);return{$$typeof:t,type:$,key:_e,ref:Se,props:fe,_owner:N.current}}function V($,Z){return{$$typeof:t,type:$.type,key:Z,ref:$.ref,props:$.props,_owner:$._owner}}function k($){return typeof $=="object"&&$!==null&&$.$$typeof===t}function j($){var Z={"=":"=0",":":"=2"};return"$"+$.replace(/[=:]/g,function(ge){return Z[ge]})}var H=/\/+/g;function ne($,Z){return typeof $=="object"&&$!==null&&$.key!=null?j(""+$.key):Z.toString(36)}function te($,Z,ge,ae,fe){var _e=typeof $;(_e==="undefined"||_e==="boolean")&&($=null);var Se=!1;if($===null)Se=!0;else switch(_e){case"string":case"number":Se=!0;break;case"object":switch($.$$typeof){case t:case e:Se=!0}}if(Se)return Se=$,fe=fe(Se),$=ae===""?"."+ne(Se,0):ae,C(fe)?(ge="",$!=null&&(ge=$.replace(H,"$&/")+"/"),te(fe,Z,ge,"",function(He){return He})):fe!=null&&(k(fe)&&(fe=V(fe,ge+(!fe.key||Se&&Se.key===fe.key?"":(""+fe.key).replace(H,"$&/")+"/")+$)),Z.push(fe)),1;if(Se=0,ae=ae===""?".":ae+":",C($))for(var $e=0;$e<$.length;$e++){_e=$[$e];var Me=ae+ne(_e,$e);Se+=te(_e,Z,ge,Me,fe)}else if(Me=m($),typeof Me=="function")for($=Me.call($),$e=0;!(_e=$.next()).done;)_e=_e.value,Me=ae+ne(_e,$e++),Se+=te(_e,Z,ge,Me,fe);else if(_e==="object")throw Z=String($),Error("Objects are not valid as a React child (found: "+(Z==="[object Object]"?"object with keys {"+Object.keys($).join(", ")+"}":Z)+"). If you meant to render a collection of children, use an array instead.");return Se}function pe($,Z,ge){if($==null)return $;var ae=[],fe=0;return te($,ae,"","",function(_e){return Z.call(ge,_e,fe++)}),ae}function oe($){if($._status===-1){var Z=$._result;Z=Z(),Z.then(function(ge){($._status===0||$._status===-1)&&($._status=1,$._result=ge)},function(ge){($._status===0||$._status===-1)&&($._status=2,$._result=ge)}),$._status===-1&&($._status=0,$._result=Z)}if($._status===1)return $._result.default;throw $._result}var ce={current:null},B={transition:null},K={ReactCurrentDispatcher:ce,ReactCurrentBatchConfig:B,ReactCurrentOwner:N};function q(){throw Error("act(...) is not supported in production builds of React.")}return gn.Children={map:pe,forEach:function($,Z,ge){pe($,function(){Z.apply(this,arguments)},ge)},count:function($){var Z=0;return pe($,function(){Z++}),Z},toArray:function($){return pe($,function(Z){return Z})||[]},only:function($){if(!k($))throw Error("React.Children.only expected to receive a single React element child.");return $}},gn.Component=_,gn.Fragment=n,gn.Profiler=i,gn.PureComponent=A,gn.StrictMode=r,gn.Suspense=l,gn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=K,gn.act=q,gn.cloneElement=function($,Z,ge){if($==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+$+".");var ae=x({},$.props),fe=$.key,_e=$.ref,Se=$._owner;if(Z!=null){if(Z.ref!==void 0&&(_e=Z.ref,Se=N.current),Z.key!==void 0&&(fe=""+Z.key),$.type&&$.type.defaultProps)var $e=$.type.defaultProps;for(Me in Z)O.call(Z,Me)&&!D.hasOwnProperty(Me)&&(ae[Me]=Z[Me]===void 0&&$e!==void 0?$e[Me]:Z[Me])}var Me=arguments.length-2;if(Me===1)ae.children=ge;else if(1<Me){$e=Array(Me);for(var He=0;He<Me;He++)$e[He]=arguments[He+2];ae.children=$e}return{$$typeof:t,type:$.type,key:fe,ref:_e,props:ae,_owner:Se}},gn.createContext=function($){return $={$$typeof:o,_currentValue:$,_currentValue2:$,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},$.Provider={$$typeof:s,_context:$},$.Consumer=$},gn.createElement=F,gn.createFactory=function($){var Z=F.bind(null,$);return Z.type=$,Z},gn.createRef=function(){return{current:null}},gn.forwardRef=function($){return{$$typeof:a,render:$}},gn.isValidElement=k,gn.lazy=function($){return{$$typeof:d,_payload:{_status:-1,_result:$},_init:oe}},gn.memo=function($,Z){return{$$typeof:c,type:$,compare:Z===void 0?null:Z}},gn.startTransition=function($){var Z=B.transition;B.transition={};try{$()}finally{B.transition=Z}},gn.unstable_act=q,gn.useCallback=function($,Z){return ce.current.useCallback($,Z)},gn.useContext=function($){return ce.current.useContext($)},gn.useDebugValue=function(){},gn.useDeferredValue=function($){return ce.current.useDeferredValue($)},gn.useEffect=function($,Z){return ce.current.useEffect($,Z)},gn.useId=function(){return ce.current.useId()},gn.useImperativeHandle=function($,Z,ge){return ce.current.useImperativeHandle($,Z,ge)},gn.useInsertionEffect=function($,Z){return ce.current.useInsertionEffect($,Z)},gn.useLayoutEffect=function($,Z){return ce.current.useLayoutEffect($,Z)},gn.useMemo=function($,Z){return ce.current.useMemo($,Z)},gn.useReducer=function($,Z,ge){return ce.current.useReducer($,Z,ge)},gn.useRef=function($){return ce.current.useRef($)},gn.useState=function($){return ce.current.useState($)},gn.useSyncExternalStore=function($,Z,ge){return ce.current.useSyncExternalStore($,Z,ge)},gn.useTransition=function(){return ce.current.useTransition()},gn.version="18.3.1",gn}var FN;function Wh(){return FN||(FN=1,ZM.exports=_W()),ZM.exports}/**
|
||
* @license React
|
||
* react-jsx-runtime.production.min.js
|
||
*
|
||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var zN;function wW(){if(zN)return Jv;zN=1;var t=Wh(),e=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,l,c){var d,f={},m=null,y=null;c!==void 0&&(m=""+c),l.key!==void 0&&(m=""+l.key),l.ref!==void 0&&(y=l.ref);for(d in l)r.call(l,d)&&!s.hasOwnProperty(d)&&(f[d]=l[d]);if(a&&a.defaultProps)for(d in l=a.defaultProps,l)f[d]===void 0&&(f[d]=l[d]);return{$$typeof:e,type:a,key:m,ref:y,props:f,_owner:i.current}}return Jv.Fragment=n,Jv.jsx=o,Jv.jsxs=o,Jv}var BN;function SW(){return BN||(BN=1,YM.exports=wW()),YM.exports}var v=SW(),R=Wh();const Hj=z1(R),B1=bW({__proto__:null,default:Hj},[R]);var ub={},QM={exports:{}},Gs={},JM={exports:{}},eE={};/**
|
||
* @license React
|
||
* scheduler.production.min.js
|
||
*
|
||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var HN;function MW(){return HN||(HN=1,(function(t){function e(B,K){var q=B.length;B.push(K);e:for(;0<q;){var $=q-1>>>1,Z=B[$];if(0<i(Z,K))B[$]=K,B[q]=Z,q=$;else break e}}function n(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var K=B[0],q=B.pop();if(q!==K){B[0]=q;e:for(var $=0,Z=B.length,ge=Z>>>1;$<ge;){var ae=2*($+1)-1,fe=B[ae],_e=ae+1,Se=B[_e];if(0>i(fe,q))_e<Z&&0>i(Se,fe)?(B[$]=Se,B[_e]=q,$=_e):(B[$]=fe,B[ae]=q,$=ae);else if(_e<Z&&0>i(Se,q))B[$]=Se,B[_e]=q,$=_e;else break e}}return K}function i(B,K){var q=B.sortIndex-K.sortIndex;return q!==0?q:B.id-K.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],c=[],d=1,f=null,m=3,y=!1,x=!1,S=!1,_=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function T(B){for(var K=n(c);K!==null;){if(K.callback===null)r(c);else if(K.startTime<=B)r(c),K.sortIndex=K.expirationTime,e(l,K);else break;K=n(c)}}function C(B){if(S=!1,T(B),!x)if(n(l)!==null)x=!0,oe(O);else{var K=n(c);K!==null&&ce(C,K.startTime-B)}}function O(B,K){x=!1,S&&(S=!1,w(F),F=-1),y=!0;var q=m;try{for(T(K),f=n(l);f!==null&&(!(f.expirationTime>K)||B&&!j());){var $=f.callback;if(typeof $=="function"){f.callback=null,m=f.priorityLevel;var Z=$(f.expirationTime<=K);K=t.unstable_now(),typeof Z=="function"?f.callback=Z:f===n(l)&&r(l),T(K)}else r(l);f=n(l)}if(f!==null)var ge=!0;else{var ae=n(c);ae!==null&&ce(C,ae.startTime-K),ge=!1}return ge}finally{f=null,m=q,y=!1}}var N=!1,D=null,F=-1,V=5,k=-1;function j(){return!(t.unstable_now()-k<V)}function H(){if(D!==null){var B=t.unstable_now();k=B;var K=!0;try{K=D(!0,B)}finally{K?ne():(N=!1,D=null)}}else N=!1}var ne;if(typeof A=="function")ne=function(){A(H)};else if(typeof MessageChannel<"u"){var te=new MessageChannel,pe=te.port2;te.port1.onmessage=H,ne=function(){pe.postMessage(null)}}else ne=function(){_(H,0)};function oe(B){D=B,N||(N=!0,ne())}function ce(B,K){F=_(function(){B(t.unstable_now())},K)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(B){B.callback=null},t.unstable_continueExecution=function(){x||y||(x=!0,oe(O))},t.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):V=0<B?Math.floor(1e3/B):5},t.unstable_getCurrentPriorityLevel=function(){return m},t.unstable_getFirstCallbackNode=function(){return n(l)},t.unstable_next=function(B){switch(m){case 1:case 2:case 3:var K=3;break;default:K=m}var q=m;m=K;try{return B()}finally{m=q}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(B,K){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var q=m;m=B;try{return K()}finally{m=q}},t.unstable_scheduleCallback=function(B,K,q){var $=t.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?$+q:$):q=$,B){case 1:var Z=-1;break;case 2:Z=250;break;case 5:Z=1073741823;break;case 4:Z=1e4;break;default:Z=5e3}return Z=q+Z,B={id:d++,callback:K,priorityLevel:B,startTime:q,expirationTime:Z,sortIndex:-1},q>$?(B.sortIndex=q,e(c,B),n(l)===null&&B===n(c)&&(S?(w(F),F=-1):S=!0,ce(C,q-$))):(B.sortIndex=Z,e(l,B),x||y||(x=!0,oe(O))),B},t.unstable_shouldYield=j,t.unstable_wrapCallback=function(B){var K=m;return function(){var q=m;m=K;try{return B.apply(this,arguments)}finally{m=q}}}})(eE)),eE}var VN;function EW(){return VN||(VN=1,JM.exports=MW()),JM.exports}/**
|
||
* @license React
|
||
* react-dom.production.min.js
|
||
*
|
||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var GN;function AW(){if(GN)return Gs;GN=1;var t=Wh(),e=EW();function n(u){for(var h="https://reactjs.org/docs/error-decoder.html?invariant="+u,b=1;b<arguments.length;b++)h+="&args[]="+encodeURIComponent(arguments[b]);return"Minified React error #"+u+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=new Set,i={};function s(u,h){o(u,h),o(u+"Capture",h)}function o(u,h){for(i[u]=h,u=0;u<h.length;u++)r.add(h[u])}var a=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),l=Object.prototype.hasOwnProperty,c=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,d={},f={};function m(u){return l.call(f,u)?!0:l.call(d,u)?!1:c.test(u)?f[u]=!0:(d[u]=!0,!1)}function y(u,h,b,E){if(b!==null&&b.type===0)return!1;switch(typeof h){case"function":case"symbol":return!0;case"boolean":return E?!1:b!==null?!b.acceptsBooleans:(u=u.toLowerCase().slice(0,5),u!=="data-"&&u!=="aria-");default:return!1}}function x(u,h,b,E){if(h===null||typeof h>"u"||y(u,h,b,E))return!0;if(E)return!1;if(b!==null)switch(b.type){case 3:return!h;case 4:return h===!1;case 5:return isNaN(h);case 6:return isNaN(h)||1>h}return!1}function S(u,h,b,E,I,U,G){this.acceptsBooleans=h===2||h===3||h===4,this.attributeName=E,this.attributeNamespace=I,this.mustUseProperty=b,this.propertyName=u,this.type=h,this.sanitizeURL=U,this.removeEmptyString=G}var _={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(u){_[u]=new S(u,0,!1,u,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(u){var h=u[0];_[h]=new S(h,1,!1,u[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(u){_[u]=new S(u,2,!1,u.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(u){_[u]=new S(u,2,!1,u,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(u){_[u]=new S(u,3,!1,u.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(u){_[u]=new S(u,3,!0,u,null,!1,!1)}),["capture","download"].forEach(function(u){_[u]=new S(u,4,!1,u,null,!1,!1)}),["cols","rows","size","span"].forEach(function(u){_[u]=new S(u,6,!1,u,null,!1,!1)}),["rowSpan","start"].forEach(function(u){_[u]=new S(u,5,!1,u.toLowerCase(),null,!1,!1)});var w=/[\-:]([a-z])/g;function A(u){return u[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(u){var h=u.replace(w,A);_[h]=new S(h,1,!1,u,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(u){var h=u.replace(w,A);_[h]=new S(h,1,!1,u,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(u){var h=u.replace(w,A);_[h]=new S(h,1,!1,u,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(u){_[u]=new S(u,1,!1,u.toLowerCase(),null,!1,!1)}),_.xlinkHref=new S("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(u){_[u]=new S(u,1,!1,u.toLowerCase(),null,!0,!0)});function T(u,h,b,E){var I=_.hasOwnProperty(h)?_[h]:null;(I!==null?I.type!==0:E||!(2<h.length)||h[0]!=="o"&&h[0]!=="O"||h[1]!=="n"&&h[1]!=="N")&&(x(h,b,I,E)&&(b=null),E||I===null?m(h)&&(b===null?u.removeAttribute(h):u.setAttribute(h,""+b)):I.mustUseProperty?u[I.propertyName]=b===null?I.type===3?!1:"":b:(h=I.attributeName,E=I.attributeNamespace,b===null?u.removeAttribute(h):(I=I.type,b=I===3||I===4&&b===!0?"":""+b,E?u.setAttributeNS(E,h,b):u.setAttribute(h,b))))}var C=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,O=Symbol.for("react.element"),N=Symbol.for("react.portal"),D=Symbol.for("react.fragment"),F=Symbol.for("react.strict_mode"),V=Symbol.for("react.profiler"),k=Symbol.for("react.provider"),j=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),ne=Symbol.for("react.suspense"),te=Symbol.for("react.suspense_list"),pe=Symbol.for("react.memo"),oe=Symbol.for("react.lazy"),ce=Symbol.for("react.offscreen"),B=Symbol.iterator;function K(u){return u===null||typeof u!="object"?null:(u=B&&u[B]||u["@@iterator"],typeof u=="function"?u:null)}var q=Object.assign,$;function Z(u){if($===void 0)try{throw Error()}catch(b){var h=b.stack.trim().match(/\n( *(at )?)/);$=h&&h[1]||""}return`
|
||
`+$+u}var ge=!1;function ae(u,h){if(!u||ge)return"";ge=!0;var b=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(h)if(h=function(){throw Error()},Object.defineProperty(h.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(h,[])}catch(De){var E=De}Reflect.construct(u,[],h)}else{try{h.call()}catch(De){E=De}u.call(h.prototype)}else{try{throw Error()}catch(De){E=De}u()}}catch(De){if(De&&E&&typeof De.stack=="string"){for(var I=De.stack.split(`
|
||
`),U=E.stack.split(`
|
||
`),G=I.length-1,se=U.length-1;1<=G&&0<=se&&I[G]!==U[se];)se--;for(;1<=G&&0<=se;G--,se--)if(I[G]!==U[se]){if(G!==1||se!==1)do if(G--,se--,0>se||I[G]!==U[se]){var he=`
|
||
`+I[G].replace(" at new "," at ");return u.displayName&&he.includes("<anonymous>")&&(he=he.replace("<anonymous>",u.displayName)),he}while(1<=G&&0<=se);break}}}finally{ge=!1,Error.prepareStackTrace=b}return(u=u?u.displayName||u.name:"")?Z(u):""}function fe(u){switch(u.tag){case 5:return Z(u.type);case 16:return Z("Lazy");case 13:return Z("Suspense");case 19:return Z("SuspenseList");case 0:case 2:case 15:return u=ae(u.type,!1),u;case 11:return u=ae(u.type.render,!1),u;case 1:return u=ae(u.type,!0),u;default:return""}}function _e(u){if(u==null)return null;if(typeof u=="function")return u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case D:return"Fragment";case N:return"Portal";case V:return"Profiler";case F:return"StrictMode";case ne:return"Suspense";case te:return"SuspenseList"}if(typeof u=="object")switch(u.$$typeof){case j:return(u.displayName||"Context")+".Consumer";case k:return(u._context.displayName||"Context")+".Provider";case H:var h=u.render;return u=u.displayName,u||(u=h.displayName||h.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case pe:return h=u.displayName||null,h!==null?h:_e(u.type)||"Memo";case oe:h=u._payload,u=u._init;try{return _e(u(h))}catch{}}return null}function Se(u){var h=u.type;switch(u.tag){case 24:return"Cache";case 9:return(h.displayName||"Context")+".Consumer";case 10:return(h._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return u=h.render,u=u.displayName||u.name||"",h.displayName||(u!==""?"ForwardRef("+u+")":"ForwardRef");case 7:return"Fragment";case 5:return h;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return _e(h);case 8:return h===F?"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 h=="function")return h.displayName||h.name||null;if(typeof h=="string")return h}return null}function $e(u){switch(typeof u){case"boolean":case"number":case"string":case"undefined":return u;case"object":return u;default:return""}}function Me(u){var h=u.type;return(u=u.nodeName)&&u.toLowerCase()==="input"&&(h==="checkbox"||h==="radio")}function He(u){var h=Me(u)?"checked":"value",b=Object.getOwnPropertyDescriptor(u.constructor.prototype,h),E=""+u[h];if(!u.hasOwnProperty(h)&&typeof b<"u"&&typeof b.get=="function"&&typeof b.set=="function"){var I=b.get,U=b.set;return Object.defineProperty(u,h,{configurable:!0,get:function(){return I.call(this)},set:function(G){E=""+G,U.call(this,G)}}),Object.defineProperty(u,h,{enumerable:b.enumerable}),{getValue:function(){return E},setValue:function(G){E=""+G},stopTracking:function(){u._valueTracker=null,delete u[h]}}}}function Xe(u){u._valueTracker||(u._valueTracker=He(u))}function ue(u){if(!u)return!1;var h=u._valueTracker;if(!h)return!0;var b=h.getValue(),E="";return u&&(E=Me(u)?u.checked?"true":"false":u.value),u=E,u!==b?(h.setValue(u),!0):!1}function Q(u){if(u=u||(typeof document<"u"?document:void 0),typeof u>"u")return null;try{return u.activeElement||u.body}catch{return u.body}}function Ge(u,h){var b=h.checked;return q({},h,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:b??u._wrapperState.initialChecked})}function Ue(u,h){var b=h.defaultValue==null?"":h.defaultValue,E=h.checked!=null?h.checked:h.defaultChecked;b=$e(h.value!=null?h.value:b),u._wrapperState={initialChecked:E,initialValue:b,controlled:h.type==="checkbox"||h.type==="radio"?h.checked!=null:h.value!=null}}function We(u,h){h=h.checked,h!=null&&T(u,"checked",h,!1)}function Qe(u,h){We(u,h);var b=$e(h.value),E=h.type;if(b!=null)E==="number"?(b===0&&u.value===""||u.value!=b)&&(u.value=""+b):u.value!==""+b&&(u.value=""+b);else if(E==="submit"||E==="reset"){u.removeAttribute("value");return}h.hasOwnProperty("value")?at(u,h.type,b):h.hasOwnProperty("defaultValue")&&at(u,h.type,$e(h.defaultValue)),h.checked==null&&h.defaultChecked!=null&&(u.defaultChecked=!!h.defaultChecked)}function xt(u,h,b){if(h.hasOwnProperty("value")||h.hasOwnProperty("defaultValue")){var E=h.type;if(!(E!=="submit"&&E!=="reset"||h.value!==void 0&&h.value!==null))return;h=""+u._wrapperState.initialValue,b||h===u.value||(u.value=h),u.defaultValue=h}b=u.name,b!==""&&(u.name=""),u.defaultChecked=!!u._wrapperState.initialChecked,b!==""&&(u.name=b)}function at(u,h,b){(h!=="number"||Q(u.ownerDocument)!==u)&&(b==null?u.defaultValue=""+u._wrapperState.initialValue:u.defaultValue!==""+b&&(u.defaultValue=""+b))}var ee=Array.isArray;function W(u,h,b,E){if(u=u.options,h){h={};for(var I=0;I<b.length;I++)h["$"+b[I]]=!0;for(b=0;b<u.length;b++)I=h.hasOwnProperty("$"+u[b].value),u[b].selected!==I&&(u[b].selected=I),I&&E&&(u[b].defaultSelected=!0)}else{for(b=""+$e(b),h=null,I=0;I<u.length;I++){if(u[I].value===b){u[I].selected=!0,E&&(u[I].defaultSelected=!0);return}h!==null||u[I].disabled||(h=u[I])}h!==null&&(h.selected=!0)}}function Ee(u,h){if(h.dangerouslySetInnerHTML!=null)throw Error(n(91));return q({},h,{value:void 0,defaultValue:void 0,children:""+u._wrapperState.initialValue})}function Be(u,h){var b=h.value;if(b==null){if(b=h.children,h=h.defaultValue,b!=null){if(h!=null)throw Error(n(92));if(ee(b)){if(1<b.length)throw Error(n(93));b=b[0]}h=b}h==null&&(h=""),b=h}u._wrapperState={initialValue:$e(b)}}function le(u,h){var b=$e(h.value),E=$e(h.defaultValue);b!=null&&(b=""+b,b!==u.value&&(u.value=b),h.defaultValue==null&&u.defaultValue!==b&&(u.defaultValue=b)),E!=null&&(u.defaultValue=""+E)}function Ce(u){var h=u.textContent;h===u._wrapperState.initialValue&&h!==""&&h!==null&&(u.value=h)}function lt(u){switch(u){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function rt(u,h){return u==null||u==="http://www.w3.org/1999/xhtml"?lt(h):u==="http://www.w3.org/2000/svg"&&h==="foreignObject"?"http://www.w3.org/1999/xhtml":u}var ft,nn=(function(u){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(h,b,E,I){MSApp.execUnsafeLocalFunction(function(){return u(h,b,E,I)})}:u})(function(u,h){if(u.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in u)u.innerHTML=h;else{for(ft=ft||document.createElement("div"),ft.innerHTML="<svg>"+h.valueOf().toString()+"</svg>",h=ft.firstChild;u.firstChild;)u.removeChild(u.firstChild);for(;h.firstChild;)u.appendChild(h.firstChild)}});function qe(u,h){if(h){var b=u.firstChild;if(b&&b===u.lastChild&&b.nodeType===3){b.nodeValue=h;return}}u.textContent=h}var dt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Dt=["Webkit","ms","Moz","O"];Object.keys(dt).forEach(function(u){Dt.forEach(function(h){h=h+u.charAt(0).toUpperCase()+u.substring(1),dt[h]=dt[u]})});function Ut(u,h,b){return h==null||typeof h=="boolean"||h===""?"":b||typeof h!="number"||h===0||dt.hasOwnProperty(u)&&dt[u]?(""+h).trim():h+"px"}function pt(u,h){u=u.style;for(var b in h)if(h.hasOwnProperty(b)){var E=b.indexOf("--")===0,I=Ut(b,h[b],E);b==="float"&&(b="cssFloat"),E?u.setProperty(b,I):u[b]=I}}var de=q({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function J(u,h){if(h){if(de[u]&&(h.children!=null||h.dangerouslySetInnerHTML!=null))throw Error(n(137,u));if(h.dangerouslySetInnerHTML!=null){if(h.children!=null)throw Error(n(60));if(typeof h.dangerouslySetInnerHTML!="object"||!("__html"in h.dangerouslySetInnerHTML))throw Error(n(61))}if(h.style!=null&&typeof h.style!="object")throw Error(n(62))}}function Ae(u,h){if(u.indexOf("-")===-1)return typeof h.is=="string";switch(u){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var re=null;function Fe(u){return u=u.target||u.srcElement||window,u.correspondingUseElement&&(u=u.correspondingUseElement),u.nodeType===3?u.parentNode:u}var Te=null,Le=null,Ke=null;function ut(u){if(u=pa(u)){if(typeof Te!="function")throw Error(n(280));var h=u.stateNode;h&&(h=Dp(h),Te(u.stateNode,u.type,h))}}function Kt(u){Le?Ke?Ke.push(u):Ke=[u]:Le=u}function un(){if(Le){var u=Le,h=Ke;if(Ke=Le=null,ut(u),h)for(u=0;u<h.length;u++)ut(h[u])}}function Cn(u,h){return u(h)}function Jt(){}var Hn=!1;function hr(u,h,b){if(Hn)return u(h,b);Hn=!0;try{return Cn(u,h,b)}finally{Hn=!1,(Le!==null||Ke!==null)&&(Jt(),un())}}function Si(u,h){var b=u.stateNode;if(b===null)return null;var E=Dp(b);if(E===null)return null;b=E[h];e:switch(h){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(E=!E.disabled)||(u=u.type,E=!(u==="button"||u==="input"||u==="select"||u==="textarea")),u=!E;break e;default:u=!1}if(u)return null;if(b&&typeof b!="function")throw Error(n(231,h,typeof b));return b}var ra=!1;if(a)try{var Mi={};Object.defineProperty(Mi,"passive",{get:function(){ra=!0}}),window.addEventListener("test",Mi,Mi),window.removeEventListener("test",Mi,Mi)}catch{ra=!1}function Ka(u,h,b,E,I,U,G,se,he){var De=Array.prototype.slice.call(arguments,3);try{h.apply(b,De)}catch(Ze){this.onError(Ze)}}var Ns=!1,ia=null,Ei=!1,Ao=null,sa={onError:function(u){Ns=!0,ia=u}};function cu(u,h,b,E,I,U,G,se,he){Ns=!1,ia=null,Ka.apply(sa,arguments)}function uu(u,h,b,E,I,U,G,se,he){if(cu.apply(this,arguments),Ns){if(Ns){var De=ia;Ns=!1,ia=null}else throw Error(n(198));Ei||(Ei=!0,Ao=De)}}function To(u){var h=u,b=u;if(u.alternate)for(;h.return;)h=h.return;else{u=h;do h=u,(h.flags&4098)!==0&&(b=h.return),u=h.return;while(u)}return h.tag===3?b:null}function du(u){if(u.tag===13){var h=u.memoizedState;if(h===null&&(u=u.alternate,u!==null&&(h=u.memoizedState)),h!==null)return h.dehydrated}return null}function Hl(u){if(To(u)!==u)throw Error(n(188))}function Y(u){var h=u.alternate;if(!h){if(h=To(u),h===null)throw Error(n(188));return h!==u?null:u}for(var b=u,E=h;;){var I=b.return;if(I===null)break;var U=I.alternate;if(U===null){if(E=I.return,E!==null){b=E;continue}break}if(I.child===U.child){for(U=I.child;U;){if(U===b)return Hl(I),u;if(U===E)return Hl(I),h;U=U.sibling}throw Error(n(188))}if(b.return!==E.return)b=I,E=U;else{for(var G=!1,se=I.child;se;){if(se===b){G=!0,b=I,E=U;break}if(se===E){G=!0,E=I,b=U;break}se=se.sibling}if(!G){for(se=U.child;se;){if(se===b){G=!0,b=U,E=I;break}if(se===E){G=!0,E=U,b=I;break}se=se.sibling}if(!G)throw Error(n(189))}}if(b.alternate!==E)throw Error(n(190))}if(b.tag!==3)throw Error(n(188));return b.stateNode.current===b?u:h}function xe(u){return u=Y(u),u!==null?Re(u):null}function Re(u){if(u.tag===5||u.tag===6)return u;for(u=u.child;u!==null;){var h=Re(u);if(h!==null)return h;u=u.sibling}return null}var ke=e.unstable_scheduleCallback,we=e.unstable_cancelCallback,et=e.unstable_shouldYield,vt=e.unstable_requestPaint,st=e.unstable_now,Mt=e.unstable_getCurrentPriorityLevel,Ft=e.unstable_ImmediatePriority,Ht=e.unstable_UserBlockingPriority,Pt=e.unstable_NormalPriority,Sn=e.unstable_LowPriority,Mn=e.unstable_IdlePriority,yn=null,Yt=null;function Lt(u){if(Yt&&typeof Yt.onCommitFiberRoot=="function")try{Yt.onCommitFiberRoot(yn,u,void 0,(u.current.flags&128)===128)}catch{}}var mt=Math.clz32?Math.clz32:Pr,xn=Math.log,en=Math.LN2;function Pr(u){return u>>>=0,u===0?32:31-(xn(u)/en|0)|0}var li=64,kn=4194304;function Is(u){switch(u&-u){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 u&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return u&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return u}}function Vn(u,h){var b=u.pendingLanes;if(b===0)return 0;var E=0,I=u.suspendedLanes,U=u.pingedLanes,G=b&268435455;if(G!==0){var se=G&~I;se!==0?E=Is(se):(U&=G,U!==0&&(E=Is(U)))}else G=b&~I,G!==0?E=Is(G):U!==0&&(E=Is(U));if(E===0)return 0;if(h!==0&&h!==E&&(h&I)===0&&(I=E&-E,U=h&-h,I>=U||I===16&&(U&4194240)!==0))return h;if((E&4)!==0&&(E|=b&16),h=u.entangledLanes,h!==0)for(u=u.entanglements,h&=E;0<h;)b=31-mt(h),I=1<<b,E|=u[b],h&=~I;return E}function eo(u,h){switch(u){case 1:case 2:case 4:return h+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 h+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 Ya(u,h){for(var b=u.suspendedLanes,E=u.pingedLanes,I=u.expirationTimes,U=u.pendingLanes;0<U;){var G=31-mt(U),se=1<<G,he=I[G];he===-1?((se&b)===0||(se&E)!==0)&&(I[G]=eo(se,h)):he<=h&&(u.expiredLanes|=se),U&=~se}}function Xr(u){return u=u.pendingLanes&-1073741825,u!==0?u:u&1073741824?1073741824:0}function ci(){var u=li;return li<<=1,(li&4194240)===0&&(li=64),u}function Ld(u){for(var h=[],b=0;31>b;b++)h.push(u);return h}function Za(u,h,b){u.pendingLanes|=h,h!==536870912&&(u.suspendedLanes=0,u.pingedLanes=0),u=u.eventTimes,h=31-mt(h),u[h]=b}function xM(u,h){var b=u.pendingLanes&~h;u.pendingLanes=h,u.suspendedLanes=0,u.pingedLanes=0,u.expiredLanes&=h,u.mutableReadLanes&=h,u.entangledLanes&=h,h=u.entanglements;var E=u.eventTimes;for(u=u.expirationTimes;0<b;){var I=31-mt(b),U=1<<I;h[I]=0,E[I]=-1,u[I]=-1,b&=~U}}function fu(u,h){var b=u.entangledLanes|=h;for(u=u.entanglements;b;){var E=31-mt(b),I=1<<E;I&h|u[E]&h&&(u[E]|=h),b&=~I}}var Pn=0;function hu(u){return u&=-u,1<u?4<u?(u&268435455)!==0?16:536870912:4:1}var Dd,sv,vx,ip,sp,Vl=!1,op=[],Co=null,dn=null,oa=null,Gl=new Map,pu=new Map,Qa=[],bM="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Rr(u,h){switch(u){case"focusin":case"focusout":Co=null;break;case"dragenter":case"dragleave":dn=null;break;case"mouseover":case"mouseout":oa=null;break;case"pointerover":case"pointerout":Gl.delete(h.pointerId);break;case"gotpointercapture":case"lostpointercapture":pu.delete(h.pointerId)}}function Wl(u,h,b,E,I,U){return u===null||u.nativeEvent!==U?(u={blockedOn:h,domEventName:b,eventSystemFlags:E,nativeEvent:U,targetContainers:[I]},h!==null&&(h=pa(h),h!==null&&sv(h)),u):(u.eventSystemFlags|=E,h=u.targetContainers,I!==null&&h.indexOf(I)===-1&&h.push(I),u)}function _M(u,h,b,E,I){switch(h){case"focusin":return Co=Wl(Co,u,h,b,E,I),!0;case"dragenter":return dn=Wl(dn,u,h,b,E,I),!0;case"mouseover":return oa=Wl(oa,u,h,b,E,I),!0;case"pointerover":var U=I.pointerId;return Gl.set(U,Wl(Gl.get(U)||null,u,h,b,E,I)),!0;case"gotpointercapture":return U=I.pointerId,pu.set(U,Wl(pu.get(U)||null,u,h,b,E,I)),!0}return!1}function ap(u){var h=sl(u.target);if(h!==null){var b=To(h);if(b!==null){if(h=b.tag,h===13){if(h=du(b),h!==null){u.blockedOn=h,sp(u.priority,function(){vx(b)});return}}else if(h===3&&b.stateNode.current.memoizedState.isDehydrated){u.blockedOn=b.tag===3?b.stateNode.containerInfo:null;return}}}u.blockedOn=null}function lp(u){if(u.blockedOn!==null)return!1;for(var h=u.targetContainers;0<h.length;){var b=Os(u.domEventName,u.eventSystemFlags,h[0],u.nativeEvent);if(b===null){b=u.nativeEvent;var E=new b.constructor(b.type,b);re=E,b.target.dispatchEvent(E),re=null}else return h=pa(b),h!==null&&sv(h),u.blockedOn=b,!1;h.shift()}return!0}function Ud(u,h,b){lp(u)&&b.delete(h)}function Po(){Vl=!1,Co!==null&&lp(Co)&&(Co=null),dn!==null&&lp(dn)&&(dn=null),oa!==null&&lp(oa)&&(oa=null),Gl.forEach(Ud),pu.forEach(Ud)}function jd(u,h){u.blockedOn===h&&(u.blockedOn=null,Vl||(Vl=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Po)))}function Fd(u){function h(I){return jd(I,u)}if(0<op.length){jd(op[0],u);for(var b=1;b<op.length;b++){var E=op[b];E.blockedOn===u&&(E.blockedOn=null)}}for(Co!==null&&jd(Co,u),dn!==null&&jd(dn,u),oa!==null&&jd(oa,u),Gl.forEach(h),pu.forEach(h),b=0;b<Qa.length;b++)E=Qa[b],E.blockedOn===u&&(E.blockedOn=null);for(;0<Qa.length&&(b=Qa[0],b.blockedOn===null);)ap(b),b.blockedOn===null&&Qa.shift()}var Ai=C.ReactCurrentBatchConfig,ks=!0;function cp(u,h,b,E){var I=Pn,U=Ai.transition;Ai.transition=null;try{Pn=1,up(u,h,b,E)}finally{Pn=I,Ai.transition=U}}function ov(u,h,b,E){var I=Pn,U=Ai.transition;Ai.transition=null;try{Pn=4,up(u,h,b,E)}finally{Pn=I,Ai.transition=U}}function up(u,h,b,E){if(ks){var I=Os(u,h,b,E);if(I===null)Rp(u,h,E,dp,b),Rr(u,E);else if(_M(I,u,h,b,E))E.stopPropagation();else if(Rr(u,E),h&4&&-1<bM.indexOf(u)){for(;I!==null;){var U=pa(I);if(U!==null&&Dd(U),U=Os(u,h,b,E),U===null&&Rp(u,h,E,dp,b),U===I)break;I=U}I!==null&&E.stopPropagation()}else Rp(u,h,E,null,b)}}var dp=null;function Os(u,h,b,E){if(dp=null,u=Fe(E),u=sl(u),u!==null)if(h=To(u),h===null)u=null;else if(b=h.tag,b===13){if(u=du(h),u!==null)return u;u=null}else if(b===3){if(h.stateNode.current.memoizedState.isDehydrated)return h.tag===3?h.stateNode.containerInfo:null;u=null}else h!==u&&(u=null);return dp=u,null}function yx(u){switch(u){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Mt()){case Ft:return 1;case Ht:return 4;case Pt:case Sn:return 16;case Mn:return 536870912;default:return 16}default:return 16}}var to=null,av=null,Wi=null;function zd(){if(Wi)return Wi;var u,h=av,b=h.length,E,I="value"in to?to.value:to.textContent,U=I.length;for(u=0;u<b&&h[u]===I[u];u++);var G=b-u;for(E=1;E<=G&&h[b-E]===I[U-E];E++);return Wi=I.slice(u,1<E?1-E:void 0)}function $l(u){var h=u.keyCode;return"charCode"in u?(u=u.charCode,u===0&&h===13&&(u=13)):u=h,u===10&&(u=13),32<=u||u===13?u:0}function aa(){return!0}function fp(){return!1}function Ti(u){function h(b,E,I,U,G){this._reactName=b,this._targetInst=I,this.type=E,this.nativeEvent=U,this.target=G,this.currentTarget=null;for(var se in u)u.hasOwnProperty(se)&&(b=u[se],this[se]=b?b(U):U[se]);return this.isDefaultPrevented=(U.defaultPrevented!=null?U.defaultPrevented:U.returnValue===!1)?aa:fp,this.isPropagationStopped=fp,this}return q(h.prototype,{preventDefault:function(){this.defaultPrevented=!0;var b=this.nativeEvent;b&&(b.preventDefault?b.preventDefault():typeof b.returnValue!="unknown"&&(b.returnValue=!1),this.isDefaultPrevented=aa)},stopPropagation:function(){var b=this.nativeEvent;b&&(b.stopPropagation?b.stopPropagation():typeof b.cancelBubble!="unknown"&&(b.cancelBubble=!0),this.isPropagationStopped=aa)},persist:function(){},isPersistent:aa}),h}var Xl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(u){return u.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Bd=Ti(Xl),ql=q({},Xl,{view:0,detail:0}),mu=Ti(ql),$i,Ls,Ds,gu=q({},ql,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:el,button:0,buttons:0,relatedTarget:function(u){return u.relatedTarget===void 0?u.fromElement===u.srcElement?u.toElement:u.fromElement:u.relatedTarget},movementX:function(u){return"movementX"in u?u.movementX:(u!==Ds&&(Ds&&u.type==="mousemove"?($i=u.screenX-Ds.screenX,Ls=u.screenY-Ds.screenY):Ls=$i=0,Ds=u),$i)},movementY:function(u){return"movementY"in u?u.movementY:Ls}}),lv=Ti(gu),la=q({},gu,{dataTransfer:0}),Ja=Ti(la),hp=q({},ql,{relatedTarget:0}),pp=Ti(hp),mp=q({},Xl,{animationName:0,elapsedTime:0,pseudoElement:0}),xx=Ti(mp),bx=q({},Xl,{clipboardData:function(u){return"clipboardData"in u?u.clipboardData:window.clipboardData}}),cv=Ti(bx),gp=q({},Xl,{data:0}),uv=Ti(gp),_x={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},wx={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},dv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function vu(u){var h=this.nativeEvent;return h.getModifierState?h.getModifierState(u):(u=dv[u])?!!h[u]:!1}function el(){return vu}var vp=q({},ql,{key:function(u){if(u.key){var h=_x[u.key]||u.key;if(h!=="Unidentified")return h}return u.type==="keypress"?(u=$l(u),u===13?"Enter":String.fromCharCode(u)):u.type==="keydown"||u.type==="keyup"?wx[u.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:el,charCode:function(u){return u.type==="keypress"?$l(u):0},keyCode:function(u){return u.type==="keydown"||u.type==="keyup"?u.keyCode:0},which:function(u){return u.type==="keypress"?$l(u):u.type==="keydown"||u.type==="keyup"?u.keyCode:0}}),yp=Ti(vp),Us=q({},gu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),us=Ti(Us),Kl=q({},ql,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:el}),ca=Ti(Kl),ua=q({},Xl,{propertyName:0,elapsedTime:0,pseudoElement:0}),Yl=Ti(ua),Sx=q({},gu,{deltaX:function(u){return"deltaX"in u?u.deltaX:"wheelDeltaX"in u?-u.wheelDeltaX:0},deltaY:function(u){return"deltaY"in u?u.deltaY:"wheelDeltaY"in u?-u.wheelDeltaY:"wheelDelta"in u?-u.wheelDelta:0},deltaZ:0,deltaMode:0}),fv=Ti(Sx),hv=[9,13,27,32],Ci=a&&"CompositionEvent"in window,qr=null;a&&"documentMode"in document&&(qr=document.documentMode);var Zn=a&&"TextEvent"in window&&!qr,yu=a&&(!Ci||qr&&8<qr&&11>=qr),js=" ",pv=!1;function mv(u,h){switch(u){case"keyup":return hv.indexOf(h.keyCode)!==-1;case"keydown":return h.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function xp(u){return u=u.detail,typeof u=="object"&&"data"in u?u.data:null}var tl=!1;function Mx(u,h){switch(u){case"compositionend":return xp(h);case"keypress":return h.which!==32?null:(pv=!0,js);case"textInput":return u=h.data,u===js&&pv?null:u;default:return null}}function Hd(u,h){if(tl)return u==="compositionend"||!Ci&&mv(u,h)?(u=zd(),Wi=av=to=null,tl=!1,u):null;switch(u){case"paste":return null;case"keypress":if(!(h.ctrlKey||h.altKey||h.metaKey)||h.ctrlKey&&h.altKey){if(h.char&&1<h.char.length)return h.char;if(h.which)return String.fromCharCode(h.which)}return null;case"compositionend":return yu&&h.locale!=="ko"?null:h.data;default:return null}}var xu={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function bp(u){var h=u&&u.nodeName&&u.nodeName.toLowerCase();return h==="input"?!!xu[u.type]:h==="textarea"}function bu(u,h,b,E){Kt(E),h=Np(h,"onChange"),0<h.length&&(b=new Bd("onChange","change",null,b,E),u.push({event:b,listeners:h}))}var nl=null,_u=null;function Ex(u){Eu(u,0)}function da(u){var h=pr(u);if(ue(h))return u}function Ax(u,h){if(u==="change")return h}var wu=!1;if(a){var Xi;if(a){var Zl="oninput"in document;if(!Zl){var Ql=document.createElement("div");Ql.setAttribute("oninput","return;"),Zl=typeof Ql.oninput=="function"}Xi=Zl}else Xi=!1;wu=Xi&&(!document.documentMode||9<document.documentMode)}function no(){nl&&(nl.detachEvent("onpropertychange",_p),_u=nl=null)}function _p(u){if(u.propertyName==="value"&&da(_u)){var h=[];bu(h,_u,u,Fe(u)),hr(Ex,h)}}function Su(u,h,b){u==="focusin"?(no(),nl=h,_u=b,nl.attachEvent("onpropertychange",_p)):u==="focusout"&&no()}function Tx(u){if(u==="selectionchange"||u==="keyup"||u==="keydown")return da(_u)}function gv(u,h){if(u==="click")return da(h)}function tr(u,h){if(u==="input"||u==="change")return da(h)}function wp(u,h){return u===h&&(u!==0||1/u===1/h)||u!==u&&h!==h}var ds=typeof Object.is=="function"?Object.is:wp;function Jl(u,h){if(ds(u,h))return!0;if(typeof u!="object"||u===null||typeof h!="object"||h===null)return!1;var b=Object.keys(u),E=Object.keys(h);if(b.length!==E.length)return!1;for(E=0;E<b.length;E++){var I=b[E];if(!l.call(h,I)||!ds(u[I],h[I]))return!1}return!0}function Vd(u){for(;u&&u.firstChild;)u=u.firstChild;return u}function fs(u,h){var b=Vd(u);u=0;for(var E;b;){if(b.nodeType===3){if(E=u+b.textContent.length,u<=h&&E>=h)return{node:b,offset:h-u};u=E}e:{for(;b;){if(b.nextSibling){b=b.nextSibling;break e}b=b.parentNode}b=void 0}b=Vd(b)}}function ec(u,h){return u&&h?u===h?!0:u&&u.nodeType===3?!1:h&&h.nodeType===3?ec(u,h.parentNode):"contains"in u?u.contains(h):u.compareDocumentPosition?!!(u.compareDocumentPosition(h)&16):!1:!1}function nr(){for(var u=window,h=Q();h instanceof u.HTMLIFrameElement;){try{var b=typeof h.contentWindow.location.href=="string"}catch{b=!1}if(b)u=h.contentWindow;else break;h=Q(u.document)}return h}function Dr(u){var h=u&&u.nodeName&&u.nodeName.toLowerCase();return h&&(h==="input"&&(u.type==="text"||u.type==="search"||u.type==="tel"||u.type==="url"||u.type==="password")||h==="textarea"||u.contentEditable==="true")}function Ur(u){var h=nr(),b=u.focusedElem,E=u.selectionRange;if(h!==b&&b&&b.ownerDocument&&ec(b.ownerDocument.documentElement,b)){if(E!==null&&Dr(b)){if(h=E.start,u=E.end,u===void 0&&(u=h),"selectionStart"in b)b.selectionStart=h,b.selectionEnd=Math.min(u,b.value.length);else if(u=(h=b.ownerDocument||document)&&h.defaultView||window,u.getSelection){u=u.getSelection();var I=b.textContent.length,U=Math.min(E.start,I);E=E.end===void 0?U:Math.min(E.end,I),!u.extend&&U>E&&(I=E,E=U,U=I),I=fs(b,U);var G=fs(b,E);I&&G&&(u.rangeCount!==1||u.anchorNode!==I.node||u.anchorOffset!==I.offset||u.focusNode!==G.node||u.focusOffset!==G.offset)&&(h=h.createRange(),h.setStart(I.node,I.offset),u.removeAllRanges(),U>E?(u.addRange(h),u.extend(G.node,G.offset)):(h.setEnd(G.node,G.offset),u.addRange(h)))}}for(h=[],u=b;u=u.parentNode;)u.nodeType===1&&h.push({element:u,left:u.scrollLeft,top:u.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<h.length;b++)u=h[b],u.element.scrollLeft=u.left,u.element.scrollTop=u.top}}var Sp=a&&"documentMode"in document&&11>=document.documentMode,Ro=null,tc=null,Gd=null,jr=!1;function Mp(u,h,b){var E=b.window===b?b.document:b.nodeType===9?b:b.ownerDocument;jr||Ro==null||Ro!==Q(E)||(E=Ro,"selectionStart"in E&&Dr(E)?E={start:E.selectionStart,end:E.selectionEnd}:(E=(E.ownerDocument&&E.ownerDocument.defaultView||window).getSelection(),E={anchorNode:E.anchorNode,anchorOffset:E.anchorOffset,focusNode:E.focusNode,focusOffset:E.focusOffset}),Gd&&Jl(Gd,E)||(Gd=E,E=Np(tc,"onSelect"),0<E.length&&(h=new Bd("onSelect","select",null,h,b),u.push({event:h,listeners:E}),h.target=Ro)))}function Mu(u,h){var b={};return b[u.toLowerCase()]=h.toLowerCase(),b["Webkit"+u]="webkit"+h,b["Moz"+u]="moz"+h,b}var rl={animationend:Mu("Animation","AnimationEnd"),animationiteration:Mu("Animation","AnimationIteration"),animationstart:Mu("Animation","AnimationStart"),transitionend:Mu("Transition","TransitionEnd")},ro={},io={};a&&(io=document.createElement("div").style,"AnimationEvent"in window||(delete rl.animationend.animation,delete rl.animationiteration.animation,delete rl.animationstart.animation),"TransitionEvent"in window||delete rl.transitionend.transition);function No(u){if(ro[u])return ro[u];if(!rl[u])return u;var h=rl[u],b;for(b in h)if(h.hasOwnProperty(b)&&b in io)return ro[u]=h[b];return u}var Wd=No("animationend"),$d=No("animationiteration"),vv=No("animationstart"),yv=No("transitionend"),xv=new Map,bv="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function fa(u,h){xv.set(u,h),s(h,[u])}for(var Ep=0;Ep<bv.length;Ep++){var Xd=bv[Ep],qd=Xd.toLowerCase(),Cx=Xd[0].toUpperCase()+Xd.slice(1);fa(qd,"on"+Cx)}fa(Wd,"onAnimationEnd"),fa($d,"onAnimationIteration"),fa(vv,"onAnimationStart"),fa("dblclick","onDoubleClick"),fa("focusin","onFocus"),fa("focusout","onBlur"),fa(yv,"onTransitionEnd"),o("onMouseEnter",["mouseout","mouseover"]),o("onMouseLeave",["mouseout","mouseover"]),o("onPointerEnter",["pointerout","pointerover"]),o("onPointerLeave",["pointerout","pointerover"]),s("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),s("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),s("onBeforeInput",["compositionend","keypress","textInput","paste"]),s("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),s("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),s("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var il="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Ap=new Set("cancel close invalid load scroll toggle".split(" ").concat(il));function Tp(u,h,b){var E=u.type||"unknown-event";u.currentTarget=b,uu(E,h,void 0,u),u.currentTarget=null}function Eu(u,h){h=(h&4)!==0;for(var b=0;b<u.length;b++){var E=u[b],I=E.event;E=E.listeners;e:{var U=void 0;if(h)for(var G=E.length-1;0<=G;G--){var se=E[G],he=se.instance,De=se.currentTarget;if(se=se.listener,he!==U&&I.isPropagationStopped())break e;Tp(I,se,De),U=he}else for(G=0;G<E.length;G++){if(se=E[G],he=se.instance,De=se.currentTarget,se=se.listener,he!==U&&I.isPropagationStopped())break e;Tp(I,se,De),U=he}}}if(Ei)throw u=Ao,Ei=!1,Ao=null,u}function Wn(u,h){var b=h[ic];b===void 0&&(b=h[ic]=new Set);var E=u+"__bubble";b.has(E)||(Pp(h,u,2,!1),b.add(E))}function Cp(u,h,b){var E=0;h&&(E|=4),Pp(b,u,E,h)}var Kd="_reactListening"+Math.random().toString(36).slice(2);function Au(u){if(!u[Kd]){u[Kd]=!0,r.forEach(function(b){b!=="selectionchange"&&(Ap.has(b)||Cp(b,!1,u),Cp(b,!0,u))});var h=u.nodeType===9?u:u.ownerDocument;h===null||h[Kd]||(h[Kd]=!0,Cp("selectionchange",!1,h))}}function Pp(u,h,b,E){switch(yx(h)){case 1:var I=cp;break;case 4:I=ov;break;default:I=up}b=I.bind(null,h,b,u),I=void 0,!ra||h!=="touchstart"&&h!=="touchmove"&&h!=="wheel"||(I=!0),E?I!==void 0?u.addEventListener(h,b,{capture:!0,passive:I}):u.addEventListener(h,b,!0):I!==void 0?u.addEventListener(h,b,{passive:I}):u.addEventListener(h,b,!1)}function Rp(u,h,b,E,I){var U=E;if((h&1)===0&&(h&2)===0&&E!==null)e:for(;;){if(E===null)return;var G=E.tag;if(G===3||G===4){var se=E.stateNode.containerInfo;if(se===I||se.nodeType===8&&se.parentNode===I)break;if(G===4)for(G=E.return;G!==null;){var he=G.tag;if((he===3||he===4)&&(he=G.stateNode.containerInfo,he===I||he.nodeType===8&&he.parentNode===I))return;G=G.return}for(;se!==null;){if(G=sl(se),G===null)return;if(he=G.tag,he===5||he===6){E=U=G;continue e}se=se.parentNode}}E=E.return}hr(function(){var De=U,Ze=Fe(b),Je=[];e:{var Ye=xv.get(u);if(Ye!==void 0){var _t=Bd,Tt=u;switch(u){case"keypress":if($l(b)===0)break e;case"keydown":case"keyup":_t=yp;break;case"focusin":Tt="focus",_t=pp;break;case"focusout":Tt="blur",_t=pp;break;case"beforeblur":case"afterblur":_t=pp;break;case"click":if(b.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":_t=lv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":_t=Ja;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":_t=ca;break;case Wd:case $d:case vv:_t=xx;break;case yv:_t=Yl;break;case"scroll":_t=mu;break;case"wheel":_t=fv;break;case"copy":case"cut":case"paste":_t=cv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":_t=us}var Rt=(h&4)!==0,Ir=!Rt&&u==="scroll",Pe=Rt?Ye!==null?Ye+"Capture":null:Ye;Rt=[];for(var ve=De,Ne;ve!==null;){Ne=ve;var it=Ne.stateNode;if(Ne.tag===5&&it!==null&&(Ne=it,Pe!==null&&(it=Si(ve,Pe),it!=null&&Rt.push(Tu(ve,it,Ne)))),Ir)break;ve=ve.return}0<Rt.length&&(Ye=new _t(Ye,Tt,null,b,Ze),Je.push({event:Ye,listeners:Rt}))}}if((h&7)===0){e:{if(Ye=u==="mouseover"||u==="pointerover",_t=u==="mouseout"||u==="pointerout",Ye&&b!==re&&(Tt=b.relatedTarget||b.fromElement)&&(sl(Tt)||Tt[hs]))break e;if((_t||Ye)&&(Ye=Ze.window===Ze?Ze:(Ye=Ze.ownerDocument)?Ye.defaultView||Ye.parentWindow:window,_t?(Tt=b.relatedTarget||b.toElement,_t=De,Tt=Tt?sl(Tt):null,Tt!==null&&(Ir=To(Tt),Tt!==Ir||Tt.tag!==5&&Tt.tag!==6)&&(Tt=null)):(_t=null,Tt=De),_t!==Tt)){if(Rt=lv,it="onMouseLeave",Pe="onMouseEnter",ve="mouse",(u==="pointerout"||u==="pointerover")&&(Rt=us,it="onPointerLeave",Pe="onPointerEnter",ve="pointer"),Ir=_t==null?Ye:pr(_t),Ne=Tt==null?Ye:pr(Tt),Ye=new Rt(it,ve+"leave",_t,b,Ze),Ye.target=Ir,Ye.relatedTarget=Ne,it=null,sl(Ze)===De&&(Rt=new Rt(Pe,ve+"enter",Tt,b,Ze),Rt.target=Ne,Rt.relatedTarget=Ir,it=Rt),Ir=it,_t&&Tt)t:{for(Rt=_t,Pe=Tt,ve=0,Ne=Rt;Ne;Ne=nc(Ne))ve++;for(Ne=0,it=Pe;it;it=nc(it))Ne++;for(;0<ve-Ne;)Rt=nc(Rt),ve--;for(;0<Ne-ve;)Pe=nc(Pe),Ne--;for(;ve--;){if(Rt===Pe||Pe!==null&&Rt===Pe.alternate)break t;Rt=nc(Rt),Pe=nc(Pe)}Rt=null}else Rt=null;_t!==null&&Px(Je,Ye,_t,Rt,!1),Tt!==null&&Ir!==null&&Px(Je,Ir,Tt,Rt,!0)}}e:{if(Ye=De?pr(De):window,_t=Ye.nodeName&&Ye.nodeName.toLowerCase(),_t==="select"||_t==="input"&&Ye.type==="file")var Ot=Ax;else if(bp(Ye))if(wu)Ot=tr;else{Ot=Tx;var Vt=Su}else(_t=Ye.nodeName)&&_t.toLowerCase()==="input"&&(Ye.type==="checkbox"||Ye.type==="radio")&&(Ot=gv);if(Ot&&(Ot=Ot(u,De))){bu(Je,Ot,b,Ze);break e}Vt&&Vt(u,Ye,De),u==="focusout"&&(Vt=Ye._wrapperState)&&Vt.controlled&&Ye.type==="number"&&at(Ye,"number",Ye.value)}switch(Vt=De?pr(De):window,u){case"focusin":(bp(Vt)||Vt.contentEditable==="true")&&(Ro=Vt,tc=De,Gd=null);break;case"focusout":Gd=tc=Ro=null;break;case"mousedown":jr=!0;break;case"contextmenu":case"mouseup":case"dragend":jr=!1,Mp(Je,b,Ze);break;case"selectionchange":if(Sp)break;case"keydown":case"keyup":Mp(Je,b,Ze)}var Gt;if(Ci)e:{switch(u){case"compositionstart":var tn="onCompositionStart";break e;case"compositionend":tn="onCompositionEnd";break e;case"compositionupdate":tn="onCompositionUpdate";break e}tn=void 0}else tl?mv(u,b)&&(tn="onCompositionEnd"):u==="keydown"&&b.keyCode===229&&(tn="onCompositionStart");tn&&(yu&&b.locale!=="ko"&&(tl||tn!=="onCompositionStart"?tn==="onCompositionEnd"&&tl&&(Gt=zd()):(to=Ze,av="value"in to?to.value:to.textContent,tl=!0)),Vt=Np(De,tn),0<Vt.length&&(tn=new uv(tn,u,null,b,Ze),Je.push({event:tn,listeners:Vt}),Gt?tn.data=Gt:(Gt=xp(b),Gt!==null&&(tn.data=Gt)))),(Gt=Zn?Mx(u,b):Hd(u,b))&&(De=Np(De,"onBeforeInput"),0<De.length&&(Ze=new uv("onBeforeInput","beforeinput",null,b,Ze),Je.push({event:Ze,listeners:De}),Ze.data=Gt))}Eu(Je,h)})}function Tu(u,h,b){return{instance:u,listener:h,currentTarget:b}}function Np(u,h){for(var b=h+"Capture",E=[];u!==null;){var I=u,U=I.stateNode;I.tag===5&&U!==null&&(I=U,U=Si(u,b),U!=null&&E.unshift(Tu(u,U,I)),U=Si(u,h),U!=null&&E.push(Tu(u,U,I))),u=u.return}return E}function nc(u){if(u===null)return null;do u=u.return;while(u&&u.tag!==5);return u||null}function Px(u,h,b,E,I){for(var U=h._reactName,G=[];b!==null&&b!==E;){var se=b,he=se.alternate,De=se.stateNode;if(he!==null&&he===E)break;se.tag===5&&De!==null&&(se=De,I?(he=Si(b,U),he!=null&&G.unshift(Tu(b,he,se))):I||(he=Si(b,U),he!=null&&G.push(Tu(b,he,se)))),b=b.return}G.length!==0&&u.push({event:h,listeners:G})}var wM=/\r\n?/g,Rx=/\u0000|\uFFFD/g;function _v(u){return(typeof u=="string"?u:""+u).replace(wM,`
|
||
`).replace(Rx,"")}function Yd(u,h,b){if(h=_v(h),_v(u)!==h&&b)throw Error(n(425))}function Zd(){}var Cu=null,wv=null;function Sv(u,h){return u==="textarea"||u==="noscript"||typeof h.children=="string"||typeof h.children=="number"||typeof h.dangerouslySetInnerHTML=="object"&&h.dangerouslySetInnerHTML!==null&&h.dangerouslySetInnerHTML.__html!=null}var Mv=typeof setTimeout=="function"?setTimeout:void 0,Ev=typeof clearTimeout=="function"?clearTimeout:void 0,Ip=typeof Promise=="function"?Promise:void 0,SM=typeof queueMicrotask=="function"?queueMicrotask:typeof Ip<"u"?function(u){return Ip.resolve(null).then(u).catch(Nx)}:Mv;function Nx(u){setTimeout(function(){throw u})}function kp(u,h){var b=h,E=0;do{var I=b.nextSibling;if(u.removeChild(b),I&&I.nodeType===8)if(b=I.data,b==="/$"){if(E===0){u.removeChild(I),Fd(h);return}E--}else b!=="$"&&b!=="$?"&&b!=="$!"||E++;b=I}while(b);Fd(h)}function ha(u){for(;u!=null;u=u.nextSibling){var h=u.nodeType;if(h===1||h===3)break;if(h===8){if(h=u.data,h==="$"||h==="$!"||h==="$?")break;if(h==="/$")return null}}return u}function Av(u){u=u.previousSibling;for(var h=0;u;){if(u.nodeType===8){var b=u.data;if(b==="$"||b==="$!"||b==="$?"){if(h===0)return u;h--}else b==="/$"&&h++}u=u.previousSibling}return null}var rc=Math.random().toString(36).slice(2),Nr="__reactFiber$"+rc,Pu="__reactProps$"+rc,hs="__reactContainer$"+rc,ic="__reactEvents$"+rc,Op="__reactListeners$"+rc,Lp="__reactHandles$"+rc;function sl(u){var h=u[Nr];if(h)return h;for(var b=u.parentNode;b;){if(h=b[hs]||b[Nr]){if(b=h.alternate,h.child!==null||b!==null&&b.child!==null)for(u=Av(u);u!==null;){if(b=u[Nr])return b;u=Av(u)}return h}u=b,b=u.parentNode}return null}function pa(u){return u=u[Nr]||u[hs],!u||u.tag!==5&&u.tag!==6&&u.tag!==13&&u.tag!==3?null:u}function pr(u){if(u.tag===5||u.tag===6)return u.stateNode;throw Error(n(33))}function Dp(u){return u[Pu]||null}var Tv=[],Fr=-1;function ar(u){return{current:u}}function $n(u){0>Fr||(u.current=Tv[Fr],Tv[Fr]=null,Fr--)}function Gn(u,h){Fr++,Tv[Fr]=u.current,u.current=h}var ma={},Kr=ar(ma),Pi=ar(!1),ga=ma;function sc(u,h){var b=u.type.contextTypes;if(!b)return ma;var E=u.stateNode;if(E&&E.__reactInternalMemoizedUnmaskedChildContext===h)return E.__reactInternalMemoizedMaskedChildContext;var I={},U;for(U in b)I[U]=h[U];return E&&(u=u.stateNode,u.__reactInternalMemoizedUnmaskedChildContext=h,u.__reactInternalMemoizedMaskedChildContext=I),I}function ui(u){return u=u.childContextTypes,u!=null}function Qd(){$n(Pi),$n(Kr)}function Cv(u,h,b){if(Kr.current!==ma)throw Error(n(168));Gn(Kr,h),Gn(Pi,b)}function Jd(u,h,b){var E=u.stateNode;if(h=h.childContextTypes,typeof E.getChildContext!="function")return b;E=E.getChildContext();for(var I in E)if(!(I in h))throw Error(n(108,Se(u)||"Unknown",I));return q({},b,E)}function oc(u){return u=(u=u.stateNode)&&u.__reactInternalMemoizedMergedChildContext||ma,ga=Kr.current,Gn(Kr,u),Gn(Pi,Pi.current),!0}function Pv(u,h,b){var E=u.stateNode;if(!E)throw Error(n(169));b?(u=Jd(u,h,ga),E.__reactInternalMemoizedMergedChildContext=u,$n(Pi),$n(Kr),Gn(Kr,u)):$n(Pi),Gn(Pi,b)}var so=null,ef=!1,Up=!1;function tf(u){so===null?so=[u]:so.push(u)}function Ix(u){ef=!0,tf(u)}function Io(){if(!Up&&so!==null){Up=!0;var u=0,h=Pn;try{var b=so;for(Pn=1;u<b.length;u++){var E=b[u];do E=E(!0);while(E!==null)}so=null,ef=!1}catch(I){throw so!==null&&(so=so.slice(u+1)),ke(Ft,Io),I}finally{Pn=h,Up=!1}}return null}var ac=[],qi=0,jp=null,Fp=0,Ri=[],zr=0,lc=null,ct=1,Fs="";function va(u,h){ac[qi++]=Fp,ac[qi++]=jp,jp=u,Fp=h}function Rv(u,h,b){Ri[zr++]=ct,Ri[zr++]=Fs,Ri[zr++]=lc,lc=u;var E=ct;u=Fs;var I=32-mt(E)-1;E&=~(1<<I),b+=1;var U=32-mt(h)+I;if(30<U){var G=I-I%5;U=(E&(1<<G)-1).toString(32),E>>=G,I-=G,ct=1<<32-mt(h)+I|b<<I|E,Fs=U+u}else ct=1<<U|b<<I|E,Fs=u}function Nv(u){u.return!==null&&(va(u,1),Rv(u,1,0))}function ya(u){for(;u===jp;)jp=ac[--qi],ac[qi]=null,Fp=ac[--qi],ac[qi]=null;for(;u===lc;)lc=Ri[--zr],Ri[zr]=null,Fs=Ri[--zr],Ri[zr]=null,ct=Ri[--zr],Ri[zr]=null}var Yr=null,Ni=null,qn=!1,zs=null;function Iv(u,h){var b=Uo(5,null,null,0);b.elementType="DELETED",b.stateNode=h,b.return=u,h=u.deletions,h===null?(u.deletions=[b],u.flags|=16):h.push(b)}function kv(u,h){switch(u.tag){case 5:var b=u.type;return h=h.nodeType!==1||b.toLowerCase()!==h.nodeName.toLowerCase()?null:h,h!==null?(u.stateNode=h,Yr=u,Ni=ha(h.firstChild),!0):!1;case 6:return h=u.pendingProps===""||h.nodeType!==3?null:h,h!==null?(u.stateNode=h,Yr=u,Ni=null,!0):!1;case 13:return h=h.nodeType!==8?null:h,h!==null?(b=lc!==null?{id:ct,overflow:Fs}:null,u.memoizedState={dehydrated:h,treeContext:b,retryLane:1073741824},b=Uo(18,null,null,0),b.stateNode=h,b.return=u,u.child=b,Yr=u,Ni=null,!0):!1;default:return!1}}function zp(u){return(u.mode&1)!==0&&(u.flags&128)===0}function Bp(u){if(qn){var h=Ni;if(h){var b=h;if(!kv(u,h)){if(zp(u))throw Error(n(418));h=ha(b.nextSibling);var E=Yr;h&&kv(u,h)?Iv(E,b):(u.flags=u.flags&-4097|2,qn=!1,Yr=u)}}else{if(zp(u))throw Error(n(418));u.flags=u.flags&-4097|2,qn=!1,Yr=u}}}function Hp(u){for(u=u.return;u!==null&&u.tag!==5&&u.tag!==3&&u.tag!==13;)u=u.return;Yr=u}function Ru(u){if(u!==Yr)return!1;if(!qn)return Hp(u),qn=!0,!1;var h;if((h=u.tag!==3)&&!(h=u.tag!==5)&&(h=u.type,h=h!=="head"&&h!=="body"&&!Sv(u.type,u.memoizedProps)),h&&(h=Ni)){if(zp(u))throw Ov(),Error(n(418));for(;h;)Iv(u,h),h=ha(h.nextSibling)}if(Hp(u),u.tag===13){if(u=u.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(n(317));e:{for(u=u.nextSibling,h=0;u;){if(u.nodeType===8){var b=u.data;if(b==="/$"){if(h===0){Ni=ha(u.nextSibling);break e}h--}else b!=="$"&&b!=="$!"&&b!=="$?"||h++}u=u.nextSibling}Ni=null}}else Ni=Yr?ha(u.stateNode.nextSibling):null;return!0}function Ov(){for(var u=Ni;u;)u=ha(u.nextSibling)}function ol(){Ni=Yr=null,qn=!1}function Nu(u){zs===null?zs=[u]:zs.push(u)}var MM=C.ReactCurrentBatchConfig;function nf(u,h,b){if(u=b.ref,u!==null&&typeof u!="function"&&typeof u!="object"){if(b._owner){if(b=b._owner,b){if(b.tag!==1)throw Error(n(309));var E=b.stateNode}if(!E)throw Error(n(147,u));var I=E,U=""+u;return h!==null&&h.ref!==null&&typeof h.ref=="function"&&h.ref._stringRef===U?h.ref:(h=function(G){var se=I.refs;G===null?delete se[U]:se[U]=G},h._stringRef=U,h)}if(typeof u!="string")throw Error(n(284));if(!b._owner)throw Error(n(290,u))}return u}function rf(u,h){throw u=Object.prototype.toString.call(h),Error(n(31,u==="[object Object]"?"object with keys {"+Object.keys(h).join(", ")+"}":u))}function Lv(u){var h=u._init;return h(u._payload)}function Dv(u){function h(Pe,ve){if(u){var Ne=Pe.deletions;Ne===null?(Pe.deletions=[ve],Pe.flags|=16):Ne.push(ve)}}function b(Pe,ve){if(!u)return null;for(;ve!==null;)h(Pe,ve),ve=ve.sibling;return null}function E(Pe,ve){for(Pe=new Map;ve!==null;)ve.key!==null?Pe.set(ve.key,ve):Pe.set(ve.index,ve),ve=ve.sibling;return Pe}function I(Pe,ve){return Pe=Hu(Pe,ve),Pe.index=0,Pe.sibling=null,Pe}function U(Pe,ve,Ne){return Pe.index=Ne,u?(Ne=Pe.alternate,Ne!==null?(Ne=Ne.index,Ne<ve?(Pe.flags|=2,ve):Ne):(Pe.flags|=2,ve)):(Pe.flags|=1048576,ve)}function G(Pe){return u&&Pe.alternate===null&&(Pe.flags|=2),Pe}function se(Pe,ve,Ne,it){return ve===null||ve.tag!==6?(ve=VM(Ne,Pe.mode,it),ve.return=Pe,ve):(ve=I(ve,Ne),ve.return=Pe,ve)}function he(Pe,ve,Ne,it){var Ot=Ne.type;return Ot===D?Ze(Pe,ve,Ne.props.children,it,Ne.key):ve!==null&&(ve.elementType===Ot||typeof Ot=="object"&&Ot!==null&&Ot.$$typeof===oe&&Lv(Ot)===ve.type)?(it=I(ve,Ne.props),it.ref=nf(Pe,ve,Ne),it.return=Pe,it):(it=tb(Ne.type,Ne.key,Ne.props,null,Pe.mode,it),it.ref=nf(Pe,ve,Ne),it.return=Pe,it)}function De(Pe,ve,Ne,it){return ve===null||ve.tag!==4||ve.stateNode.containerInfo!==Ne.containerInfo||ve.stateNode.implementation!==Ne.implementation?(ve=GM(Ne,Pe.mode,it),ve.return=Pe,ve):(ve=I(ve,Ne.children||[]),ve.return=Pe,ve)}function Ze(Pe,ve,Ne,it,Ot){return ve===null||ve.tag!==7?(ve=_f(Ne,Pe.mode,it,Ot),ve.return=Pe,ve):(ve=I(ve,Ne),ve.return=Pe,ve)}function Je(Pe,ve,Ne){if(typeof ve=="string"&&ve!==""||typeof ve=="number")return ve=VM(""+ve,Pe.mode,Ne),ve.return=Pe,ve;if(typeof ve=="object"&&ve!==null){switch(ve.$$typeof){case O:return Ne=tb(ve.type,ve.key,ve.props,null,Pe.mode,Ne),Ne.ref=nf(Pe,null,ve),Ne.return=Pe,Ne;case N:return ve=GM(ve,Pe.mode,Ne),ve.return=Pe,ve;case oe:var it=ve._init;return Je(Pe,it(ve._payload),Ne)}if(ee(ve)||K(ve))return ve=_f(ve,Pe.mode,Ne,null),ve.return=Pe,ve;rf(Pe,ve)}return null}function Ye(Pe,ve,Ne,it){var Ot=ve!==null?ve.key:null;if(typeof Ne=="string"&&Ne!==""||typeof Ne=="number")return Ot!==null?null:se(Pe,ve,""+Ne,it);if(typeof Ne=="object"&&Ne!==null){switch(Ne.$$typeof){case O:return Ne.key===Ot?he(Pe,ve,Ne,it):null;case N:return Ne.key===Ot?De(Pe,ve,Ne,it):null;case oe:return Ot=Ne._init,Ye(Pe,ve,Ot(Ne._payload),it)}if(ee(Ne)||K(Ne))return Ot!==null?null:Ze(Pe,ve,Ne,it,null);rf(Pe,Ne)}return null}function _t(Pe,ve,Ne,it,Ot){if(typeof it=="string"&&it!==""||typeof it=="number")return Pe=Pe.get(Ne)||null,se(ve,Pe,""+it,Ot);if(typeof it=="object"&&it!==null){switch(it.$$typeof){case O:return Pe=Pe.get(it.key===null?Ne:it.key)||null,he(ve,Pe,it,Ot);case N:return Pe=Pe.get(it.key===null?Ne:it.key)||null,De(ve,Pe,it,Ot);case oe:var Vt=it._init;return _t(Pe,ve,Ne,Vt(it._payload),Ot)}if(ee(it)||K(it))return Pe=Pe.get(Ne)||null,Ze(ve,Pe,it,Ot,null);rf(ve,it)}return null}function Tt(Pe,ve,Ne,it){for(var Ot=null,Vt=null,Gt=ve,tn=ve=0,pi=null;Gt!==null&&tn<Ne.length;tn++){Gt.index>tn?(pi=Gt,Gt=null):pi=Gt.sibling;var Dn=Ye(Pe,Gt,Ne[tn],it);if(Dn===null){Gt===null&&(Gt=pi);break}u&&Gt&&Dn.alternate===null&&h(Pe,Gt),ve=U(Dn,ve,tn),Vt===null?Ot=Dn:Vt.sibling=Dn,Vt=Dn,Gt=pi}if(tn===Ne.length)return b(Pe,Gt),qn&&va(Pe,tn),Ot;if(Gt===null){for(;tn<Ne.length;tn++)Gt=Je(Pe,Ne[tn],it),Gt!==null&&(ve=U(Gt,ve,tn),Vt===null?Ot=Gt:Vt.sibling=Gt,Vt=Gt);return qn&&va(Pe,tn),Ot}for(Gt=E(Pe,Gt);tn<Ne.length;tn++)pi=_t(Gt,Pe,tn,Ne[tn],it),pi!==null&&(u&&pi.alternate!==null&&Gt.delete(pi.key===null?tn:pi.key),ve=U(pi,ve,tn),Vt===null?Ot=pi:Vt.sibling=pi,Vt=pi);return u&&Gt.forEach(function(Vu){return h(Pe,Vu)}),qn&&va(Pe,tn),Ot}function Rt(Pe,ve,Ne,it){var Ot=K(Ne);if(typeof Ot!="function")throw Error(n(150));if(Ne=Ot.call(Ne),Ne==null)throw Error(n(151));for(var Vt=Ot=null,Gt=ve,tn=ve=0,pi=null,Dn=Ne.next();Gt!==null&&!Dn.done;tn++,Dn=Ne.next()){Gt.index>tn?(pi=Gt,Gt=null):pi=Gt.sibling;var Vu=Ye(Pe,Gt,Dn.value,it);if(Vu===null){Gt===null&&(Gt=pi);break}u&&Gt&&Vu.alternate===null&&h(Pe,Gt),ve=U(Vu,ve,tn),Vt===null?Ot=Vu:Vt.sibling=Vu,Vt=Vu,Gt=pi}if(Dn.done)return b(Pe,Gt),qn&&va(Pe,tn),Ot;if(Gt===null){for(;!Dn.done;tn++,Dn=Ne.next())Dn=Je(Pe,Dn.value,it),Dn!==null&&(ve=U(Dn,ve,tn),Vt===null?Ot=Dn:Vt.sibling=Dn,Vt=Dn);return qn&&va(Pe,tn),Ot}for(Gt=E(Pe,Gt);!Dn.done;tn++,Dn=Ne.next())Dn=_t(Gt,Pe,tn,Dn.value,it),Dn!==null&&(u&&Dn.alternate!==null&&Gt.delete(Dn.key===null?tn:Dn.key),ve=U(Dn,ve,tn),Vt===null?Ot=Dn:Vt.sibling=Dn,Vt=Dn);return u&&Gt.forEach(function(vW){return h(Pe,vW)}),qn&&va(Pe,tn),Ot}function Ir(Pe,ve,Ne,it){if(typeof Ne=="object"&&Ne!==null&&Ne.type===D&&Ne.key===null&&(Ne=Ne.props.children),typeof Ne=="object"&&Ne!==null){switch(Ne.$$typeof){case O:e:{for(var Ot=Ne.key,Vt=ve;Vt!==null;){if(Vt.key===Ot){if(Ot=Ne.type,Ot===D){if(Vt.tag===7){b(Pe,Vt.sibling),ve=I(Vt,Ne.props.children),ve.return=Pe,Pe=ve;break e}}else if(Vt.elementType===Ot||typeof Ot=="object"&&Ot!==null&&Ot.$$typeof===oe&&Lv(Ot)===Vt.type){b(Pe,Vt.sibling),ve=I(Vt,Ne.props),ve.ref=nf(Pe,Vt,Ne),ve.return=Pe,Pe=ve;break e}b(Pe,Vt);break}else h(Pe,Vt);Vt=Vt.sibling}Ne.type===D?(ve=_f(Ne.props.children,Pe.mode,it,Ne.key),ve.return=Pe,Pe=ve):(it=tb(Ne.type,Ne.key,Ne.props,null,Pe.mode,it),it.ref=nf(Pe,ve,Ne),it.return=Pe,Pe=it)}return G(Pe);case N:e:{for(Vt=Ne.key;ve!==null;){if(ve.key===Vt)if(ve.tag===4&&ve.stateNode.containerInfo===Ne.containerInfo&&ve.stateNode.implementation===Ne.implementation){b(Pe,ve.sibling),ve=I(ve,Ne.children||[]),ve.return=Pe,Pe=ve;break e}else{b(Pe,ve);break}else h(Pe,ve);ve=ve.sibling}ve=GM(Ne,Pe.mode,it),ve.return=Pe,Pe=ve}return G(Pe);case oe:return Vt=Ne._init,Ir(Pe,ve,Vt(Ne._payload),it)}if(ee(Ne))return Tt(Pe,ve,Ne,it);if(K(Ne))return Rt(Pe,ve,Ne,it);rf(Pe,Ne)}return typeof Ne=="string"&&Ne!==""||typeof Ne=="number"?(Ne=""+Ne,ve!==null&&ve.tag===6?(b(Pe,ve.sibling),ve=I(ve,Ne),ve.return=Pe,Pe=ve):(b(Pe,ve),ve=VM(Ne,Pe.mode,it),ve.return=Pe,Pe=ve),G(Pe)):b(Pe,ve)}return Ir}var cc=Dv(!0),sf=Dv(!1),uc=ar(null),dc=null,xa=null,Iu=null;function fc(){Iu=xa=dc=null}function of(u){var h=uc.current;$n(uc),u._currentValue=h}function af(u,h,b){for(;u!==null;){var E=u.alternate;if((u.childLanes&h)!==h?(u.childLanes|=h,E!==null&&(E.childLanes|=h)):E!==null&&(E.childLanes&h)!==h&&(E.childLanes|=h),u===b)break;u=u.return}}function al(u,h){dc=u,Iu=xa=null,u=u.dependencies,u!==null&&u.firstContext!==null&&((u.lanes&h)!==0&&(ln=!0),u.firstContext=null)}function ps(u){var h=u._currentValue;if(Iu!==u)if(u={context:u,memoizedValue:h,next:null},xa===null){if(dc===null)throw Error(n(308));xa=u,dc.dependencies={lanes:0,firstContext:u}}else xa=xa.next=u;return h}var ba=null;function Uv(u){ba===null?ba=[u]:ba.push(u)}function lf(u,h,b,E){var I=h.interleaved;return I===null?(b.next=b,Uv(h)):(b.next=I.next,I.next=b),h.interleaved=b,oo(u,E)}function oo(u,h){u.lanes|=h;var b=u.alternate;for(b!==null&&(b.lanes|=h),b=u,u=u.return;u!==null;)u.childLanes|=h,b=u.alternate,b!==null&&(b.childLanes|=h),b=u,u=u.return;return b.tag===3?b.stateNode:null}var Fn=!1;function an(u){u.updateQueue={baseState:u.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function mr(u,h){u=u.updateQueue,h.updateQueue===u&&(h.updateQueue={baseState:u.baseState,firstBaseUpdate:u.firstBaseUpdate,lastBaseUpdate:u.lastBaseUpdate,shared:u.shared,effects:u.effects})}function zn(u,h){return{eventTime:u,lane:h,tag:0,payload:null,callback:null,next:null}}function Qn(u,h,b){var E=u.updateQueue;if(E===null)return null;if(E=E.shared,(On&2)!==0){var I=E.pending;return I===null?h.next=h:(h.next=I.next,I.next=h),E.pending=h,oo(u,b)}return I=E.interleaved,I===null?(h.next=h,Uv(E)):(h.next=I.next,I.next=h),E.interleaved=h,oo(u,b)}function di(u,h,b){if(h=h.updateQueue,h!==null&&(h=h.shared,(b&4194240)!==0)){var E=h.lanes;E&=u.pendingLanes,b|=E,h.lanes=b,fu(u,b)}}function hc(u,h){var b=u.updateQueue,E=u.alternate;if(E!==null&&(E=E.updateQueue,b===E)){var I=null,U=null;if(b=b.firstBaseUpdate,b!==null){do{var G={eventTime:b.eventTime,lane:b.lane,tag:b.tag,payload:b.payload,callback:b.callback,next:null};U===null?I=U=G:U=U.next=G,b=b.next}while(b!==null);U===null?I=U=h:U=U.next=h}else I=U=h;b={baseState:E.baseState,firstBaseUpdate:I,lastBaseUpdate:U,shared:E.shared,effects:E.effects},u.updateQueue=b;return}u=b.lastBaseUpdate,u===null?b.firstBaseUpdate=h:u.next=h,b.lastBaseUpdate=h}function lr(u,h,b,E){var I=u.updateQueue;Fn=!1;var U=I.firstBaseUpdate,G=I.lastBaseUpdate,se=I.shared.pending;if(se!==null){I.shared.pending=null;var he=se,De=he.next;he.next=null,G===null?U=De:G.next=De,G=he;var Ze=u.alternate;Ze!==null&&(Ze=Ze.updateQueue,se=Ze.lastBaseUpdate,se!==G&&(se===null?Ze.firstBaseUpdate=De:se.next=De,Ze.lastBaseUpdate=he))}if(U!==null){var Je=I.baseState;G=0,Ze=De=he=null,se=U;do{var Ye=se.lane,_t=se.eventTime;if((E&Ye)===Ye){Ze!==null&&(Ze=Ze.next={eventTime:_t,lane:0,tag:se.tag,payload:se.payload,callback:se.callback,next:null});e:{var Tt=u,Rt=se;switch(Ye=h,_t=b,Rt.tag){case 1:if(Tt=Rt.payload,typeof Tt=="function"){Je=Tt.call(_t,Je,Ye);break e}Je=Tt;break e;case 3:Tt.flags=Tt.flags&-65537|128;case 0:if(Tt=Rt.payload,Ye=typeof Tt=="function"?Tt.call(_t,Je,Ye):Tt,Ye==null)break e;Je=q({},Je,Ye);break e;case 2:Fn=!0}}se.callback!==null&&se.lane!==0&&(u.flags|=64,Ye=I.effects,Ye===null?I.effects=[se]:Ye.push(se))}else _t={eventTime:_t,lane:Ye,tag:se.tag,payload:se.payload,callback:se.callback,next:null},Ze===null?(De=Ze=_t,he=Je):Ze=Ze.next=_t,G|=Ye;if(se=se.next,se===null){if(se=I.shared.pending,se===null)break;Ye=se,se=Ye.next,Ye.next=null,I.lastBaseUpdate=Ye,I.shared.pending=null}}while(!0);if(Ze===null&&(he=Je),I.baseState=he,I.firstBaseUpdate=De,I.lastBaseUpdate=Ze,h=I.shared.interleaved,h!==null){I=h;do G|=I.lane,I=I.next;while(I!==h)}else U===null&&(I.shared.lanes=0);vf|=G,u.lanes=G,u.memoizedState=Je}}function ku(u,h,b){if(u=h.effects,h.effects=null,u!==null)for(h=0;h<u.length;h++){var E=u[h],I=E.callback;if(I!==null){if(E.callback=null,E=b,typeof I!="function")throw Error(n(191,I));I.call(E)}}}var ko={},ms=ar(ko),pc=ar(ko),_a=ar(ko);function xr(u){if(u===ko)throw Error(n(174));return u}function cf(u,h){switch(Gn(_a,h),Gn(pc,u),Gn(ms,ko),u=h.nodeType,u){case 9:case 11:h=(h=h.documentElement)?h.namespaceURI:rt(null,"");break;default:u=u===8?h.parentNode:h,h=u.namespaceURI||null,u=u.tagName,h=rt(h,u)}$n(ms),Gn(ms,h)}function ll(){$n(ms),$n(pc),$n(_a)}function mc(u){xr(_a.current);var h=xr(ms.current),b=rt(h,u.type);h!==b&&(Gn(pc,u),Gn(ms,b))}function Ou(u){pc.current===u&&($n(ms),$n(pc))}var Kn=ar(0);function ao(u){for(var h=u;h!==null;){if(h.tag===13){var b=h.memoizedState;if(b!==null&&(b=b.dehydrated,b===null||b.data==="$?"||b.data==="$!"))return h}else if(h.tag===19&&h.memoizedProps.revealOrder!==void 0){if((h.flags&128)!==0)return h}else if(h.child!==null){h.child.return=h,h=h.child;continue}if(h===u)break;for(;h.sibling===null;){if(h.return===null||h.return===u)return null;h=h.return}h.sibling.return=h.return,h=h.sibling}return null}var Lu=[];function Oo(){for(var u=0;u<Lu.length;u++)Lu[u]._workInProgressVersionPrimary=null;Lu.length=0}var gc=C.ReactCurrentDispatcher,vc=C.ReactCurrentBatchConfig,wa=0,Xn=null,cr=null,Rn=null,lo=!1,fi=!1,cl=0,Ki=0;function Zr(){throw Error(n(321))}function uf(u,h){if(h===null)return!1;for(var b=0;b<h.length&&b<u.length;b++)if(!ds(u[b],h[b]))return!1;return!0}function df(u,h,b,E,I,U){if(wa=U,Xn=h,h.memoizedState=null,h.updateQueue=null,h.lanes=0,gc.current=u===null||u.memoizedState===null?Fx:zx,u=b(E,I),fi){U=0;do{if(fi=!1,cl=0,25<=U)throw Error(n(301));U+=1,Rn=cr=null,h.updateQueue=null,gc.current=Bx,u=b(E,I)}while(fi)}if(gc.current=Kp,h=cr!==null&&cr.next!==null,wa=0,Rn=cr=Xn=null,lo=!1,h)throw Error(n(300));return u}function jv(){var u=cl!==0;return cl=0,u}function Qr(){var u={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Rn===null?Xn.memoizedState=Rn=u:Rn=Rn.next=u,Rn}function gs(){if(cr===null){var u=Xn.alternate;u=u!==null?u.memoizedState:null}else u=cr.next;var h=Rn===null?Xn.memoizedState:Rn.next;if(h!==null)Rn=h,cr=u;else{if(u===null)throw Error(n(310));cr=u,u={memoizedState:cr.memoizedState,baseState:cr.baseState,baseQueue:cr.baseQueue,queue:cr.queue,next:null},Rn===null?Xn.memoizedState=Rn=u:Rn=Rn.next=u}return Rn}function Du(u,h){return typeof h=="function"?h(u):h}function ff(u){var h=gs(),b=h.queue;if(b===null)throw Error(n(311));b.lastRenderedReducer=u;var E=cr,I=E.baseQueue,U=b.pending;if(U!==null){if(I!==null){var G=I.next;I.next=U.next,U.next=G}E.baseQueue=I=U,b.pending=null}if(I!==null){U=I.next,E=E.baseState;var se=G=null,he=null,De=U;do{var Ze=De.lane;if((wa&Ze)===Ze)he!==null&&(he=he.next={lane:0,action:De.action,hasEagerState:De.hasEagerState,eagerState:De.eagerState,next:null}),E=De.hasEagerState?De.eagerState:u(E,De.action);else{var Je={lane:Ze,action:De.action,hasEagerState:De.hasEagerState,eagerState:De.eagerState,next:null};he===null?(se=he=Je,G=E):he=he.next=Je,Xn.lanes|=Ze,vf|=Ze}De=De.next}while(De!==null&&De!==U);he===null?G=E:he.next=se,ds(E,h.memoizedState)||(ln=!0),h.memoizedState=E,h.baseState=G,h.baseQueue=he,b.lastRenderedState=E}if(u=b.interleaved,u!==null){I=u;do U=I.lane,Xn.lanes|=U,vf|=U,I=I.next;while(I!==u)}else I===null&&(b.lanes=0);return[h.memoizedState,b.dispatch]}function Sa(u){var h=gs(),b=h.queue;if(b===null)throw Error(n(311));b.lastRenderedReducer=u;var E=b.dispatch,I=b.pending,U=h.memoizedState;if(I!==null){b.pending=null;var G=I=I.next;do U=u(U,G.action),G=G.next;while(G!==I);ds(U,h.memoizedState)||(ln=!0),h.memoizedState=U,h.baseQueue===null&&(h.baseState=U),b.lastRenderedState=U}return[U,E]}function Fv(){}function zv(u,h){var b=Xn,E=gs(),I=h(),U=!ds(E.memoizedState,I);if(U&&(E.memoizedState=I,ln=!0),E=E.queue,Vv(kx.bind(null,b,E,u),[u]),E.getSnapshot!==h||U||Rn!==null&&Rn.memoizedState.tag&1){if(b.flags|=2048,co(9,hf.bind(null,b,E,I,h),void 0,null),hi===null)throw Error(n(349));(wa&30)!==0||Vp(b,h,I)}return I}function Vp(u,h,b){u.flags|=16384,u={getSnapshot:h,value:b},h=Xn.updateQueue,h===null?(h={lastEffect:null,stores:null},Xn.updateQueue=h,h.stores=[u]):(b=h.stores,b===null?h.stores=[u]:b.push(u))}function hf(u,h,b,E){h.value=b,h.getSnapshot=E,Ox(h)&&Bv(u)}function kx(u,h,b){return b(function(){Ox(h)&&Bv(u)})}function Ox(u){var h=u.getSnapshot;u=u.value;try{var b=h();return!ds(u,b)}catch{return!0}}function Bv(u){var h=oo(u,1);h!==null&&Ca(h,u,1,-1)}function Hv(u){var h=Qr();return typeof u=="function"&&(u=u()),h.memoizedState=h.baseState=u,u={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Du,lastRenderedState:u},h.queue=u,u=u.dispatch=yc.bind(null,Xn,u),[h.memoizedState,u]}function co(u,h,b,E){return u={tag:u,create:h,destroy:b,deps:E,next:null},h=Xn.updateQueue,h===null?(h={lastEffect:null,stores:null},Xn.updateQueue=h,h.lastEffect=u.next=u):(b=h.lastEffect,b===null?h.lastEffect=u.next=u:(E=b.next,b.next=u,u.next=E,h.lastEffect=u)),u}function Lx(){return gs().memoizedState}function Lo(u,h,b,E){var I=Qr();Xn.flags|=u,I.memoizedState=co(1|h,b,void 0,E===void 0?null:E)}function pf(u,h,b,E){var I=gs();E=E===void 0?null:E;var U=void 0;if(cr!==null){var G=cr.memoizedState;if(U=G.destroy,E!==null&&uf(E,G.deps)){I.memoizedState=co(h,b,U,E);return}}Xn.flags|=u,I.memoizedState=co(1|h,b,U,E)}function Ii(u,h){return Lo(8390656,8,u,h)}function Vv(u,h){return pf(2048,8,u,h)}function Gv(u,h){return pf(4,2,u,h)}function Dx(u,h){return pf(4,4,u,h)}function Ux(u,h){if(typeof h=="function")return u=u(),h(u),function(){h(null)};if(h!=null)return u=u(),h.current=u,function(){h.current=null}}function Wv(u,h,b){return b=b!=null?b.concat([u]):null,pf(4,4,Ux.bind(null,h,u),b)}function Gp(){}function jx(u,h){var b=gs();h=h===void 0?null:h;var E=b.memoizedState;return E!==null&&h!==null&&uf(h,E[1])?E[0]:(b.memoizedState=[u,h],u)}function vs(u,h){var b=gs();h=h===void 0?null:h;var E=b.memoizedState;return E!==null&&h!==null&&uf(h,E[1])?E[0]:(u=u(),b.memoizedState=[u,h],u)}function Wp(u,h,b){return(wa&21)===0?(u.baseState&&(u.baseState=!1,ln=!0),u.memoizedState=b):(ds(b,h)||(b=ci(),Xn.lanes|=b,vf|=b,u.baseState=!0),h)}function EM(u,h){var b=Pn;Pn=b!==0&&4>b?b:4,u(!0);var E=vc.transition;vc.transition={};try{u(!1),h()}finally{Pn=b,vc.transition=E}}function Ma(){return gs().memoizedState}function $p(u,h,b){var E=zu(u);if(b={lane:E,action:b,hasEagerState:!1,eagerState:null,next:null},mf(u))Xp(h,b);else if(b=lf(u,h,b,E),b!==null){var I=xs();Ca(b,u,E,I),qp(b,h,E)}}function yc(u,h,b){var E=zu(u),I={lane:E,action:b,hasEagerState:!1,eagerState:null,next:null};if(mf(u))Xp(h,I);else{var U=u.alternate;if(u.lanes===0&&(U===null||U.lanes===0)&&(U=h.lastRenderedReducer,U!==null))try{var G=h.lastRenderedState,se=U(G,b);if(I.hasEagerState=!0,I.eagerState=se,ds(se,G)){var he=h.interleaved;he===null?(I.next=I,Uv(h)):(I.next=he.next,he.next=I),h.interleaved=I;return}}catch{}finally{}b=lf(u,h,I,E),b!==null&&(I=xs(),Ca(b,u,E,I),qp(b,h,E))}}function mf(u){var h=u.alternate;return u===Xn||h!==null&&h===Xn}function Xp(u,h){fi=lo=!0;var b=u.pending;b===null?h.next=h:(h.next=b.next,b.next=h),u.pending=h}function qp(u,h,b){if((b&4194240)!==0){var E=h.lanes;E&=u.pendingLanes,b|=E,h.lanes=b,fu(u,b)}}var Kp={readContext:ps,useCallback:Zr,useContext:Zr,useEffect:Zr,useImperativeHandle:Zr,useInsertionEffect:Zr,useLayoutEffect:Zr,useMemo:Zr,useReducer:Zr,useRef:Zr,useState:Zr,useDebugValue:Zr,useDeferredValue:Zr,useTransition:Zr,useMutableSource:Zr,useSyncExternalStore:Zr,useId:Zr,unstable_isNewReconciler:!1},Fx={readContext:ps,useCallback:function(u,h){return Qr().memoizedState=[u,h===void 0?null:h],u},useContext:ps,useEffect:Ii,useImperativeHandle:function(u,h,b){return b=b!=null?b.concat([u]):null,Lo(4194308,4,Ux.bind(null,h,u),b)},useLayoutEffect:function(u,h){return Lo(4194308,4,u,h)},useInsertionEffect:function(u,h){return Lo(4,2,u,h)},useMemo:function(u,h){var b=Qr();return h=h===void 0?null:h,u=u(),b.memoizedState=[u,h],u},useReducer:function(u,h,b){var E=Qr();return h=b!==void 0?b(h):h,E.memoizedState=E.baseState=h,u={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:h},E.queue=u,u=u.dispatch=$p.bind(null,Xn,u),[E.memoizedState,u]},useRef:function(u){var h=Qr();return u={current:u},h.memoizedState=u},useState:Hv,useDebugValue:Gp,useDeferredValue:function(u){return Qr().memoizedState=u},useTransition:function(){var u=Hv(!1),h=u[0];return u=EM.bind(null,u[1]),Qr().memoizedState=u,[h,u]},useMutableSource:function(){},useSyncExternalStore:function(u,h,b){var E=Xn,I=Qr();if(qn){if(b===void 0)throw Error(n(407));b=b()}else{if(b=h(),hi===null)throw Error(n(349));(wa&30)!==0||Vp(E,h,b)}I.memoizedState=b;var U={value:b,getSnapshot:h};return I.queue=U,Ii(kx.bind(null,E,U,u),[u]),E.flags|=2048,co(9,hf.bind(null,E,U,b,h),void 0,null),b},useId:function(){var u=Qr(),h=hi.identifierPrefix;if(qn){var b=Fs,E=ct;b=(E&~(1<<32-mt(E)-1)).toString(32)+b,h=":"+h+"R"+b,b=cl++,0<b&&(h+="H"+b.toString(32)),h+=":"}else b=Ki++,h=":"+h+"r"+b.toString(32)+":";return u.memoizedState=h},unstable_isNewReconciler:!1},zx={readContext:ps,useCallback:jx,useContext:ps,useEffect:Vv,useImperativeHandle:Wv,useInsertionEffect:Gv,useLayoutEffect:Dx,useMemo:vs,useReducer:ff,useRef:Lx,useState:function(){return ff(Du)},useDebugValue:Gp,useDeferredValue:function(u){var h=gs();return Wp(h,cr.memoizedState,u)},useTransition:function(){var u=ff(Du)[0],h=gs().memoizedState;return[u,h]},useMutableSource:Fv,useSyncExternalStore:zv,useId:Ma,unstable_isNewReconciler:!1},Bx={readContext:ps,useCallback:jx,useContext:ps,useEffect:Vv,useImperativeHandle:Wv,useInsertionEffect:Gv,useLayoutEffect:Dx,useMemo:vs,useReducer:Sa,useRef:Lx,useState:function(){return Sa(Du)},useDebugValue:Gp,useDeferredValue:function(u){var h=gs();return cr===null?h.memoizedState=u:Wp(h,cr.memoizedState,u)},useTransition:function(){var u=Sa(Du)[0],h=gs().memoizedState;return[u,h]},useMutableSource:Fv,useSyncExternalStore:zv,useId:Ma,unstable_isNewReconciler:!1};function Bs(u,h){if(u&&u.defaultProps){h=q({},h),u=u.defaultProps;for(var b in u)h[b]===void 0&&(h[b]=u[b]);return h}return h}function gf(u,h,b,E){h=u.memoizedState,b=b(E,h),b=b==null?h:q({},h,b),u.memoizedState=b,u.lanes===0&&(u.updateQueue.baseState=b)}var Yp={isMounted:function(u){return(u=u._reactInternals)?To(u)===u:!1},enqueueSetState:function(u,h,b){u=u._reactInternals;var E=xs(),I=zu(u),U=zn(E,I);U.payload=h,b!=null&&(U.callback=b),h=Qn(u,U,I),h!==null&&(Ca(h,u,I,E),di(h,u,I))},enqueueReplaceState:function(u,h,b){u=u._reactInternals;var E=xs(),I=zu(u),U=zn(E,I);U.tag=1,U.payload=h,b!=null&&(U.callback=b),h=Qn(u,U,I),h!==null&&(Ca(h,u,I,E),di(h,u,I))},enqueueForceUpdate:function(u,h){u=u._reactInternals;var b=xs(),E=zu(u),I=zn(b,E);I.tag=2,h!=null&&(I.callback=h),h=Qn(u,I,E),h!==null&&(Ca(h,u,E,b),di(h,u,E))}};function Hx(u,h,b,E,I,U,G){return u=u.stateNode,typeof u.shouldComponentUpdate=="function"?u.shouldComponentUpdate(E,U,G):h.prototype&&h.prototype.isPureReactComponent?!Jl(b,E)||!Jl(I,U):!0}function p(u,h,b){var E=!1,I=ma,U=h.contextType;return typeof U=="object"&&U!==null?U=ps(U):(I=ui(h)?ga:Kr.current,E=h.contextTypes,U=(E=E!=null)?sc(u,I):ma),h=new h(b,U),u.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=Yp,u.stateNode=h,h._reactInternals=u,E&&(u=u.stateNode,u.__reactInternalMemoizedUnmaskedChildContext=I,u.__reactInternalMemoizedMaskedChildContext=U),h}function g(u,h,b,E){u=h.state,typeof h.componentWillReceiveProps=="function"&&h.componentWillReceiveProps(b,E),typeof h.UNSAFE_componentWillReceiveProps=="function"&&h.UNSAFE_componentWillReceiveProps(b,E),h.state!==u&&Yp.enqueueReplaceState(h,h.state,null)}function M(u,h,b,E){var I=u.stateNode;I.props=b,I.state=u.memoizedState,I.refs={},an(u);var U=h.contextType;typeof U=="object"&&U!==null?I.context=ps(U):(U=ui(h)?ga:Kr.current,I.context=sc(u,U)),I.state=u.memoizedState,U=h.getDerivedStateFromProps,typeof U=="function"&&(gf(u,h,U,b),I.state=u.memoizedState),typeof h.getDerivedStateFromProps=="function"||typeof I.getSnapshotBeforeUpdate=="function"||typeof I.UNSAFE_componentWillMount!="function"&&typeof I.componentWillMount!="function"||(h=I.state,typeof I.componentWillMount=="function"&&I.componentWillMount(),typeof I.UNSAFE_componentWillMount=="function"&&I.UNSAFE_componentWillMount(),h!==I.state&&Yp.enqueueReplaceState(I,I.state,null),lr(u,b,I,E),I.state=u.memoizedState),typeof I.componentDidMount=="function"&&(u.flags|=4194308)}function P(u,h){try{var b="",E=h;do b+=fe(E),E=E.return;while(E);var I=b}catch(U){I=`
|
||
Error generating stack: `+U.message+`
|
||
`+U.stack}return{value:u,source:h,stack:I,digest:null}}function L(u,h,b){return{value:u,source:null,stack:b??null,digest:h??null}}function z(u,h){try{console.error(h.value)}catch(b){setTimeout(function(){throw b})}}var ie=typeof WeakMap=="function"?WeakMap:Map;function ye(u,h,b){b=zn(-1,b),b.tag=3,b.payload={element:null};var E=h.value;return b.callback=function(){Kx||(Kx=!0,LM=E),z(u,h)},b}function ze(u,h,b){b=zn(-1,b),b.tag=3;var E=u.type.getDerivedStateFromError;if(typeof E=="function"){var I=h.value;b.payload=function(){return E(I)},b.callback=function(){z(u,h)}}var U=u.stateNode;return U!==null&&typeof U.componentDidCatch=="function"&&(b.callback=function(){z(u,h),typeof E!="function"&&(ju===null?ju=new Set([this]):ju.add(this));var G=h.stack;this.componentDidCatch(h.value,{componentStack:G!==null?G:""})}),b}function tt(u,h,b){var E=u.pingCache;if(E===null){E=u.pingCache=new ie;var I=new Set;E.set(h,I)}else I=E.get(h),I===void 0&&(I=new Set,E.set(h,I));I.has(b)||(I.add(b),u=oW.bind(null,u,h,b),h.then(u,u))}function St(u){do{var h;if((h=u.tag===13)&&(h=u.memoizedState,h=h!==null?h.dehydrated!==null:!0),h)return u;u=u.return}while(u!==null);return null}function rn(u,h,b,E,I){return(u.mode&1)===0?(u===h?u.flags|=65536:(u.flags|=128,b.flags|=131072,b.flags&=-52805,b.tag===1&&(b.alternate===null?b.tag=17:(h=zn(-1,1),h.tag=2,Qn(b,h,1))),b.lanes|=1),u):(u.flags|=65536,u.lanes=I,u)}var Bt=C.ReactCurrentOwner,ln=!1;function bt(u,h,b,E){h.child=u===null?sf(h,null,b,E):cc(h,u.child,b,E)}function Jr(u,h,b,E,I){b=b.render;var U=h.ref;return al(h,I),E=df(u,h,b,E,U,I),b=jv(),u!==null&&!ln?(h.updateQueue=u.updateQueue,h.flags&=-2053,u.lanes&=~I,xc(u,h,I)):(qn&&b&&Nv(h),h.flags|=1,bt(u,h,E,I),h.child)}function ys(u,h,b,E,I){if(u===null){var U=b.type;return typeof U=="function"&&!HM(U)&&U.defaultProps===void 0&&b.compare===null&&b.defaultProps===void 0?(h.tag=15,h.type=U,Ie(u,h,U,E,I)):(u=tb(b.type,null,E,h,h.mode,I),u.ref=h.ref,u.return=h,h.child=u)}if(U=u.child,(u.lanes&I)===0){var G=U.memoizedProps;if(b=b.compare,b=b!==null?b:Jl,b(G,E)&&u.ref===h.ref)return xc(u,h,I)}return h.flags|=1,u=Hu(U,E),u.ref=h.ref,u.return=h,h.child=u}function Ie(u,h,b,E,I){if(u!==null){var U=u.memoizedProps;if(Jl(U,E)&&u.ref===h.ref)if(ln=!1,h.pendingProps=E=U,(u.lanes&I)!==0)(u.flags&131072)!==0&&(ln=!0);else return h.lanes=u.lanes,xc(u,h,I)}return gt(u,h,b,E,I)}function be(u,h,b){var E=h.pendingProps,I=E.children,U=u!==null?u.memoizedState:null;if(E.mode==="hidden")if((h.mode&1)===0)h.memoizedState={baseLanes:0,cachePool:null,transitions:null},Gn(Qp,uo),uo|=b;else{if((b&1073741824)===0)return u=U!==null?U.baseLanes|b:b,h.lanes=h.childLanes=1073741824,h.memoizedState={baseLanes:u,cachePool:null,transitions:null},h.updateQueue=null,Gn(Qp,uo),uo|=u,null;h.memoizedState={baseLanes:0,cachePool:null,transitions:null},E=U!==null?U.baseLanes:b,Gn(Qp,uo),uo|=E}else U!==null?(E=U.baseLanes|b,h.memoizedState=null):E=b,Gn(Qp,uo),uo|=E;return bt(u,h,I,b),h.child}function je(u,h){var b=h.ref;(u===null&&b!==null||u!==null&&u.ref!==b)&&(h.flags|=512,h.flags|=2097152)}function gt(u,h,b,E,I){var U=ui(b)?ga:Kr.current;return U=sc(h,U),al(h,I),b=df(u,h,b,E,U,I),E=jv(),u!==null&&!ln?(h.updateQueue=u.updateQueue,h.flags&=-2053,u.lanes&=~I,xc(u,h,I)):(qn&&E&&Nv(h),h.flags|=1,bt(u,h,b,I),h.child)}function It(u,h,b,E,I){if(ui(b)){var U=!0;oc(h)}else U=!1;if(al(h,I),h.stateNode===null)Gx(u,h),p(h,b,E),M(h,b,E,I),E=!0;else if(u===null){var G=h.stateNode,se=h.memoizedProps;G.props=se;var he=G.context,De=b.contextType;typeof De=="object"&&De!==null?De=ps(De):(De=ui(b)?ga:Kr.current,De=sc(h,De));var Ze=b.getDerivedStateFromProps,Je=typeof Ze=="function"||typeof G.getSnapshotBeforeUpdate=="function";Je||typeof G.UNSAFE_componentWillReceiveProps!="function"&&typeof G.componentWillReceiveProps!="function"||(se!==E||he!==De)&&g(h,G,E,De),Fn=!1;var Ye=h.memoizedState;G.state=Ye,lr(h,E,G,I),he=h.memoizedState,se!==E||Ye!==he||Pi.current||Fn?(typeof Ze=="function"&&(gf(h,b,Ze,E),he=h.memoizedState),(se=Fn||Hx(h,b,se,E,Ye,he,De))?(Je||typeof G.UNSAFE_componentWillMount!="function"&&typeof G.componentWillMount!="function"||(typeof G.componentWillMount=="function"&&G.componentWillMount(),typeof G.UNSAFE_componentWillMount=="function"&&G.UNSAFE_componentWillMount()),typeof G.componentDidMount=="function"&&(h.flags|=4194308)):(typeof G.componentDidMount=="function"&&(h.flags|=4194308),h.memoizedProps=E,h.memoizedState=he),G.props=E,G.state=he,G.context=De,E=se):(typeof G.componentDidMount=="function"&&(h.flags|=4194308),E=!1)}else{G=h.stateNode,mr(u,h),se=h.memoizedProps,De=h.type===h.elementType?se:Bs(h.type,se),G.props=De,Je=h.pendingProps,Ye=G.context,he=b.contextType,typeof he=="object"&&he!==null?he=ps(he):(he=ui(b)?ga:Kr.current,he=sc(h,he));var _t=b.getDerivedStateFromProps;(Ze=typeof _t=="function"||typeof G.getSnapshotBeforeUpdate=="function")||typeof G.UNSAFE_componentWillReceiveProps!="function"&&typeof G.componentWillReceiveProps!="function"||(se!==Je||Ye!==he)&&g(h,G,E,he),Fn=!1,Ye=h.memoizedState,G.state=Ye,lr(h,E,G,I);var Tt=h.memoizedState;se!==Je||Ye!==Tt||Pi.current||Fn?(typeof _t=="function"&&(gf(h,b,_t,E),Tt=h.memoizedState),(De=Fn||Hx(h,b,De,E,Ye,Tt,he)||!1)?(Ze||typeof G.UNSAFE_componentWillUpdate!="function"&&typeof G.componentWillUpdate!="function"||(typeof G.componentWillUpdate=="function"&&G.componentWillUpdate(E,Tt,he),typeof G.UNSAFE_componentWillUpdate=="function"&&G.UNSAFE_componentWillUpdate(E,Tt,he)),typeof G.componentDidUpdate=="function"&&(h.flags|=4),typeof G.getSnapshotBeforeUpdate=="function"&&(h.flags|=1024)):(typeof G.componentDidUpdate!="function"||se===u.memoizedProps&&Ye===u.memoizedState||(h.flags|=4),typeof G.getSnapshotBeforeUpdate!="function"||se===u.memoizedProps&&Ye===u.memoizedState||(h.flags|=1024),h.memoizedProps=E,h.memoizedState=Tt),G.props=E,G.state=Tt,G.context=he,E=De):(typeof G.componentDidUpdate!="function"||se===u.memoizedProps&&Ye===u.memoizedState||(h.flags|=4),typeof G.getSnapshotBeforeUpdate!="function"||se===u.memoizedProps&&Ye===u.memoizedState||(h.flags|=1024),E=!1)}return on(u,h,b,E,U,I)}function on(u,h,b,E,I,U){je(u,h);var G=(h.flags&128)!==0;if(!E&&!G)return I&&Pv(h,b,!1),xc(u,h,U);E=h.stateNode,Bt.current=h;var se=G&&typeof b.getDerivedStateFromError!="function"?null:E.render();return h.flags|=1,u!==null&&G?(h.child=cc(h,u.child,null,U),h.child=cc(h,null,se,U)):bt(u,h,se,U),h.memoizedState=E.state,I&&Pv(h,b,!0),h.child}function sn(u){var h=u.stateNode;h.pendingContext?Cv(u,h.pendingContext,h.pendingContext!==h.context):h.context&&Cv(u,h.context,!1),cf(u,h.containerInfo)}function En(u,h,b,E,I){return ol(),Nu(I),h.flags|=256,bt(u,h,b,E),h.child}var br={dehydrated:null,treeContext:null,retryLane:0};function bn(u){return{baseLanes:u,cachePool:null,transitions:null}}function Ea(u,h,b){var E=h.pendingProps,I=Kn.current,U=!1,G=(h.flags&128)!==0,se;if((se=G)||(se=u!==null&&u.memoizedState===null?!1:(I&2)!==0),se?(U=!0,h.flags&=-129):(u===null||u.memoizedState!==null)&&(I|=1),Gn(Kn,I&1),u===null)return Bp(h),u=h.memoizedState,u!==null&&(u=u.dehydrated,u!==null)?((h.mode&1)===0?h.lanes=1:u.data==="$!"?h.lanes=8:h.lanes=1073741824,null):(G=E.children,u=E.fallback,U?(E=h.mode,U=h.child,G={mode:"hidden",children:G},(E&1)===0&&U!==null?(U.childLanes=0,U.pendingProps=G):U=nb(G,E,0,null),u=_f(u,E,b,null),U.return=h,u.return=h,U.sibling=u,h.child=U,h.child.memoizedState=bn(b),h.memoizedState=br,u):$v(h,G));if(I=u.memoizedState,I!==null&&(se=I.dehydrated,se!==null))return qG(u,h,G,E,se,I,b);if(U){U=E.fallback,G=h.mode,I=u.child,se=I.sibling;var he={mode:"hidden",children:E.children};return(G&1)===0&&h.child!==I?(E=h.child,E.childLanes=0,E.pendingProps=he,h.deletions=null):(E=Hu(I,he),E.subtreeFlags=I.subtreeFlags&14680064),se!==null?U=Hu(se,U):(U=_f(U,G,b,null),U.flags|=2),U.return=h,E.return=h,E.sibling=U,h.child=E,E=U,U=h.child,G=u.child.memoizedState,G=G===null?bn(b):{baseLanes:G.baseLanes|b,cachePool:null,transitions:G.transitions},U.memoizedState=G,U.childLanes=u.childLanes&~b,h.memoizedState=br,E}return U=u.child,u=U.sibling,E=Hu(U,{mode:"visible",children:E.children}),(h.mode&1)===0&&(E.lanes=b),E.return=h,E.sibling=null,u!==null&&(b=h.deletions,b===null?(h.deletions=[u],h.flags|=16):b.push(u)),h.child=E,h.memoizedState=null,E}function $v(u,h){return h=nb({mode:"visible",children:h},u.mode,0,null),h.return=u,u.child=h}function Vx(u,h,b,E){return E!==null&&Nu(E),cc(h,u.child,null,b),u=$v(h,h.pendingProps.children),u.flags|=2,h.memoizedState=null,u}function qG(u,h,b,E,I,U,G){if(b)return h.flags&256?(h.flags&=-257,E=L(Error(n(422))),Vx(u,h,G,E)):h.memoizedState!==null?(h.child=u.child,h.flags|=128,null):(U=E.fallback,I=h.mode,E=nb({mode:"visible",children:E.children},I,0,null),U=_f(U,I,G,null),U.flags|=2,E.return=h,U.return=h,E.sibling=U,h.child=E,(h.mode&1)!==0&&cc(h,u.child,null,G),h.child.memoizedState=bn(G),h.memoizedState=br,U);if((h.mode&1)===0)return Vx(u,h,G,null);if(I.data==="$!"){if(E=I.nextSibling&&I.nextSibling.dataset,E)var se=E.dgst;return E=se,U=Error(n(419)),E=L(U,E,void 0),Vx(u,h,G,E)}if(se=(G&u.childLanes)!==0,ln||se){if(E=hi,E!==null){switch(G&-G){case 4:I=2;break;case 16:I=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:I=32;break;case 536870912:I=268435456;break;default:I=0}I=(I&(E.suspendedLanes|G))!==0?0:I,I!==0&&I!==U.retryLane&&(U.retryLane=I,oo(u,I),Ca(E,u,I,-1))}return BM(),E=L(Error(n(421))),Vx(u,h,G,E)}return I.data==="$?"?(h.flags|=128,h.child=u.child,h=aW.bind(null,u),I._reactRetry=h,null):(u=U.treeContext,Ni=ha(I.nextSibling),Yr=h,qn=!0,zs=null,u!==null&&(Ri[zr++]=ct,Ri[zr++]=Fs,Ri[zr++]=lc,ct=u.id,Fs=u.overflow,lc=h),h=$v(h,E.children),h.flags|=4096,h)}function oN(u,h,b){u.lanes|=h;var E=u.alternate;E!==null&&(E.lanes|=h),af(u.return,h,b)}function AM(u,h,b,E,I){var U=u.memoizedState;U===null?u.memoizedState={isBackwards:h,rendering:null,renderingStartTime:0,last:E,tail:b,tailMode:I}:(U.isBackwards=h,U.rendering=null,U.renderingStartTime=0,U.last=E,U.tail=b,U.tailMode=I)}function aN(u,h,b){var E=h.pendingProps,I=E.revealOrder,U=E.tail;if(bt(u,h,E.children,b),E=Kn.current,(E&2)!==0)E=E&1|2,h.flags|=128;else{if(u!==null&&(u.flags&128)!==0)e:for(u=h.child;u!==null;){if(u.tag===13)u.memoizedState!==null&&oN(u,b,h);else if(u.tag===19)oN(u,b,h);else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===h)break e;for(;u.sibling===null;){if(u.return===null||u.return===h)break e;u=u.return}u.sibling.return=u.return,u=u.sibling}E&=1}if(Gn(Kn,E),(h.mode&1)===0)h.memoizedState=null;else switch(I){case"forwards":for(b=h.child,I=null;b!==null;)u=b.alternate,u!==null&&ao(u)===null&&(I=b),b=b.sibling;b=I,b===null?(I=h.child,h.child=null):(I=b.sibling,b.sibling=null),AM(h,!1,I,b,U);break;case"backwards":for(b=null,I=h.child,h.child=null;I!==null;){if(u=I.alternate,u!==null&&ao(u)===null){h.child=I;break}u=I.sibling,I.sibling=b,b=I,I=u}AM(h,!0,b,null,U);break;case"together":AM(h,!1,null,null,void 0);break;default:h.memoizedState=null}return h.child}function Gx(u,h){(h.mode&1)===0&&u!==null&&(u.alternate=null,h.alternate=null,h.flags|=2)}function xc(u,h,b){if(u!==null&&(h.dependencies=u.dependencies),vf|=h.lanes,(b&h.childLanes)===0)return null;if(u!==null&&h.child!==u.child)throw Error(n(153));if(h.child!==null){for(u=h.child,b=Hu(u,u.pendingProps),h.child=b,b.return=h;u.sibling!==null;)u=u.sibling,b=b.sibling=Hu(u,u.pendingProps),b.return=h;b.sibling=null}return h.child}function KG(u,h,b){switch(h.tag){case 3:sn(h),ol();break;case 5:mc(h);break;case 1:ui(h.type)&&oc(h);break;case 4:cf(h,h.stateNode.containerInfo);break;case 10:var E=h.type._context,I=h.memoizedProps.value;Gn(uc,E._currentValue),E._currentValue=I;break;case 13:if(E=h.memoizedState,E!==null)return E.dehydrated!==null?(Gn(Kn,Kn.current&1),h.flags|=128,null):(b&h.child.childLanes)!==0?Ea(u,h,b):(Gn(Kn,Kn.current&1),u=xc(u,h,b),u!==null?u.sibling:null);Gn(Kn,Kn.current&1);break;case 19:if(E=(b&h.childLanes)!==0,(u.flags&128)!==0){if(E)return aN(u,h,b);h.flags|=128}if(I=h.memoizedState,I!==null&&(I.rendering=null,I.tail=null,I.lastEffect=null),Gn(Kn,Kn.current),E)break;return null;case 22:case 23:return h.lanes=0,be(u,h,b)}return xc(u,h,b)}var lN,TM,cN,uN;lN=function(u,h){for(var b=h.child;b!==null;){if(b.tag===5||b.tag===6)u.appendChild(b.stateNode);else if(b.tag!==4&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===h)break;for(;b.sibling===null;){if(b.return===null||b.return===h)return;b=b.return}b.sibling.return=b.return,b=b.sibling}},TM=function(){},cN=function(u,h,b,E){var I=u.memoizedProps;if(I!==E){u=h.stateNode,xr(ms.current);var U=null;switch(b){case"input":I=Ge(u,I),E=Ge(u,E),U=[];break;case"select":I=q({},I,{value:void 0}),E=q({},E,{value:void 0}),U=[];break;case"textarea":I=Ee(u,I),E=Ee(u,E),U=[];break;default:typeof I.onClick!="function"&&typeof E.onClick=="function"&&(u.onclick=Zd)}J(b,E);var G;b=null;for(De in I)if(!E.hasOwnProperty(De)&&I.hasOwnProperty(De)&&I[De]!=null)if(De==="style"){var se=I[De];for(G in se)se.hasOwnProperty(G)&&(b||(b={}),b[G]="")}else De!=="dangerouslySetInnerHTML"&&De!=="children"&&De!=="suppressContentEditableWarning"&&De!=="suppressHydrationWarning"&&De!=="autoFocus"&&(i.hasOwnProperty(De)?U||(U=[]):(U=U||[]).push(De,null));for(De in E){var he=E[De];if(se=I!=null?I[De]:void 0,E.hasOwnProperty(De)&&he!==se&&(he!=null||se!=null))if(De==="style")if(se){for(G in se)!se.hasOwnProperty(G)||he&&he.hasOwnProperty(G)||(b||(b={}),b[G]="");for(G in he)he.hasOwnProperty(G)&&se[G]!==he[G]&&(b||(b={}),b[G]=he[G])}else b||(U||(U=[]),U.push(De,b)),b=he;else De==="dangerouslySetInnerHTML"?(he=he?he.__html:void 0,se=se?se.__html:void 0,he!=null&&se!==he&&(U=U||[]).push(De,he)):De==="children"?typeof he!="string"&&typeof he!="number"||(U=U||[]).push(De,""+he):De!=="suppressContentEditableWarning"&&De!=="suppressHydrationWarning"&&(i.hasOwnProperty(De)?(he!=null&&De==="onScroll"&&Wn("scroll",u),U||se===he||(U=[])):(U=U||[]).push(De,he))}b&&(U=U||[]).push("style",b);var De=U;(h.updateQueue=De)&&(h.flags|=4)}},uN=function(u,h,b,E){b!==E&&(h.flags|=4)};function Xv(u,h){if(!qn)switch(u.tailMode){case"hidden":h=u.tail;for(var b=null;h!==null;)h.alternate!==null&&(b=h),h=h.sibling;b===null?u.tail=null:b.sibling=null;break;case"collapsed":b=u.tail;for(var E=null;b!==null;)b.alternate!==null&&(E=b),b=b.sibling;E===null?h||u.tail===null?u.tail=null:u.tail.sibling=null:E.sibling=null}}function Yi(u){var h=u.alternate!==null&&u.alternate.child===u.child,b=0,E=0;if(h)for(var I=u.child;I!==null;)b|=I.lanes|I.childLanes,E|=I.subtreeFlags&14680064,E|=I.flags&14680064,I.return=u,I=I.sibling;else for(I=u.child;I!==null;)b|=I.lanes|I.childLanes,E|=I.subtreeFlags,E|=I.flags,I.return=u,I=I.sibling;return u.subtreeFlags|=E,u.childLanes=b,h}function YG(u,h,b){var E=h.pendingProps;switch(ya(h),h.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Yi(h),null;case 1:return ui(h.type)&&Qd(),Yi(h),null;case 3:return E=h.stateNode,ll(),$n(Pi),$n(Kr),Oo(),E.pendingContext&&(E.context=E.pendingContext,E.pendingContext=null),(u===null||u.child===null)&&(Ru(h)?h.flags|=4:u===null||u.memoizedState.isDehydrated&&(h.flags&256)===0||(h.flags|=1024,zs!==null&&(jM(zs),zs=null))),TM(u,h),Yi(h),null;case 5:Ou(h);var I=xr(_a.current);if(b=h.type,u!==null&&h.stateNode!=null)cN(u,h,b,E,I),u.ref!==h.ref&&(h.flags|=512,h.flags|=2097152);else{if(!E){if(h.stateNode===null)throw Error(n(166));return Yi(h),null}if(u=xr(ms.current),Ru(h)){E=h.stateNode,b=h.type;var U=h.memoizedProps;switch(E[Nr]=h,E[Pu]=U,u=(h.mode&1)!==0,b){case"dialog":Wn("cancel",E),Wn("close",E);break;case"iframe":case"object":case"embed":Wn("load",E);break;case"video":case"audio":for(I=0;I<il.length;I++)Wn(il[I],E);break;case"source":Wn("error",E);break;case"img":case"image":case"link":Wn("error",E),Wn("load",E);break;case"details":Wn("toggle",E);break;case"input":Ue(E,U),Wn("invalid",E);break;case"select":E._wrapperState={wasMultiple:!!U.multiple},Wn("invalid",E);break;case"textarea":Be(E,U),Wn("invalid",E)}J(b,U),I=null;for(var G in U)if(U.hasOwnProperty(G)){var se=U[G];G==="children"?typeof se=="string"?E.textContent!==se&&(U.suppressHydrationWarning!==!0&&Yd(E.textContent,se,u),I=["children",se]):typeof se=="number"&&E.textContent!==""+se&&(U.suppressHydrationWarning!==!0&&Yd(E.textContent,se,u),I=["children",""+se]):i.hasOwnProperty(G)&&se!=null&&G==="onScroll"&&Wn("scroll",E)}switch(b){case"input":Xe(E),xt(E,U,!0);break;case"textarea":Xe(E),Ce(E);break;case"select":case"option":break;default:typeof U.onClick=="function"&&(E.onclick=Zd)}E=I,h.updateQueue=E,E!==null&&(h.flags|=4)}else{G=I.nodeType===9?I:I.ownerDocument,u==="http://www.w3.org/1999/xhtml"&&(u=lt(b)),u==="http://www.w3.org/1999/xhtml"?b==="script"?(u=G.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild)):typeof E.is=="string"?u=G.createElement(b,{is:E.is}):(u=G.createElement(b),b==="select"&&(G=u,E.multiple?G.multiple=!0:E.size&&(G.size=E.size))):u=G.createElementNS(u,b),u[Nr]=h,u[Pu]=E,lN(u,h,!1,!1),h.stateNode=u;e:{switch(G=Ae(b,E),b){case"dialog":Wn("cancel",u),Wn("close",u),I=E;break;case"iframe":case"object":case"embed":Wn("load",u),I=E;break;case"video":case"audio":for(I=0;I<il.length;I++)Wn(il[I],u);I=E;break;case"source":Wn("error",u),I=E;break;case"img":case"image":case"link":Wn("error",u),Wn("load",u),I=E;break;case"details":Wn("toggle",u),I=E;break;case"input":Ue(u,E),I=Ge(u,E),Wn("invalid",u);break;case"option":I=E;break;case"select":u._wrapperState={wasMultiple:!!E.multiple},I=q({},E,{value:void 0}),Wn("invalid",u);break;case"textarea":Be(u,E),I=Ee(u,E),Wn("invalid",u);break;default:I=E}J(b,I),se=I;for(U in se)if(se.hasOwnProperty(U)){var he=se[U];U==="style"?pt(u,he):U==="dangerouslySetInnerHTML"?(he=he?he.__html:void 0,he!=null&&nn(u,he)):U==="children"?typeof he=="string"?(b!=="textarea"||he!=="")&&qe(u,he):typeof he=="number"&&qe(u,""+he):U!=="suppressContentEditableWarning"&&U!=="suppressHydrationWarning"&&U!=="autoFocus"&&(i.hasOwnProperty(U)?he!=null&&U==="onScroll"&&Wn("scroll",u):he!=null&&T(u,U,he,G))}switch(b){case"input":Xe(u),xt(u,E,!1);break;case"textarea":Xe(u),Ce(u);break;case"option":E.value!=null&&u.setAttribute("value",""+$e(E.value));break;case"select":u.multiple=!!E.multiple,U=E.value,U!=null?W(u,!!E.multiple,U,!1):E.defaultValue!=null&&W(u,!!E.multiple,E.defaultValue,!0);break;default:typeof I.onClick=="function"&&(u.onclick=Zd)}switch(b){case"button":case"input":case"select":case"textarea":E=!!E.autoFocus;break e;case"img":E=!0;break e;default:E=!1}}E&&(h.flags|=4)}h.ref!==null&&(h.flags|=512,h.flags|=2097152)}return Yi(h),null;case 6:if(u&&h.stateNode!=null)uN(u,h,u.memoizedProps,E);else{if(typeof E!="string"&&h.stateNode===null)throw Error(n(166));if(b=xr(_a.current),xr(ms.current),Ru(h)){if(E=h.stateNode,b=h.memoizedProps,E[Nr]=h,(U=E.nodeValue!==b)&&(u=Yr,u!==null))switch(u.tag){case 3:Yd(E.nodeValue,b,(u.mode&1)!==0);break;case 5:u.memoizedProps.suppressHydrationWarning!==!0&&Yd(E.nodeValue,b,(u.mode&1)!==0)}U&&(h.flags|=4)}else E=(b.nodeType===9?b:b.ownerDocument).createTextNode(E),E[Nr]=h,h.stateNode=E}return Yi(h),null;case 13:if($n(Kn),E=h.memoizedState,u===null||u.memoizedState!==null&&u.memoizedState.dehydrated!==null){if(qn&&Ni!==null&&(h.mode&1)!==0&&(h.flags&128)===0)Ov(),ol(),h.flags|=98560,U=!1;else if(U=Ru(h),E!==null&&E.dehydrated!==null){if(u===null){if(!U)throw Error(n(318));if(U=h.memoizedState,U=U!==null?U.dehydrated:null,!U)throw Error(n(317));U[Nr]=h}else ol(),(h.flags&128)===0&&(h.memoizedState=null),h.flags|=4;Yi(h),U=!1}else zs!==null&&(jM(zs),zs=null),U=!0;if(!U)return h.flags&65536?h:null}return(h.flags&128)!==0?(h.lanes=b,h):(E=E!==null,E!==(u!==null&&u.memoizedState!==null)&&E&&(h.child.flags|=8192,(h.mode&1)!==0&&(u===null||(Kn.current&1)!==0?ei===0&&(ei=3):BM())),h.updateQueue!==null&&(h.flags|=4),Yi(h),null);case 4:return ll(),TM(u,h),u===null&&Au(h.stateNode.containerInfo),Yi(h),null;case 10:return of(h.type._context),Yi(h),null;case 17:return ui(h.type)&&Qd(),Yi(h),null;case 19:if($n(Kn),U=h.memoizedState,U===null)return Yi(h),null;if(E=(h.flags&128)!==0,G=U.rendering,G===null)if(E)Xv(U,!1);else{if(ei!==0||u!==null&&(u.flags&128)!==0)for(u=h.child;u!==null;){if(G=ao(u),G!==null){for(h.flags|=128,Xv(U,!1),E=G.updateQueue,E!==null&&(h.updateQueue=E,h.flags|=4),h.subtreeFlags=0,E=b,b=h.child;b!==null;)U=b,u=E,U.flags&=14680066,G=U.alternate,G===null?(U.childLanes=0,U.lanes=u,U.child=null,U.subtreeFlags=0,U.memoizedProps=null,U.memoizedState=null,U.updateQueue=null,U.dependencies=null,U.stateNode=null):(U.childLanes=G.childLanes,U.lanes=G.lanes,U.child=G.child,U.subtreeFlags=0,U.deletions=null,U.memoizedProps=G.memoizedProps,U.memoizedState=G.memoizedState,U.updateQueue=G.updateQueue,U.type=G.type,u=G.dependencies,U.dependencies=u===null?null:{lanes:u.lanes,firstContext:u.firstContext}),b=b.sibling;return Gn(Kn,Kn.current&1|2),h.child}u=u.sibling}U.tail!==null&&st()>Jp&&(h.flags|=128,E=!0,Xv(U,!1),h.lanes=4194304)}else{if(!E)if(u=ao(G),u!==null){if(h.flags|=128,E=!0,b=u.updateQueue,b!==null&&(h.updateQueue=b,h.flags|=4),Xv(U,!0),U.tail===null&&U.tailMode==="hidden"&&!G.alternate&&!qn)return Yi(h),null}else 2*st()-U.renderingStartTime>Jp&&b!==1073741824&&(h.flags|=128,E=!0,Xv(U,!1),h.lanes=4194304);U.isBackwards?(G.sibling=h.child,h.child=G):(b=U.last,b!==null?b.sibling=G:h.child=G,U.last=G)}return U.tail!==null?(h=U.tail,U.rendering=h,U.tail=h.sibling,U.renderingStartTime=st(),h.sibling=null,b=Kn.current,Gn(Kn,E?b&1|2:b&1),h):(Yi(h),null);case 22:case 23:return zM(),E=h.memoizedState!==null,u!==null&&u.memoizedState!==null!==E&&(h.flags|=8192),E&&(h.mode&1)!==0?(uo&1073741824)!==0&&(Yi(h),h.subtreeFlags&6&&(h.flags|=8192)):Yi(h),null;case 24:return null;case 25:return null}throw Error(n(156,h.tag))}function ZG(u,h){switch(ya(h),h.tag){case 1:return ui(h.type)&&Qd(),u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 3:return ll(),$n(Pi),$n(Kr),Oo(),u=h.flags,(u&65536)!==0&&(u&128)===0?(h.flags=u&-65537|128,h):null;case 5:return Ou(h),null;case 13:if($n(Kn),u=h.memoizedState,u!==null&&u.dehydrated!==null){if(h.alternate===null)throw Error(n(340));ol()}return u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 19:return $n(Kn),null;case 4:return ll(),null;case 10:return of(h.type._context),null;case 22:case 23:return zM(),null;case 24:return null;default:return null}}var Wx=!1,Zi=!1,QG=typeof WeakSet=="function"?WeakSet:Set,Et=null;function Zp(u,h){var b=u.ref;if(b!==null)if(typeof b=="function")try{b(null)}catch(E){_r(u,h,E)}else b.current=null}function CM(u,h,b){try{b()}catch(E){_r(u,h,E)}}var dN=!1;function JG(u,h){if(Cu=ks,u=nr(),Dr(u)){if("selectionStart"in u)var b={start:u.selectionStart,end:u.selectionEnd};else e:{b=(b=u.ownerDocument)&&b.defaultView||window;var E=b.getSelection&&b.getSelection();if(E&&E.rangeCount!==0){b=E.anchorNode;var I=E.anchorOffset,U=E.focusNode;E=E.focusOffset;try{b.nodeType,U.nodeType}catch{b=null;break e}var G=0,se=-1,he=-1,De=0,Ze=0,Je=u,Ye=null;t:for(;;){for(var _t;Je!==b||I!==0&&Je.nodeType!==3||(se=G+I),Je!==U||E!==0&&Je.nodeType!==3||(he=G+E),Je.nodeType===3&&(G+=Je.nodeValue.length),(_t=Je.firstChild)!==null;)Ye=Je,Je=_t;for(;;){if(Je===u)break t;if(Ye===b&&++De===I&&(se=G),Ye===U&&++Ze===E&&(he=G),(_t=Je.nextSibling)!==null)break;Je=Ye,Ye=Je.parentNode}Je=_t}b=se===-1||he===-1?null:{start:se,end:he}}else b=null}b=b||{start:0,end:0}}else b=null;for(wv={focusedElem:u,selectionRange:b},ks=!1,Et=h;Et!==null;)if(h=Et,u=h.child,(h.subtreeFlags&1028)!==0&&u!==null)u.return=h,Et=u;else for(;Et!==null;){h=Et;try{var Tt=h.alternate;if((h.flags&1024)!==0)switch(h.tag){case 0:case 11:case 15:break;case 1:if(Tt!==null){var Rt=Tt.memoizedProps,Ir=Tt.memoizedState,Pe=h.stateNode,ve=Pe.getSnapshotBeforeUpdate(h.elementType===h.type?Rt:Bs(h.type,Rt),Ir);Pe.__reactInternalSnapshotBeforeUpdate=ve}break;case 3:var Ne=h.stateNode.containerInfo;Ne.nodeType===1?Ne.textContent="":Ne.nodeType===9&&Ne.documentElement&&Ne.removeChild(Ne.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(it){_r(h,h.return,it)}if(u=h.sibling,u!==null){u.return=h.return,Et=u;break}Et=h.return}return Tt=dN,dN=!1,Tt}function qv(u,h,b){var E=h.updateQueue;if(E=E!==null?E.lastEffect:null,E!==null){var I=E=E.next;do{if((I.tag&u)===u){var U=I.destroy;I.destroy=void 0,U!==void 0&&CM(h,b,U)}I=I.next}while(I!==E)}}function $x(u,h){if(h=h.updateQueue,h=h!==null?h.lastEffect:null,h!==null){var b=h=h.next;do{if((b.tag&u)===u){var E=b.create;b.destroy=E()}b=b.next}while(b!==h)}}function PM(u){var h=u.ref;if(h!==null){var b=u.stateNode;switch(u.tag){case 5:u=b;break;default:u=b}typeof h=="function"?h(u):h.current=u}}function fN(u){var h=u.alternate;h!==null&&(u.alternate=null,fN(h)),u.child=null,u.deletions=null,u.sibling=null,u.tag===5&&(h=u.stateNode,h!==null&&(delete h[Nr],delete h[Pu],delete h[ic],delete h[Op],delete h[Lp])),u.stateNode=null,u.return=null,u.dependencies=null,u.memoizedProps=null,u.memoizedState=null,u.pendingProps=null,u.stateNode=null,u.updateQueue=null}function hN(u){return u.tag===5||u.tag===3||u.tag===4}function pN(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||hN(u.return))return null;u=u.return}for(u.sibling.return=u.return,u=u.sibling;u.tag!==5&&u.tag!==6&&u.tag!==18;){if(u.flags&2||u.child===null||u.tag===4)continue e;u.child.return=u,u=u.child}if(!(u.flags&2))return u.stateNode}}function RM(u,h,b){var E=u.tag;if(E===5||E===6)u=u.stateNode,h?b.nodeType===8?b.parentNode.insertBefore(u,h):b.insertBefore(u,h):(b.nodeType===8?(h=b.parentNode,h.insertBefore(u,b)):(h=b,h.appendChild(u)),b=b._reactRootContainer,b!=null||h.onclick!==null||(h.onclick=Zd));else if(E!==4&&(u=u.child,u!==null))for(RM(u,h,b),u=u.sibling;u!==null;)RM(u,h,b),u=u.sibling}function NM(u,h,b){var E=u.tag;if(E===5||E===6)u=u.stateNode,h?b.insertBefore(u,h):b.appendChild(u);else if(E!==4&&(u=u.child,u!==null))for(NM(u,h,b),u=u.sibling;u!==null;)NM(u,h,b),u=u.sibling}var ki=null,Aa=!1;function Uu(u,h,b){for(b=b.child;b!==null;)mN(u,h,b),b=b.sibling}function mN(u,h,b){if(Yt&&typeof Yt.onCommitFiberUnmount=="function")try{Yt.onCommitFiberUnmount(yn,b)}catch{}switch(b.tag){case 5:Zi||Zp(b,h);case 6:var E=ki,I=Aa;ki=null,Uu(u,h,b),ki=E,Aa=I,ki!==null&&(Aa?(u=ki,b=b.stateNode,u.nodeType===8?u.parentNode.removeChild(b):u.removeChild(b)):ki.removeChild(b.stateNode));break;case 18:ki!==null&&(Aa?(u=ki,b=b.stateNode,u.nodeType===8?kp(u.parentNode,b):u.nodeType===1&&kp(u,b),Fd(u)):kp(ki,b.stateNode));break;case 4:E=ki,I=Aa,ki=b.stateNode.containerInfo,Aa=!0,Uu(u,h,b),ki=E,Aa=I;break;case 0:case 11:case 14:case 15:if(!Zi&&(E=b.updateQueue,E!==null&&(E=E.lastEffect,E!==null))){I=E=E.next;do{var U=I,G=U.destroy;U=U.tag,G!==void 0&&((U&2)!==0||(U&4)!==0)&&CM(b,h,G),I=I.next}while(I!==E)}Uu(u,h,b);break;case 1:if(!Zi&&(Zp(b,h),E=b.stateNode,typeof E.componentWillUnmount=="function"))try{E.props=b.memoizedProps,E.state=b.memoizedState,E.componentWillUnmount()}catch(se){_r(b,h,se)}Uu(u,h,b);break;case 21:Uu(u,h,b);break;case 22:b.mode&1?(Zi=(E=Zi)||b.memoizedState!==null,Uu(u,h,b),Zi=E):Uu(u,h,b);break;default:Uu(u,h,b)}}function gN(u){var h=u.updateQueue;if(h!==null){u.updateQueue=null;var b=u.stateNode;b===null&&(b=u.stateNode=new QG),h.forEach(function(E){var I=lW.bind(null,u,E);b.has(E)||(b.add(E),E.then(I,I))})}}function Ta(u,h){var b=h.deletions;if(b!==null)for(var E=0;E<b.length;E++){var I=b[E];try{var U=u,G=h,se=G;e:for(;se!==null;){switch(se.tag){case 5:ki=se.stateNode,Aa=!1;break e;case 3:ki=se.stateNode.containerInfo,Aa=!0;break e;case 4:ki=se.stateNode.containerInfo,Aa=!0;break e}se=se.return}if(ki===null)throw Error(n(160));mN(U,G,I),ki=null,Aa=!1;var he=I.alternate;he!==null&&(he.return=null),I.return=null}catch(De){_r(I,h,De)}}if(h.subtreeFlags&12854)for(h=h.child;h!==null;)vN(h,u),h=h.sibling}function vN(u,h){var b=u.alternate,E=u.flags;switch(u.tag){case 0:case 11:case 14:case 15:if(Ta(h,u),ul(u),E&4){try{qv(3,u,u.return),$x(3,u)}catch(Rt){_r(u,u.return,Rt)}try{qv(5,u,u.return)}catch(Rt){_r(u,u.return,Rt)}}break;case 1:Ta(h,u),ul(u),E&512&&b!==null&&Zp(b,b.return);break;case 5:if(Ta(h,u),ul(u),E&512&&b!==null&&Zp(b,b.return),u.flags&32){var I=u.stateNode;try{qe(I,"")}catch(Rt){_r(u,u.return,Rt)}}if(E&4&&(I=u.stateNode,I!=null)){var U=u.memoizedProps,G=b!==null?b.memoizedProps:U,se=u.type,he=u.updateQueue;if(u.updateQueue=null,he!==null)try{se==="input"&&U.type==="radio"&&U.name!=null&&We(I,U),Ae(se,G);var De=Ae(se,U);for(G=0;G<he.length;G+=2){var Ze=he[G],Je=he[G+1];Ze==="style"?pt(I,Je):Ze==="dangerouslySetInnerHTML"?nn(I,Je):Ze==="children"?qe(I,Je):T(I,Ze,Je,De)}switch(se){case"input":Qe(I,U);break;case"textarea":le(I,U);break;case"select":var Ye=I._wrapperState.wasMultiple;I._wrapperState.wasMultiple=!!U.multiple;var _t=U.value;_t!=null?W(I,!!U.multiple,_t,!1):Ye!==!!U.multiple&&(U.defaultValue!=null?W(I,!!U.multiple,U.defaultValue,!0):W(I,!!U.multiple,U.multiple?[]:"",!1))}I[Pu]=U}catch(Rt){_r(u,u.return,Rt)}}break;case 6:if(Ta(h,u),ul(u),E&4){if(u.stateNode===null)throw Error(n(162));I=u.stateNode,U=u.memoizedProps;try{I.nodeValue=U}catch(Rt){_r(u,u.return,Rt)}}break;case 3:if(Ta(h,u),ul(u),E&4&&b!==null&&b.memoizedState.isDehydrated)try{Fd(h.containerInfo)}catch(Rt){_r(u,u.return,Rt)}break;case 4:Ta(h,u),ul(u);break;case 13:Ta(h,u),ul(u),I=u.child,I.flags&8192&&(U=I.memoizedState!==null,I.stateNode.isHidden=U,!U||I.alternate!==null&&I.alternate.memoizedState!==null||(OM=st())),E&4&&gN(u);break;case 22:if(Ze=b!==null&&b.memoizedState!==null,u.mode&1?(Zi=(De=Zi)||Ze,Ta(h,u),Zi=De):Ta(h,u),ul(u),E&8192){if(De=u.memoizedState!==null,(u.stateNode.isHidden=De)&&!Ze&&(u.mode&1)!==0)for(Et=u,Ze=u.child;Ze!==null;){for(Je=Et=Ze;Et!==null;){switch(Ye=Et,_t=Ye.child,Ye.tag){case 0:case 11:case 14:case 15:qv(4,Ye,Ye.return);break;case 1:Zp(Ye,Ye.return);var Tt=Ye.stateNode;if(typeof Tt.componentWillUnmount=="function"){E=Ye,b=Ye.return;try{h=E,Tt.props=h.memoizedProps,Tt.state=h.memoizedState,Tt.componentWillUnmount()}catch(Rt){_r(E,b,Rt)}}break;case 5:Zp(Ye,Ye.return);break;case 22:if(Ye.memoizedState!==null){bN(Je);continue}}_t!==null?(_t.return=Ye,Et=_t):bN(Je)}Ze=Ze.sibling}e:for(Ze=null,Je=u;;){if(Je.tag===5){if(Ze===null){Ze=Je;try{I=Je.stateNode,De?(U=I.style,typeof U.setProperty=="function"?U.setProperty("display","none","important"):U.display="none"):(se=Je.stateNode,he=Je.memoizedProps.style,G=he!=null&&he.hasOwnProperty("display")?he.display:null,se.style.display=Ut("display",G))}catch(Rt){_r(u,u.return,Rt)}}}else if(Je.tag===6){if(Ze===null)try{Je.stateNode.nodeValue=De?"":Je.memoizedProps}catch(Rt){_r(u,u.return,Rt)}}else if((Je.tag!==22&&Je.tag!==23||Je.memoizedState===null||Je===u)&&Je.child!==null){Je.child.return=Je,Je=Je.child;continue}if(Je===u)break e;for(;Je.sibling===null;){if(Je.return===null||Je.return===u)break e;Ze===Je&&(Ze=null),Je=Je.return}Ze===Je&&(Ze=null),Je.sibling.return=Je.return,Je=Je.sibling}}break;case 19:Ta(h,u),ul(u),E&4&&gN(u);break;case 21:break;default:Ta(h,u),ul(u)}}function ul(u){var h=u.flags;if(h&2){try{e:{for(var b=u.return;b!==null;){if(hN(b)){var E=b;break e}b=b.return}throw Error(n(160))}switch(E.tag){case 5:var I=E.stateNode;E.flags&32&&(qe(I,""),E.flags&=-33);var U=pN(u);NM(u,U,I);break;case 3:case 4:var G=E.stateNode.containerInfo,se=pN(u);RM(u,se,G);break;default:throw Error(n(161))}}catch(he){_r(u,u.return,he)}u.flags&=-3}h&4096&&(u.flags&=-4097)}function eW(u,h,b){Et=u,yN(u)}function yN(u,h,b){for(var E=(u.mode&1)!==0;Et!==null;){var I=Et,U=I.child;if(I.tag===22&&E){var G=I.memoizedState!==null||Wx;if(!G){var se=I.alternate,he=se!==null&&se.memoizedState!==null||Zi;se=Wx;var De=Zi;if(Wx=G,(Zi=he)&&!De)for(Et=I;Et!==null;)G=Et,he=G.child,G.tag===22&&G.memoizedState!==null?_N(I):he!==null?(he.return=G,Et=he):_N(I);for(;U!==null;)Et=U,yN(U),U=U.sibling;Et=I,Wx=se,Zi=De}xN(u)}else(I.subtreeFlags&8772)!==0&&U!==null?(U.return=I,Et=U):xN(u)}}function xN(u){for(;Et!==null;){var h=Et;if((h.flags&8772)!==0){var b=h.alternate;try{if((h.flags&8772)!==0)switch(h.tag){case 0:case 11:case 15:Zi||$x(5,h);break;case 1:var E=h.stateNode;if(h.flags&4&&!Zi)if(b===null)E.componentDidMount();else{var I=h.elementType===h.type?b.memoizedProps:Bs(h.type,b.memoizedProps);E.componentDidUpdate(I,b.memoizedState,E.__reactInternalSnapshotBeforeUpdate)}var U=h.updateQueue;U!==null&&ku(h,U,E);break;case 3:var G=h.updateQueue;if(G!==null){if(b=null,h.child!==null)switch(h.child.tag){case 5:b=h.child.stateNode;break;case 1:b=h.child.stateNode}ku(h,G,b)}break;case 5:var se=h.stateNode;if(b===null&&h.flags&4){b=se;var he=h.memoizedProps;switch(h.type){case"button":case"input":case"select":case"textarea":he.autoFocus&&b.focus();break;case"img":he.src&&(b.src=he.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(h.memoizedState===null){var De=h.alternate;if(De!==null){var Ze=De.memoizedState;if(Ze!==null){var Je=Ze.dehydrated;Je!==null&&Fd(Je)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Zi||h.flags&512&&PM(h)}catch(Ye){_r(h,h.return,Ye)}}if(h===u){Et=null;break}if(b=h.sibling,b!==null){b.return=h.return,Et=b;break}Et=h.return}}function bN(u){for(;Et!==null;){var h=Et;if(h===u){Et=null;break}var b=h.sibling;if(b!==null){b.return=h.return,Et=b;break}Et=h.return}}function _N(u){for(;Et!==null;){var h=Et;try{switch(h.tag){case 0:case 11:case 15:var b=h.return;try{$x(4,h)}catch(he){_r(h,b,he)}break;case 1:var E=h.stateNode;if(typeof E.componentDidMount=="function"){var I=h.return;try{E.componentDidMount()}catch(he){_r(h,I,he)}}var U=h.return;try{PM(h)}catch(he){_r(h,U,he)}break;case 5:var G=h.return;try{PM(h)}catch(he){_r(h,G,he)}}}catch(he){_r(h,h.return,he)}if(h===u){Et=null;break}var se=h.sibling;if(se!==null){se.return=h.return,Et=se;break}Et=h.return}}var tW=Math.ceil,Xx=C.ReactCurrentDispatcher,IM=C.ReactCurrentOwner,Do=C.ReactCurrentBatchConfig,On=0,hi=null,Br=null,Oi=0,uo=0,Qp=ar(0),ei=0,Kv=null,vf=0,qx=0,kM=0,Yv=null,Hs=null,OM=0,Jp=1/0,bc=null,Kx=!1,LM=null,ju=null,Yx=!1,Fu=null,Zx=0,Zv=0,DM=null,Qx=-1,Jx=0;function xs(){return(On&6)!==0?st():Qx!==-1?Qx:Qx=st()}function zu(u){return(u.mode&1)===0?1:(On&2)!==0&&Oi!==0?Oi&-Oi:MM.transition!==null?(Jx===0&&(Jx=ci()),Jx):(u=Pn,u!==0||(u=window.event,u=u===void 0?16:yx(u.type)),u)}function Ca(u,h,b,E){if(50<Zv)throw Zv=0,DM=null,Error(n(185));Za(u,b,E),((On&2)===0||u!==hi)&&(u===hi&&((On&2)===0&&(qx|=b),ei===4&&Bu(u,Oi)),Vs(u,E),b===1&&On===0&&(h.mode&1)===0&&(Jp=st()+500,ef&&Io()))}function Vs(u,h){var b=u.callbackNode;Ya(u,h);var E=Vn(u,u===hi?Oi:0);if(E===0)b!==null&&we(b),u.callbackNode=null,u.callbackPriority=0;else if(h=E&-E,u.callbackPriority!==h){if(b!=null&&we(b),h===1)u.tag===0?Ix(SN.bind(null,u)):tf(SN.bind(null,u)),SM(function(){(On&6)===0&&Io()}),b=null;else{switch(hu(E)){case 1:b=Ft;break;case 4:b=Ht;break;case 16:b=Pt;break;case 536870912:b=Mn;break;default:b=Pt}b=NN(b,wN.bind(null,u))}u.callbackPriority=h,u.callbackNode=b}}function wN(u,h){if(Qx=-1,Jx=0,(On&6)!==0)throw Error(n(327));var b=u.callbackNode;if(em()&&u.callbackNode!==b)return null;var E=Vn(u,u===hi?Oi:0);if(E===0)return null;if((E&30)!==0||(E&u.expiredLanes)!==0||h)h=eb(u,E);else{h=E;var I=On;On|=2;var U=EN();(hi!==u||Oi!==h)&&(bc=null,Jp=st()+500,xf(u,h));do try{iW();break}catch(se){MN(u,se)}while(!0);fc(),Xx.current=U,On=I,Br!==null?h=0:(hi=null,Oi=0,h=ei)}if(h!==0){if(h===2&&(I=Xr(u),I!==0&&(E=I,h=UM(u,I))),h===1)throw b=Kv,xf(u,0),Bu(u,E),Vs(u,st()),b;if(h===6)Bu(u,E);else{if(I=u.current.alternate,(E&30)===0&&!nW(I)&&(h=eb(u,E),h===2&&(U=Xr(u),U!==0&&(E=U,h=UM(u,U))),h===1))throw b=Kv,xf(u,0),Bu(u,E),Vs(u,st()),b;switch(u.finishedWork=I,u.finishedLanes=E,h){case 0:case 1:throw Error(n(345));case 2:bf(u,Hs,bc);break;case 3:if(Bu(u,E),(E&130023424)===E&&(h=OM+500-st(),10<h)){if(Vn(u,0)!==0)break;if(I=u.suspendedLanes,(I&E)!==E){xs(),u.pingedLanes|=u.suspendedLanes&I;break}u.timeoutHandle=Mv(bf.bind(null,u,Hs,bc),h);break}bf(u,Hs,bc);break;case 4:if(Bu(u,E),(E&4194240)===E)break;for(h=u.eventTimes,I=-1;0<E;){var G=31-mt(E);U=1<<G,G=h[G],G>I&&(I=G),E&=~U}if(E=I,E=st()-E,E=(120>E?120:480>E?480:1080>E?1080:1920>E?1920:3e3>E?3e3:4320>E?4320:1960*tW(E/1960))-E,10<E){u.timeoutHandle=Mv(bf.bind(null,u,Hs,bc),E);break}bf(u,Hs,bc);break;case 5:bf(u,Hs,bc);break;default:throw Error(n(329))}}}return Vs(u,st()),u.callbackNode===b?wN.bind(null,u):null}function UM(u,h){var b=Yv;return u.current.memoizedState.isDehydrated&&(xf(u,h).flags|=256),u=eb(u,h),u!==2&&(h=Hs,Hs=b,h!==null&&jM(h)),u}function jM(u){Hs===null?Hs=u:Hs.push.apply(Hs,u)}function nW(u){for(var h=u;;){if(h.flags&16384){var b=h.updateQueue;if(b!==null&&(b=b.stores,b!==null))for(var E=0;E<b.length;E++){var I=b[E],U=I.getSnapshot;I=I.value;try{if(!ds(U(),I))return!1}catch{return!1}}}if(b=h.child,h.subtreeFlags&16384&&b!==null)b.return=h,h=b;else{if(h===u)break;for(;h.sibling===null;){if(h.return===null||h.return===u)return!0;h=h.return}h.sibling.return=h.return,h=h.sibling}}return!0}function Bu(u,h){for(h&=~kM,h&=~qx,u.suspendedLanes|=h,u.pingedLanes&=~h,u=u.expirationTimes;0<h;){var b=31-mt(h),E=1<<b;u[b]=-1,h&=~E}}function SN(u){if((On&6)!==0)throw Error(n(327));em();var h=Vn(u,0);if((h&1)===0)return Vs(u,st()),null;var b=eb(u,h);if(u.tag!==0&&b===2){var E=Xr(u);E!==0&&(h=E,b=UM(u,E))}if(b===1)throw b=Kv,xf(u,0),Bu(u,h),Vs(u,st()),b;if(b===6)throw Error(n(345));return u.finishedWork=u.current.alternate,u.finishedLanes=h,bf(u,Hs,bc),Vs(u,st()),null}function FM(u,h){var b=On;On|=1;try{return u(h)}finally{On=b,On===0&&(Jp=st()+500,ef&&Io())}}function yf(u){Fu!==null&&Fu.tag===0&&(On&6)===0&&em();var h=On;On|=1;var b=Do.transition,E=Pn;try{if(Do.transition=null,Pn=1,u)return u()}finally{Pn=E,Do.transition=b,On=h,(On&6)===0&&Io()}}function zM(){uo=Qp.current,$n(Qp)}function xf(u,h){u.finishedWork=null,u.finishedLanes=0;var b=u.timeoutHandle;if(b!==-1&&(u.timeoutHandle=-1,Ev(b)),Br!==null)for(b=Br.return;b!==null;){var E=b;switch(ya(E),E.tag){case 1:E=E.type.childContextTypes,E!=null&&Qd();break;case 3:ll(),$n(Pi),$n(Kr),Oo();break;case 5:Ou(E);break;case 4:ll();break;case 13:$n(Kn);break;case 19:$n(Kn);break;case 10:of(E.type._context);break;case 22:case 23:zM()}b=b.return}if(hi=u,Br=u=Hu(u.current,null),Oi=uo=h,ei=0,Kv=null,kM=qx=vf=0,Hs=Yv=null,ba!==null){for(h=0;h<ba.length;h++)if(b=ba[h],E=b.interleaved,E!==null){b.interleaved=null;var I=E.next,U=b.pending;if(U!==null){var G=U.next;U.next=I,E.next=G}b.pending=E}ba=null}return u}function MN(u,h){do{var b=Br;try{if(fc(),gc.current=Kp,lo){for(var E=Xn.memoizedState;E!==null;){var I=E.queue;I!==null&&(I.pending=null),E=E.next}lo=!1}if(wa=0,Rn=cr=Xn=null,fi=!1,cl=0,IM.current=null,b===null||b.return===null){ei=1,Kv=h,Br=null;break}e:{var U=u,G=b.return,se=b,he=h;if(h=Oi,se.flags|=32768,he!==null&&typeof he=="object"&&typeof he.then=="function"){var De=he,Ze=se,Je=Ze.tag;if((Ze.mode&1)===0&&(Je===0||Je===11||Je===15)){var Ye=Ze.alternate;Ye?(Ze.updateQueue=Ye.updateQueue,Ze.memoizedState=Ye.memoizedState,Ze.lanes=Ye.lanes):(Ze.updateQueue=null,Ze.memoizedState=null)}var _t=St(G);if(_t!==null){_t.flags&=-257,rn(_t,G,se,U,h),_t.mode&1&&tt(U,De,h),h=_t,he=De;var Tt=h.updateQueue;if(Tt===null){var Rt=new Set;Rt.add(he),h.updateQueue=Rt}else Tt.add(he);break e}else{if((h&1)===0){tt(U,De,h),BM();break e}he=Error(n(426))}}else if(qn&&se.mode&1){var Ir=St(G);if(Ir!==null){(Ir.flags&65536)===0&&(Ir.flags|=256),rn(Ir,G,se,U,h),Nu(P(he,se));break e}}U=he=P(he,se),ei!==4&&(ei=2),Yv===null?Yv=[U]:Yv.push(U),U=G;do{switch(U.tag){case 3:U.flags|=65536,h&=-h,U.lanes|=h;var Pe=ye(U,he,h);hc(U,Pe);break e;case 1:se=he;var ve=U.type,Ne=U.stateNode;if((U.flags&128)===0&&(typeof ve.getDerivedStateFromError=="function"||Ne!==null&&typeof Ne.componentDidCatch=="function"&&(ju===null||!ju.has(Ne)))){U.flags|=65536,h&=-h,U.lanes|=h;var it=ze(U,se,h);hc(U,it);break e}}U=U.return}while(U!==null)}TN(b)}catch(Ot){h=Ot,Br===b&&b!==null&&(Br=b=b.return);continue}break}while(!0)}function EN(){var u=Xx.current;return Xx.current=Kp,u===null?Kp:u}function BM(){(ei===0||ei===3||ei===2)&&(ei=4),hi===null||(vf&268435455)===0&&(qx&268435455)===0||Bu(hi,Oi)}function eb(u,h){var b=On;On|=2;var E=EN();(hi!==u||Oi!==h)&&(bc=null,xf(u,h));do try{rW();break}catch(I){MN(u,I)}while(!0);if(fc(),On=b,Xx.current=E,Br!==null)throw Error(n(261));return hi=null,Oi=0,ei}function rW(){for(;Br!==null;)AN(Br)}function iW(){for(;Br!==null&&!et();)AN(Br)}function AN(u){var h=RN(u.alternate,u,uo);u.memoizedProps=u.pendingProps,h===null?TN(u):Br=h,IM.current=null}function TN(u){var h=u;do{var b=h.alternate;if(u=h.return,(h.flags&32768)===0){if(b=YG(b,h,uo),b!==null){Br=b;return}}else{if(b=ZG(b,h),b!==null){b.flags&=32767,Br=b;return}if(u!==null)u.flags|=32768,u.subtreeFlags=0,u.deletions=null;else{ei=6,Br=null;return}}if(h=h.sibling,h!==null){Br=h;return}Br=h=u}while(h!==null);ei===0&&(ei=5)}function bf(u,h,b){var E=Pn,I=Do.transition;try{Do.transition=null,Pn=1,sW(u,h,b,E)}finally{Do.transition=I,Pn=E}return null}function sW(u,h,b,E){do em();while(Fu!==null);if((On&6)!==0)throw Error(n(327));b=u.finishedWork;var I=u.finishedLanes;if(b===null)return null;if(u.finishedWork=null,u.finishedLanes=0,b===u.current)throw Error(n(177));u.callbackNode=null,u.callbackPriority=0;var U=b.lanes|b.childLanes;if(xM(u,U),u===hi&&(Br=hi=null,Oi=0),(b.subtreeFlags&2064)===0&&(b.flags&2064)===0||Yx||(Yx=!0,NN(Pt,function(){return em(),null})),U=(b.flags&15990)!==0,(b.subtreeFlags&15990)!==0||U){U=Do.transition,Do.transition=null;var G=Pn;Pn=1;var se=On;On|=4,IM.current=null,JG(u,b),vN(b,u),Ur(wv),ks=!!Cu,wv=Cu=null,u.current=b,eW(b),vt(),On=se,Pn=G,Do.transition=U}else u.current=b;if(Yx&&(Yx=!1,Fu=u,Zx=I),U=u.pendingLanes,U===0&&(ju=null),Lt(b.stateNode),Vs(u,st()),h!==null)for(E=u.onRecoverableError,b=0;b<h.length;b++)I=h[b],E(I.value,{componentStack:I.stack,digest:I.digest});if(Kx)throw Kx=!1,u=LM,LM=null,u;return(Zx&1)!==0&&u.tag!==0&&em(),U=u.pendingLanes,(U&1)!==0?u===DM?Zv++:(Zv=0,DM=u):Zv=0,Io(),null}function em(){if(Fu!==null){var u=hu(Zx),h=Do.transition,b=Pn;try{if(Do.transition=null,Pn=16>u?16:u,Fu===null)var E=!1;else{if(u=Fu,Fu=null,Zx=0,(On&6)!==0)throw Error(n(331));var I=On;for(On|=4,Et=u.current;Et!==null;){var U=Et,G=U.child;if((Et.flags&16)!==0){var se=U.deletions;if(se!==null){for(var he=0;he<se.length;he++){var De=se[he];for(Et=De;Et!==null;){var Ze=Et;switch(Ze.tag){case 0:case 11:case 15:qv(8,Ze,U)}var Je=Ze.child;if(Je!==null)Je.return=Ze,Et=Je;else for(;Et!==null;){Ze=Et;var Ye=Ze.sibling,_t=Ze.return;if(fN(Ze),Ze===De){Et=null;break}if(Ye!==null){Ye.return=_t,Et=Ye;break}Et=_t}}}var Tt=U.alternate;if(Tt!==null){var Rt=Tt.child;if(Rt!==null){Tt.child=null;do{var Ir=Rt.sibling;Rt.sibling=null,Rt=Ir}while(Rt!==null)}}Et=U}}if((U.subtreeFlags&2064)!==0&&G!==null)G.return=U,Et=G;else e:for(;Et!==null;){if(U=Et,(U.flags&2048)!==0)switch(U.tag){case 0:case 11:case 15:qv(9,U,U.return)}var Pe=U.sibling;if(Pe!==null){Pe.return=U.return,Et=Pe;break e}Et=U.return}}var ve=u.current;for(Et=ve;Et!==null;){G=Et;var Ne=G.child;if((G.subtreeFlags&2064)!==0&&Ne!==null)Ne.return=G,Et=Ne;else e:for(G=ve;Et!==null;){if(se=Et,(se.flags&2048)!==0)try{switch(se.tag){case 0:case 11:case 15:$x(9,se)}}catch(Ot){_r(se,se.return,Ot)}if(se===G){Et=null;break e}var it=se.sibling;if(it!==null){it.return=se.return,Et=it;break e}Et=se.return}}if(On=I,Io(),Yt&&typeof Yt.onPostCommitFiberRoot=="function")try{Yt.onPostCommitFiberRoot(yn,u)}catch{}E=!0}return E}finally{Pn=b,Do.transition=h}}return!1}function CN(u,h,b){h=P(b,h),h=ye(u,h,1),u=Qn(u,h,1),h=xs(),u!==null&&(Za(u,1,h),Vs(u,h))}function _r(u,h,b){if(u.tag===3)CN(u,u,b);else for(;h!==null;){if(h.tag===3){CN(h,u,b);break}else if(h.tag===1){var E=h.stateNode;if(typeof h.type.getDerivedStateFromError=="function"||typeof E.componentDidCatch=="function"&&(ju===null||!ju.has(E))){u=P(b,u),u=ze(h,u,1),h=Qn(h,u,1),u=xs(),h!==null&&(Za(h,1,u),Vs(h,u));break}}h=h.return}}function oW(u,h,b){var E=u.pingCache;E!==null&&E.delete(h),h=xs(),u.pingedLanes|=u.suspendedLanes&b,hi===u&&(Oi&b)===b&&(ei===4||ei===3&&(Oi&130023424)===Oi&&500>st()-OM?xf(u,0):kM|=b),Vs(u,h)}function PN(u,h){h===0&&((u.mode&1)===0?h=1:(h=kn,kn<<=1,(kn&130023424)===0&&(kn=4194304)));var b=xs();u=oo(u,h),u!==null&&(Za(u,h,b),Vs(u,b))}function aW(u){var h=u.memoizedState,b=0;h!==null&&(b=h.retryLane),PN(u,b)}function lW(u,h){var b=0;switch(u.tag){case 13:var E=u.stateNode,I=u.memoizedState;I!==null&&(b=I.retryLane);break;case 19:E=u.stateNode;break;default:throw Error(n(314))}E!==null&&E.delete(h),PN(u,b)}var RN;RN=function(u,h,b){if(u!==null)if(u.memoizedProps!==h.pendingProps||Pi.current)ln=!0;else{if((u.lanes&b)===0&&(h.flags&128)===0)return ln=!1,KG(u,h,b);ln=(u.flags&131072)!==0}else ln=!1,qn&&(h.flags&1048576)!==0&&Rv(h,Fp,h.index);switch(h.lanes=0,h.tag){case 2:var E=h.type;Gx(u,h),u=h.pendingProps;var I=sc(h,Kr.current);al(h,b),I=df(null,h,E,u,I,b);var U=jv();return h.flags|=1,typeof I=="object"&&I!==null&&typeof I.render=="function"&&I.$$typeof===void 0?(h.tag=1,h.memoizedState=null,h.updateQueue=null,ui(E)?(U=!0,oc(h)):U=!1,h.memoizedState=I.state!==null&&I.state!==void 0?I.state:null,an(h),I.updater=Yp,h.stateNode=I,I._reactInternals=h,M(h,E,u,b),h=on(null,h,E,!0,U,b)):(h.tag=0,qn&&U&&Nv(h),bt(null,h,I,b),h=h.child),h;case 16:E=h.elementType;e:{switch(Gx(u,h),u=h.pendingProps,I=E._init,E=I(E._payload),h.type=E,I=h.tag=uW(E),u=Bs(E,u),I){case 0:h=gt(null,h,E,u,b);break e;case 1:h=It(null,h,E,u,b);break e;case 11:h=Jr(null,h,E,u,b);break e;case 14:h=ys(null,h,E,Bs(E.type,u),b);break e}throw Error(n(306,E,""))}return h;case 0:return E=h.type,I=h.pendingProps,I=h.elementType===E?I:Bs(E,I),gt(u,h,E,I,b);case 1:return E=h.type,I=h.pendingProps,I=h.elementType===E?I:Bs(E,I),It(u,h,E,I,b);case 3:e:{if(sn(h),u===null)throw Error(n(387));E=h.pendingProps,U=h.memoizedState,I=U.element,mr(u,h),lr(h,E,null,b);var G=h.memoizedState;if(E=G.element,U.isDehydrated)if(U={element:E,isDehydrated:!1,cache:G.cache,pendingSuspenseBoundaries:G.pendingSuspenseBoundaries,transitions:G.transitions},h.updateQueue.baseState=U,h.memoizedState=U,h.flags&256){I=P(Error(n(423)),h),h=En(u,h,E,b,I);break e}else if(E!==I){I=P(Error(n(424)),h),h=En(u,h,E,b,I);break e}else for(Ni=ha(h.stateNode.containerInfo.firstChild),Yr=h,qn=!0,zs=null,b=sf(h,null,E,b),h.child=b;b;)b.flags=b.flags&-3|4096,b=b.sibling;else{if(ol(),E===I){h=xc(u,h,b);break e}bt(u,h,E,b)}h=h.child}return h;case 5:return mc(h),u===null&&Bp(h),E=h.type,I=h.pendingProps,U=u!==null?u.memoizedProps:null,G=I.children,Sv(E,I)?G=null:U!==null&&Sv(E,U)&&(h.flags|=32),je(u,h),bt(u,h,G,b),h.child;case 6:return u===null&&Bp(h),null;case 13:return Ea(u,h,b);case 4:return cf(h,h.stateNode.containerInfo),E=h.pendingProps,u===null?h.child=cc(h,null,E,b):bt(u,h,E,b),h.child;case 11:return E=h.type,I=h.pendingProps,I=h.elementType===E?I:Bs(E,I),Jr(u,h,E,I,b);case 7:return bt(u,h,h.pendingProps,b),h.child;case 8:return bt(u,h,h.pendingProps.children,b),h.child;case 12:return bt(u,h,h.pendingProps.children,b),h.child;case 10:e:{if(E=h.type._context,I=h.pendingProps,U=h.memoizedProps,G=I.value,Gn(uc,E._currentValue),E._currentValue=G,U!==null)if(ds(U.value,G)){if(U.children===I.children&&!Pi.current){h=xc(u,h,b);break e}}else for(U=h.child,U!==null&&(U.return=h);U!==null;){var se=U.dependencies;if(se!==null){G=U.child;for(var he=se.firstContext;he!==null;){if(he.context===E){if(U.tag===1){he=zn(-1,b&-b),he.tag=2;var De=U.updateQueue;if(De!==null){De=De.shared;var Ze=De.pending;Ze===null?he.next=he:(he.next=Ze.next,Ze.next=he),De.pending=he}}U.lanes|=b,he=U.alternate,he!==null&&(he.lanes|=b),af(U.return,b,h),se.lanes|=b;break}he=he.next}}else if(U.tag===10)G=U.type===h.type?null:U.child;else if(U.tag===18){if(G=U.return,G===null)throw Error(n(341));G.lanes|=b,se=G.alternate,se!==null&&(se.lanes|=b),af(G,b,h),G=U.sibling}else G=U.child;if(G!==null)G.return=U;else for(G=U;G!==null;){if(G===h){G=null;break}if(U=G.sibling,U!==null){U.return=G.return,G=U;break}G=G.return}U=G}bt(u,h,I.children,b),h=h.child}return h;case 9:return I=h.type,E=h.pendingProps.children,al(h,b),I=ps(I),E=E(I),h.flags|=1,bt(u,h,E,b),h.child;case 14:return E=h.type,I=Bs(E,h.pendingProps),I=Bs(E.type,I),ys(u,h,E,I,b);case 15:return Ie(u,h,h.type,h.pendingProps,b);case 17:return E=h.type,I=h.pendingProps,I=h.elementType===E?I:Bs(E,I),Gx(u,h),h.tag=1,ui(E)?(u=!0,oc(h)):u=!1,al(h,b),p(h,E,I),M(h,E,I,b),on(null,h,E,!0,u,b);case 19:return aN(u,h,b);case 22:return be(u,h,b)}throw Error(n(156,h.tag))};function NN(u,h){return ke(u,h)}function cW(u,h,b,E){this.tag=u,this.key=b,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=h,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=E,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Uo(u,h,b,E){return new cW(u,h,b,E)}function HM(u){return u=u.prototype,!(!u||!u.isReactComponent)}function uW(u){if(typeof u=="function")return HM(u)?1:0;if(u!=null){if(u=u.$$typeof,u===H)return 11;if(u===pe)return 14}return 2}function Hu(u,h){var b=u.alternate;return b===null?(b=Uo(u.tag,h,u.key,u.mode),b.elementType=u.elementType,b.type=u.type,b.stateNode=u.stateNode,b.alternate=u,u.alternate=b):(b.pendingProps=h,b.type=u.type,b.flags=0,b.subtreeFlags=0,b.deletions=null),b.flags=u.flags&14680064,b.childLanes=u.childLanes,b.lanes=u.lanes,b.child=u.child,b.memoizedProps=u.memoizedProps,b.memoizedState=u.memoizedState,b.updateQueue=u.updateQueue,h=u.dependencies,b.dependencies=h===null?null:{lanes:h.lanes,firstContext:h.firstContext},b.sibling=u.sibling,b.index=u.index,b.ref=u.ref,b}function tb(u,h,b,E,I,U){var G=2;if(E=u,typeof u=="function")HM(u)&&(G=1);else if(typeof u=="string")G=5;else e:switch(u){case D:return _f(b.children,I,U,h);case F:G=8,I|=8;break;case V:return u=Uo(12,b,h,I|2),u.elementType=V,u.lanes=U,u;case ne:return u=Uo(13,b,h,I),u.elementType=ne,u.lanes=U,u;case te:return u=Uo(19,b,h,I),u.elementType=te,u.lanes=U,u;case ce:return nb(b,I,U,h);default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case k:G=10;break e;case j:G=9;break e;case H:G=11;break e;case pe:G=14;break e;case oe:G=16,E=null;break e}throw Error(n(130,u==null?u:typeof u,""))}return h=Uo(G,b,h,I),h.elementType=u,h.type=E,h.lanes=U,h}function _f(u,h,b,E){return u=Uo(7,u,E,h),u.lanes=b,u}function nb(u,h,b,E){return u=Uo(22,u,E,h),u.elementType=ce,u.lanes=b,u.stateNode={isHidden:!1},u}function VM(u,h,b){return u=Uo(6,u,null,h),u.lanes=b,u}function GM(u,h,b){return h=Uo(4,u.children!==null?u.children:[],u.key,h),h.lanes=b,h.stateNode={containerInfo:u.containerInfo,pendingChildren:null,implementation:u.implementation},h}function dW(u,h,b,E,I){this.tag=h,this.containerInfo=u,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ld(0),this.expirationTimes=Ld(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ld(0),this.identifierPrefix=E,this.onRecoverableError=I,this.mutableSourceEagerHydrationData=null}function WM(u,h,b,E,I,U,G,se,he){return u=new dW(u,h,b,se,he),h===1?(h=1,U===!0&&(h|=8)):h=0,U=Uo(3,null,null,h),u.current=U,U.stateNode=u,U.memoizedState={element:E,isDehydrated:b,cache:null,transitions:null,pendingSuspenseBoundaries:null},an(U),u}function fW(u,h,b){var E=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:N,key:E==null?null:""+E,children:u,containerInfo:h,implementation:b}}function IN(u){if(!u)return ma;u=u._reactInternals;e:{if(To(u)!==u||u.tag!==1)throw Error(n(170));var h=u;do{switch(h.tag){case 3:h=h.stateNode.context;break e;case 1:if(ui(h.type)){h=h.stateNode.__reactInternalMemoizedMergedChildContext;break e}}h=h.return}while(h!==null);throw Error(n(171))}if(u.tag===1){var b=u.type;if(ui(b))return Jd(u,b,h)}return h}function kN(u,h,b,E,I,U,G,se,he){return u=WM(b,E,!0,u,I,U,G,se,he),u.context=IN(null),b=u.current,E=xs(),I=zu(b),U=zn(E,I),U.callback=h??null,Qn(b,U,I),u.current.lanes=I,Za(u,I,E),Vs(u,E),u}function rb(u,h,b,E){var I=h.current,U=xs(),G=zu(I);return b=IN(b),h.context===null?h.context=b:h.pendingContext=b,h=zn(U,G),h.payload={element:u},E=E===void 0?null:E,E!==null&&(h.callback=E),u=Qn(I,h,G),u!==null&&(Ca(u,I,G,U),di(u,I,G)),G}function ib(u){if(u=u.current,!u.child)return null;switch(u.child.tag){case 5:return u.child.stateNode;default:return u.child.stateNode}}function ON(u,h){if(u=u.memoizedState,u!==null&&u.dehydrated!==null){var b=u.retryLane;u.retryLane=b!==0&&b<h?b:h}}function $M(u,h){ON(u,h),(u=u.alternate)&&ON(u,h)}function hW(){return null}var LN=typeof reportError=="function"?reportError:function(u){console.error(u)};function XM(u){this._internalRoot=u}sb.prototype.render=XM.prototype.render=function(u){var h=this._internalRoot;if(h===null)throw Error(n(409));rb(u,h,null,null)},sb.prototype.unmount=XM.prototype.unmount=function(){var u=this._internalRoot;if(u!==null){this._internalRoot=null;var h=u.containerInfo;yf(function(){rb(null,u,null,null)}),h[hs]=null}};function sb(u){this._internalRoot=u}sb.prototype.unstable_scheduleHydration=function(u){if(u){var h=ip();u={blockedOn:null,target:u,priority:h};for(var b=0;b<Qa.length&&h!==0&&h<Qa[b].priority;b++);Qa.splice(b,0,u),b===0&&ap(u)}};function qM(u){return!(!u||u.nodeType!==1&&u.nodeType!==9&&u.nodeType!==11)}function ob(u){return!(!u||u.nodeType!==1&&u.nodeType!==9&&u.nodeType!==11&&(u.nodeType!==8||u.nodeValue!==" react-mount-point-unstable "))}function DN(){}function pW(u,h,b,E,I){if(I){if(typeof E=="function"){var U=E;E=function(){var De=ib(G);U.call(De)}}var G=kN(h,E,u,0,null,!1,!1,"",DN);return u._reactRootContainer=G,u[hs]=G.current,Au(u.nodeType===8?u.parentNode:u),yf(),G}for(;I=u.lastChild;)u.removeChild(I);if(typeof E=="function"){var se=E;E=function(){var De=ib(he);se.call(De)}}var he=WM(u,0,!1,null,null,!1,!1,"",DN);return u._reactRootContainer=he,u[hs]=he.current,Au(u.nodeType===8?u.parentNode:u),yf(function(){rb(h,he,b,E)}),he}function ab(u,h,b,E,I){var U=b._reactRootContainer;if(U){var G=U;if(typeof I=="function"){var se=I;I=function(){var he=ib(G);se.call(he)}}rb(h,G,u,I)}else G=pW(b,h,u,I,E);return ib(G)}Dd=function(u){switch(u.tag){case 3:var h=u.stateNode;if(h.current.memoizedState.isDehydrated){var b=Is(h.pendingLanes);b!==0&&(fu(h,b|1),Vs(h,st()),(On&6)===0&&(Jp=st()+500,Io()))}break;case 13:yf(function(){var E=oo(u,1);if(E!==null){var I=xs();Ca(E,u,1,I)}}),$M(u,1)}},sv=function(u){if(u.tag===13){var h=oo(u,134217728);if(h!==null){var b=xs();Ca(h,u,134217728,b)}$M(u,134217728)}},vx=function(u){if(u.tag===13){var h=zu(u),b=oo(u,h);if(b!==null){var E=xs();Ca(b,u,h,E)}$M(u,h)}},ip=function(){return Pn},sp=function(u,h){var b=Pn;try{return Pn=u,h()}finally{Pn=b}},Te=function(u,h,b){switch(h){case"input":if(Qe(u,b),h=b.name,b.type==="radio"&&h!=null){for(b=u;b.parentNode;)b=b.parentNode;for(b=b.querySelectorAll("input[name="+JSON.stringify(""+h)+'][type="radio"]'),h=0;h<b.length;h++){var E=b[h];if(E!==u&&E.form===u.form){var I=Dp(E);if(!I)throw Error(n(90));ue(E),Qe(E,I)}}}break;case"textarea":le(u,b);break;case"select":h=b.value,h!=null&&W(u,!!b.multiple,h,!1)}},Cn=FM,Jt=yf;var mW={usingClientEntryPoint:!1,Events:[pa,pr,Dp,Kt,un,FM]},Qv={findFiberByHostInstance:sl,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},gW={bundleType:Qv.bundleType,version:Qv.version,rendererPackageName:Qv.rendererPackageName,rendererConfig:Qv.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(u){return u=xe(u),u===null?null:u.stateNode},findFiberByHostInstance:Qv.findFiberByHostInstance||hW,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var lb=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!lb.isDisabled&&lb.supportsFiber)try{yn=lb.inject(gW),Yt=lb}catch{}}return Gs.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=mW,Gs.createPortal=function(u,h){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!qM(h))throw Error(n(200));return fW(u,h,null,b)},Gs.createRoot=function(u,h){if(!qM(u))throw Error(n(299));var b=!1,E="",I=LN;return h!=null&&(h.unstable_strictMode===!0&&(b=!0),h.identifierPrefix!==void 0&&(E=h.identifierPrefix),h.onRecoverableError!==void 0&&(I=h.onRecoverableError)),h=WM(u,1,!1,null,null,b,!1,E,I),u[hs]=h.current,Au(u.nodeType===8?u.parentNode:u),new XM(h)},Gs.findDOMNode=function(u){if(u==null)return null;if(u.nodeType===1)return u;var h=u._reactInternals;if(h===void 0)throw typeof u.render=="function"?Error(n(188)):(u=Object.keys(u).join(","),Error(n(268,u)));return u=xe(h),u=u===null?null:u.stateNode,u},Gs.flushSync=function(u){return yf(u)},Gs.hydrate=function(u,h,b){if(!ob(h))throw Error(n(200));return ab(null,u,h,!0,b)},Gs.hydrateRoot=function(u,h,b){if(!qM(u))throw Error(n(405));var E=b!=null&&b.hydratedSources||null,I=!1,U="",G=LN;if(b!=null&&(b.unstable_strictMode===!0&&(I=!0),b.identifierPrefix!==void 0&&(U=b.identifierPrefix),b.onRecoverableError!==void 0&&(G=b.onRecoverableError)),h=kN(h,null,u,1,b??null,I,!1,U,G),u[hs]=h.current,Au(u),E)for(u=0;u<E.length;u++)b=E[u],I=b._getVersion,I=I(b._source),h.mutableSourceEagerHydrationData==null?h.mutableSourceEagerHydrationData=[b,I]:h.mutableSourceEagerHydrationData.push(b,I);return new sb(h)},Gs.render=function(u,h,b){if(!ob(h))throw Error(n(200));return ab(null,u,h,!1,b)},Gs.unmountComponentAtNode=function(u){if(!ob(u))throw Error(n(40));return u._reactRootContainer?(yf(function(){ab(null,null,u,!1,function(){u._reactRootContainer=null,u[hs]=null})}),!0):!1},Gs.unstable_batchedUpdates=FM,Gs.unstable_renderSubtreeIntoContainer=function(u,h,b,E){if(!ob(b))throw Error(n(200));if(u==null||u._reactInternals===void 0)throw Error(n(38));return ab(u,h,b,!1,E)},Gs.version="18.3.1-next-f1338f8080-20240426",Gs}var WN;function Vj(){if(WN)return QM.exports;WN=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),QM.exports=AW(),QM.exports}var $N;function TW(){if($N)return ub;$N=1;var t=Vj();return ub.createRoot=t.createRoot,ub.hydrateRoot=t.hydrateRoot,ub}var CW=TW();const PW=z1(CW);var Hy=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},uh,dd,ig,Ij,RW=(Ij=class extends Hy{constructor(){super();Wt(this,uh);Wt(this,dd);Wt(this,ig);wt(this,ig,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){me(this,dd)||this.setEventListener(me(this,ig))}onUnsubscribe(){var e;this.hasListeners()||((e=me(this,dd))==null||e.call(this),wt(this,dd,void 0))}setEventListener(e){var n;wt(this,ig,e),(n=me(this,dd))==null||n.call(this),wt(this,dd,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){me(this,uh)!==e&&(wt(this,uh,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof me(this,uh)=="boolean"?me(this,uh):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},uh=new WeakMap,dd=new WeakMap,ig=new WeakMap,Ij),hP=new RW,NW={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},fd,fP,kj,IW=(kj=class{constructor(){Wt(this,fd,NW);Wt(this,fP,!1)}setTimeoutProvider(t){wt(this,fd,t)}setTimeout(t,e){return me(this,fd).setTimeout(t,e)}clearTimeout(t){me(this,fd).clearTimeout(t)}setInterval(t,e){return me(this,fd).setInterval(t,e)}clearInterval(t){me(this,fd).clearInterval(t)}},fd=new WeakMap,fP=new WeakMap,kj),Qf=new IW;function kW(t){setTimeout(t,0)}var OW=typeof window>"u"||"Deno"in globalThis;function Xs(){}function LW(t,e){return typeof t=="function"?t(e):t}function fT(t){return typeof t=="number"&&t>=0&&t!==1/0}function Gj(t,e){return Math.max(t+(e||0)-Date.now(),0)}function bd(t,e){return typeof t=="function"?t(e):t}function vo(t,e){return typeof t=="function"?t(e):t}function XN(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:o,stale:a}=t;if(o){if(r){if(e.queryHash!==pP(o,e.options))return!1}else if(!ty(e.queryKey,o))return!1}if(n!=="all"){const l=e.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&e.isStale()!==a||i&&i!==e.state.fetchStatus||s&&!s(e))}function qN(t,e){const{exact:n,status:r,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(n){if(ey(e.options.mutationKey)!==ey(s))return!1}else if(!ty(e.options.mutationKey,s))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function pP(t,e){return((e==null?void 0:e.queryKeyHashFn)||ey)(t)}function ey(t){return JSON.stringify(t,(e,n)=>pT(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function ty(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>ty(t[n],e[n])):!1}var DW=Object.prototype.hasOwnProperty;function Wj(t,e,n=0){if(t===e)return t;if(n>500)return e;const r=KN(t)&&KN(e);if(!r&&!(pT(t)&&pT(e)))return e;const s=(r?t:Object.keys(t)).length,o=r?e:Object.keys(e),a=o.length,l=r?new Array(a):{};let c=0;for(let d=0;d<a;d++){const f=r?d:o[d],m=t[f],y=e[f];if(m===y){l[f]=m,(r?d<s:DW.call(t,f))&&c++;continue}if(m===null||y===null||typeof m!="object"||typeof y!="object"){l[f]=y;continue}const x=Wj(m,y,n+1);l[f]=x,x===m&&c++}return s===a&&c===s?t:l}function hT(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(t[n]!==e[n])return!1;return!0}function KN(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function pT(t){if(!YN(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!YN(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function YN(t){return Object.prototype.toString.call(t)==="[object Object]"}function UW(t){return new Promise(e=>{Qf.setTimeout(e,t)})}function mT(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?Wj(t,e):e}function jW(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function FW(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var mP=Symbol();function $j(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===mP?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function Xj(t,e){return typeof t=="function"?t(...e):!!t}function zW(t,e,n){let r=!1,i;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(i??(i=e()),r||(r=!0,i.aborted?n():i.addEventListener("abort",n,{once:!0})),i)}),t}var ny=(()=>{let t=()=>OW;return{isServer(){return t()},setIsServer(e){t=e}}})();function gT(){let t,e;const n=new Promise((i,s)=>{t=i,e=s});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),t(i)},n.reject=i=>{r({status:"rejected",reason:i}),e(i)},n}var BW=kW;function HW(){let t=[],e=0,n=a=>{a()},r=a=>{a()},i=BW;const s=a=>{e?t.push(a):i(()=>{n(a)})},o=()=>{const a=t;t=[],a.length&&i(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;e++;try{l=a()}finally{e--,e||o()}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l)})},schedule:s,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{i=a}}}var Fi=HW(),sg,hd,og,Oj,VW=(Oj=class extends Hy{constructor(){super();Wt(this,sg,!0);Wt(this,hd);Wt(this,og);wt(this,og,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){me(this,hd)||this.setEventListener(me(this,og))}onUnsubscribe(){var e;this.hasListeners()||((e=me(this,hd))==null||e.call(this),wt(this,hd,void 0))}setEventListener(e){var n;wt(this,og,e),(n=me(this,hd))==null||n.call(this),wt(this,hd,e(this.setOnline.bind(this)))}setOnline(e){me(this,sg)!==e&&(wt(this,sg,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return me(this,sg)}},sg=new WeakMap,hd=new WeakMap,og=new WeakMap,Oj),Q_=new VW;function GW(t){return Math.min(1e3*2**t,3e4)}function qj(t){return(t??"online")==="online"?Q_.isOnline():!0}var vT=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function Kj(t){let e=!1,n=0,r;const i=gT(),s=()=>i.status!=="pending",o=S=>{var _;if(!s()){const w=new vT(S);m(w),(_=t.onCancel)==null||_.call(t,w)}},a=()=>{e=!0},l=()=>{e=!1},c=()=>hP.isFocused()&&(t.networkMode==="always"||Q_.isOnline())&&t.canRun(),d=()=>qj(t.networkMode)&&t.canRun(),f=S=>{s()||(r==null||r(),i.resolve(S))},m=S=>{s()||(r==null||r(),i.reject(S))},y=()=>new Promise(S=>{var _;r=w=>{(s()||c())&&S(w)},(_=t.onPause)==null||_.call(t)}).then(()=>{var S;r=void 0,s()||(S=t.onContinue)==null||S.call(t)}),x=()=>{if(s())return;let S;const _=n===0?t.initialPromise:void 0;try{S=_??t.fn()}catch(w){S=Promise.reject(w)}Promise.resolve(S).then(f).catch(w=>{var N;if(s())return;const A=t.retry??(ny.isServer()?0:3),T=t.retryDelay??GW,C=typeof T=="function"?T(n,w):T,O=A===!0||typeof A=="number"&&n<A||typeof A=="function"&&A(n,w);if(e||!O){m(w);return}n++,(N=t.onFail)==null||N.call(t,n,w),UW(C).then(()=>c()?void 0:y()).then(()=>{e?m(w):x()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r==null||r(),i),cancelRetry:a,continueRetry:l,canStart:d,start:()=>(d()?x():y().then(x),i)}}var dh,Lj,Yj=(Lj=class{constructor(){Wt(this,dh)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),fT(this.gcTime)&&wt(this,dh,Qf.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(ny.isServer()?1/0:300*1e3))}clearGcTimeout(){me(this,dh)!==void 0&&(Qf.clearTimeout(me(this,dh)),wt(this,dh,void 0))}},dh=new WeakMap,Lj);function WW(t){return{onFetch:(e,n)=>{var d,f,m,y,x;const r=e.options,i=(m=(f=(d=e.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:m.direction,s=((y=e.state.data)==null?void 0:y.pages)||[],o=((x=e.state.data)==null?void 0:x.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let S=!1;const _=T=>{zW(T,()=>e.signal,()=>S=!0)},w=$j(e.options,e.fetchOptions),A=async(T,C,O)=>{if(S)return Promise.reject(e.signal.reason);if(C==null&&T.pages.length)return Promise.resolve(T);const D=(()=>{const j={client:e.client,queryKey:e.queryKey,pageParam:C,direction:O?"backward":"forward",meta:e.options.meta};return _(j),j})(),F=await w(D),{maxPages:V}=e.options,k=O?FW:jW;return{pages:k(T.pages,F,V),pageParams:k(T.pageParams,C,V)}};if(i&&s.length){const T=i==="backward",C=T?$W:ZN,O={pages:s,pageParams:o},N=C(r,O);a=await A(O,N,T)}else{const T=t??s.length;do{const C=l===0?o[0]??r.initialPageParam:ZN(r,a);if(l>0&&C==null)break;a=await A(a,C),l++}while(l<T)}return a};e.options.persister?e.fetchFn=()=>{var S,_;return(_=(S=e.options).persister)==null?void 0:_.call(S,c,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=c}}}function ZN(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function $W(t,{pages:e,pageParams:n}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,n[0],n):void 0}var ag,fh,lg,Vo,hh,gi,Uy,ph,go,Zj,Cc,Dj,XW=(Dj=class extends Yj{constructor(e){super();Wt(this,go);Wt(this,ag);Wt(this,fh);Wt(this,lg);Wt(this,Vo);Wt(this,hh);Wt(this,gi);Wt(this,Uy);Wt(this,ph);wt(this,ph,!1),wt(this,Uy,e.defaultOptions),this.setOptions(e.options),this.observers=[],wt(this,hh,e.client),wt(this,Vo,me(this,hh).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,wt(this,fh,JN(this.options)),this.state=e.state??me(this,fh),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return me(this,ag)}get promise(){var e;return(e=me(this,gi))==null?void 0:e.promise}setOptions(e){if(this.options={...me(this,Uy),...e},e!=null&&e._type&&wt(this,ag,e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=JN(this.options);n.data!==void 0&&(this.setState(QN(n.data,n.dataUpdatedAt)),wt(this,fh,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&me(this,Vo).remove(this)}setData(e,n){const r=mT(this.state.data,e,this.options);return _n(this,go,Cc).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e){_n(this,go,Cc).call(this,{type:"setState",state:e})}cancel(e){var r,i;const n=(r=me(this,gi))==null?void 0:r.promise;return(i=me(this,gi))==null||i.cancel(e),n?n.then(Xs).catch(Xs):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return me(this,fh)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>vo(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===mP||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>bd(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!Gj(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=me(this,gi))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=me(this,gi))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),me(this,Vo).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(me(this,gi)&&(me(this,ph)||_n(this,go,Zj).call(this)?me(this,gi).cancel({revert:!0}):me(this,gi).cancelRetry()),this.scheduleGc()),me(this,Vo).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||_n(this,go,Cc).call(this,{type:"invalidate"})}async fetch(e,n){var c,d,f,m,y,x,S,_,w,A,T;if(this.state.fetchStatus!=="idle"&&((c=me(this,gi))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(me(this,gi))return me(this,gi).continueRetry(),me(this,gi).promise}if(e&&this.setOptions(e),!this.options.queryFn){const C=this.observers.find(O=>O.options.queryFn);C&&this.setOptions(C.options)}const r=new AbortController,i=C=>{Object.defineProperty(C,"signal",{enumerable:!0,get:()=>(wt(this,ph,!0),r.signal)})},s=()=>{const C=$j(this.options,n),N=(()=>{const D={client:me(this,hh),queryKey:this.queryKey,meta:this.meta};return i(D),D})();return wt(this,ph,!1),this.options.persister?this.options.persister(C,N,this):C(N)},a=(()=>{const C={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:me(this,hh),state:this.state,fetchFn:s};return i(C),C})(),l=me(this,ag)==="infinite"?WW(this.options.pages):this.options.behavior;l==null||l.onFetch(a,this),wt(this,lg,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&_n(this,go,Cc).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),wt(this,gi,Kj({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:C=>{C instanceof vT&&C.revert&&this.setState({...me(this,lg),fetchStatus:"idle"}),r.abort()},onFail:(C,O)=>{_n(this,go,Cc).call(this,{type:"failed",failureCount:C,error:O})},onPause:()=>{_n(this,go,Cc).call(this,{type:"pause"})},onContinue:()=>{_n(this,go,Cc).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const C=await me(this,gi).start();if(C===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(C),(y=(m=me(this,Vo).config).onSuccess)==null||y.call(m,C,this),(S=(x=me(this,Vo).config).onSettled)==null||S.call(x,C,this.state.error,this),C}catch(C){if(C instanceof vT){if(C.silent)return me(this,gi).promise;if(C.revert){if(this.state.data===void 0)throw C;return this.state.data}}throw _n(this,go,Cc).call(this,{type:"error",error:C}),(w=(_=me(this,Vo).config).onError)==null||w.call(_,C,this),(T=(A=me(this,Vo).config).onSettled)==null||T.call(A,this.state.data,C,this),C}finally{this.scheduleGc()}}},ag=new WeakMap,fh=new WeakMap,lg=new WeakMap,Vo=new WeakMap,hh=new WeakMap,gi=new WeakMap,Uy=new WeakMap,ph=new WeakMap,go=new WeakSet,Zj=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Cc=function(e){const n=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...Qj(r.data,this.options),fetchMeta:e.meta??null};case"success":const i={...r,...QN(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return wt(this,lg,e.manual?i:void 0),i;case"error":const s=e.error;return{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=n(this.state),Fi.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),me(this,Vo).notify({query:this,type:"updated",action:e})})},Dj);function Qj(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:qj(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function QN(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function JN(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var $s,An,jy,ws,mh,cg,Ic,pd,Fy,ug,dg,gh,vh,md,fg,Bn,O0,yT,xT,bT,_T,wT,ST,MT,Jj,Uj,qW=(Uj=class extends Hy{constructor(e,n){super();Wt(this,Bn);Wt(this,$s);Wt(this,An);Wt(this,jy);Wt(this,ws);Wt(this,mh);Wt(this,cg);Wt(this,Ic);Wt(this,pd);Wt(this,Fy);Wt(this,ug);Wt(this,dg);Wt(this,gh);Wt(this,vh);Wt(this,md);Wt(this,fg,new Set);this.options=n,wt(this,$s,e),wt(this,pd,null),wt(this,Ic,gT()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(me(this,An).addObserver(this),eI(me(this,An),this.options)?_n(this,Bn,O0).call(this):this.updateResult(),_n(this,Bn,_T).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ET(me(this,An),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ET(me(this,An),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,_n(this,Bn,wT).call(this),_n(this,Bn,ST).call(this),me(this,An).removeObserver(this)}setOptions(e){const n=this.options,r=me(this,An);if(this.options=me(this,$s).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof vo(this.options.enabled,me(this,An))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");_n(this,Bn,MT).call(this),me(this,An).setOptions(this.options),n._defaulted&&!hT(this.options,n)&&me(this,$s).getQueryCache().notify({type:"observerOptionsUpdated",query:me(this,An),observer:this});const i=this.hasListeners();i&&tI(me(this,An),r,this.options,n)&&_n(this,Bn,O0).call(this),this.updateResult(),i&&(me(this,An)!==r||vo(this.options.enabled,me(this,An))!==vo(n.enabled,me(this,An))||bd(this.options.staleTime,me(this,An))!==bd(n.staleTime,me(this,An)))&&_n(this,Bn,yT).call(this);const s=_n(this,Bn,xT).call(this);i&&(me(this,An)!==r||vo(this.options.enabled,me(this,An))!==vo(n.enabled,me(this,An))||s!==me(this,md))&&_n(this,Bn,bT).call(this,s)}getOptimisticResult(e){const n=me(this,$s).getQueryCache().build(me(this,$s),e),r=this.createResult(n,e);return YW(this,r)&&(wt(this,ws,r),wt(this,cg,this.options),wt(this,mh,me(this,An).state)),r}getCurrentResult(){return me(this,ws)}trackResult(e,n){return new Proxy(e,{get:(r,i)=>(this.trackProp(i),n==null||n(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&me(this,Ic).status==="pending"&&me(this,Ic).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(e){me(this,fg).add(e)}getCurrentQuery(){return me(this,An)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=me(this,$s).defaultQueryOptions(e),r=me(this,$s).getQueryCache().build(me(this,$s),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){return _n(this,Bn,O0).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),me(this,ws)))}createResult(e,n){var V;const r=me(this,An),i=this.options,s=me(this,ws),o=me(this,mh),a=me(this,cg),c=e!==r?e.state:me(this,jy),{state:d}=e;let f={...d},m=!1,y;if(n._optimisticResults){const k=this.hasListeners(),j=!k&&eI(e,n),H=k&&tI(e,r,n,i);(j||H)&&(f={...f,...Qj(d.data,e.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:x,errorUpdatedAt:S,status:_}=f;y=f.data;let w=!1;if(n.placeholderData!==void 0&&y===void 0&&_==="pending"){let k;s!=null&&s.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(k=s.data,w=!0):k=typeof n.placeholderData=="function"?n.placeholderData((V=me(this,dg))==null?void 0:V.state.data,me(this,dg)):n.placeholderData,k!==void 0&&(_="success",y=mT(s==null?void 0:s.data,k,n),m=!0)}if(n.select&&y!==void 0&&!w)if(s&&y===(o==null?void 0:o.data)&&n.select===me(this,Fy))y=me(this,ug);else try{wt(this,Fy,n.select),y=n.select(y),y=mT(s==null?void 0:s.data,y,n),wt(this,ug,y),wt(this,pd,null)}catch(k){wt(this,pd,k)}me(this,pd)&&(x=me(this,pd),y=me(this,ug),S=Date.now(),_="error");const A=f.fetchStatus==="fetching",T=_==="pending",C=_==="error",O=T&&A,N=y!==void 0,F={status:_,fetchStatus:f.fetchStatus,isPending:T,isSuccess:_==="success",isError:C,isInitialLoading:O,isLoading:O,data:y,dataUpdatedAt:f.dataUpdatedAt,error:x,errorUpdatedAt:S,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:f.dataUpdateCount>c.dataUpdateCount||f.errorUpdateCount>c.errorUpdateCount,isFetching:A,isRefetching:A&&!T,isLoadingError:C&&!N,isPaused:f.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:C&&N,isStale:gP(e,n),refetch:this.refetch,promise:me(this,Ic),isEnabled:vo(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const k=F.data!==void 0,j=F.status==="error"&&!k,H=pe=>{j?pe.reject(F.error):k&&pe.resolve(F.data)},ne=()=>{const pe=wt(this,Ic,F.promise=gT());H(pe)},te=me(this,Ic);switch(te.status){case"pending":e.queryHash===r.queryHash&&H(te);break;case"fulfilled":(j||F.data!==te.value)&&ne();break;case"rejected":(!j||F.error!==te.reason)&&ne();break}}return F}updateResult(){const e=me(this,ws),n=this.createResult(me(this,An),this.options);if(wt(this,mh,me(this,An).state),wt(this,cg,this.options),me(this,mh).data!==void 0&&wt(this,dg,me(this,An)),hT(n,e))return;wt(this,ws,n);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,s=typeof i=="function"?i():i;if(s==="all"||!s&&!me(this,fg).size)return!0;const o=new Set(s??me(this,fg));return this.options.throwOnError&&o.add("error"),Object.keys(me(this,ws)).some(a=>{const l=a;return me(this,ws)[l]!==e[l]&&o.has(l)})};_n(this,Bn,Jj).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&_n(this,Bn,_T).call(this)}},$s=new WeakMap,An=new WeakMap,jy=new WeakMap,ws=new WeakMap,mh=new WeakMap,cg=new WeakMap,Ic=new WeakMap,pd=new WeakMap,Fy=new WeakMap,ug=new WeakMap,dg=new WeakMap,gh=new WeakMap,vh=new WeakMap,md=new WeakMap,fg=new WeakMap,Bn=new WeakSet,O0=function(e){_n(this,Bn,MT).call(this);let n=me(this,An).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(Xs)),n},yT=function(){_n(this,Bn,wT).call(this);const e=bd(this.options.staleTime,me(this,An));if(ny.isServer()||me(this,ws).isStale||!fT(e))return;const r=Gj(me(this,ws).dataUpdatedAt,e)+1;wt(this,gh,Qf.setTimeout(()=>{me(this,ws).isStale||this.updateResult()},r))},xT=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(me(this,An)):this.options.refetchInterval)??!1},bT=function(e){_n(this,Bn,ST).call(this),wt(this,md,e),!(ny.isServer()||vo(this.options.enabled,me(this,An))===!1||!fT(me(this,md))||me(this,md)===0)&&wt(this,vh,Qf.setInterval(()=>{(this.options.refetchIntervalInBackground||hP.isFocused())&&_n(this,Bn,O0).call(this)},me(this,md)))},_T=function(){_n(this,Bn,yT).call(this),_n(this,Bn,bT).call(this,_n(this,Bn,xT).call(this))},wT=function(){me(this,gh)!==void 0&&(Qf.clearTimeout(me(this,gh)),wt(this,gh,void 0))},ST=function(){me(this,vh)!==void 0&&(Qf.clearInterval(me(this,vh)),wt(this,vh,void 0))},MT=function(){const e=me(this,$s).getQueryCache().build(me(this,$s),this.options);if(e===me(this,An))return;const n=me(this,An);wt(this,An,e),wt(this,jy,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},Jj=function(e){Fi.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(me(this,ws))}),me(this,$s).getQueryCache().notify({query:me(this,An),type:"observerResultsUpdated"})})},Uj);function KW(t,e){return vo(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&vo(e.retryOnMount,t)===!1)}function eI(t,e){return KW(t,e)||t.state.data!==void 0&&ET(t,e,e.refetchOnMount)}function ET(t,e,n){if(vo(e.enabled,t)!==!1&&bd(e.staleTime,t)!=="static"){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&gP(t,e)}return!1}function tI(t,e,n,r){return(t!==e||vo(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&gP(t,n)}function gP(t,e){return vo(e.enabled,t)!==!1&&t.isStaleByTime(bd(e.staleTime,t))}function YW(t,e){return!hT(t.getCurrentResult(),e)}var zy,yl,ts,yh,xl,sd,jj,ZW=(jj=class extends Yj{constructor(e){super();Wt(this,xl);Wt(this,zy);Wt(this,yl);Wt(this,ts);Wt(this,yh);wt(this,zy,e.client),this.mutationId=e.mutationId,wt(this,ts,e.mutationCache),wt(this,yl,[]),this.state=e.state||QW(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){me(this,yl).includes(e)||(me(this,yl).push(e),this.clearGcTimeout(),me(this,ts).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){wt(this,yl,me(this,yl).filter(n=>n!==e)),this.scheduleGc(),me(this,ts).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){me(this,yl).length||(this.state.status==="pending"?this.scheduleGc():me(this,ts).remove(this))}continue(){var e;return((e=me(this,yh))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var o,a,l,c,d,f,m,y,x,S,_,w,A,T,C,O,N,D;const n=()=>{_n(this,xl,sd).call(this,{type:"continue"})},r={client:me(this,zy),meta:this.options.meta,mutationKey:this.options.mutationKey};wt(this,yh,Kj({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(F,V)=>{_n(this,xl,sd).call(this,{type:"failed",failureCount:F,error:V})},onPause:()=>{_n(this,xl,sd).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>me(this,ts).canRun(this)}));const i=this.state.status==="pending",s=!me(this,yh).canStart();try{if(i)n();else{_n(this,xl,sd).call(this,{type:"pending",variables:e,isPaused:s}),me(this,ts).config.onMutate&&await me(this,ts).config.onMutate(e,this,r);const V=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,e,r));V!==this.state.context&&_n(this,xl,sd).call(this,{type:"pending",context:V,variables:e,isPaused:s})}const F=await me(this,yh).start();return await((c=(l=me(this,ts).config).onSuccess)==null?void 0:c.call(l,F,e,this.state.context,this,r)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,F,e,this.state.context,r)),await((y=(m=me(this,ts).config).onSettled)==null?void 0:y.call(m,F,null,this.state.variables,this.state.context,this,r)),await((S=(x=this.options).onSettled)==null?void 0:S.call(x,F,null,e,this.state.context,r)),_n(this,xl,sd).call(this,{type:"success",data:F}),F}catch(F){try{await((w=(_=me(this,ts).config).onError)==null?void 0:w.call(_,F,e,this.state.context,this,r))}catch(V){Promise.reject(V)}try{await((T=(A=this.options).onError)==null?void 0:T.call(A,F,e,this.state.context,r))}catch(V){Promise.reject(V)}try{await((O=(C=me(this,ts).config).onSettled)==null?void 0:O.call(C,void 0,F,this.state.variables,this.state.context,this,r))}catch(V){Promise.reject(V)}try{await((D=(N=this.options).onSettled)==null?void 0:D.call(N,void 0,F,e,this.state.context,r))}catch(V){Promise.reject(V)}throw _n(this,xl,sd).call(this,{type:"error",error:F}),F}finally{me(this,ts).runNext(this)}}},zy=new WeakMap,yl=new WeakMap,ts=new WeakMap,yh=new WeakMap,xl=new WeakSet,sd=function(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Fi.batch(()=>{me(this,yl).forEach(r=>{r.onMutationUpdate(e)}),me(this,ts).notify({mutation:this,type:"updated",action:e})})},jj);function QW(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var kc,La,By,Fj,JW=(Fj=class extends Hy{constructor(e={}){super();Wt(this,kc);Wt(this,La);Wt(this,By);this.config=e,wt(this,kc,new Set),wt(this,La,new Map),wt(this,By,0)}build(e,n,r){const i=new ZW({client:e,mutationCache:this,mutationId:++cb(this,By)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){me(this,kc).add(e);const n=db(e);if(typeof n=="string"){const r=me(this,La).get(n);r?r.push(e):me(this,La).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(me(this,kc).delete(e)){const n=db(e);if(typeof n=="string"){const r=me(this,La).get(n);if(r)if(r.length>1){const i=r.indexOf(e);i!==-1&&r.splice(i,1)}else r[0]===e&&me(this,La).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=db(e);if(typeof n=="string"){const r=me(this,La).get(n),i=r==null?void 0:r.find(s=>s.state.status==="pending");return!i||i===e}else return!0}runNext(e){var r;const n=db(e);if(typeof n=="string"){const i=(r=me(this,La).get(n))==null?void 0:r.find(s=>s!==e&&s.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Fi.batch(()=>{me(this,kc).forEach(e=>{this.notify({type:"removed",mutation:e})}),me(this,kc).clear(),me(this,La).clear()})}getAll(){return Array.from(me(this,kc))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>qN(n,r))}findAll(e={}){return this.getAll().filter(n=>qN(e,n))}notify(e){Fi.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return Fi.batch(()=>Promise.all(e.map(n=>n.continue().catch(Xs))))}},kc=new WeakMap,La=new WeakMap,By=new WeakMap,Fj);function db(t){var e;return(e=t.options.scope)==null?void 0:e.id}var bl,zj,e8=(zj=class extends Hy{constructor(e={}){super();Wt(this,bl);this.config=e,wt(this,bl,new Map)}build(e,n,r){const i=n.queryKey,s=n.queryHash??pP(i,n);let o=this.get(s);return o||(o=new XW({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){me(this,bl).has(e.queryHash)||(me(this,bl).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=me(this,bl).get(e.queryHash);n&&(e.destroy(),n===e&&me(this,bl).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Fi.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return me(this,bl).get(e)}getAll(){return[...me(this,bl).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>XN(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>XN(e,r)):n}notify(e){Fi.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){Fi.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Fi.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},bl=new WeakMap,zj),Sr,gd,vd,hg,pg,yd,mg,gg,Bj,t8=(Bj=class{constructor(t={}){Wt(this,Sr);Wt(this,gd);Wt(this,vd);Wt(this,hg);Wt(this,pg);Wt(this,yd);Wt(this,mg);Wt(this,gg);wt(this,Sr,t.queryCache||new e8),wt(this,gd,t.mutationCache||new JW),wt(this,vd,t.defaultOptions||{}),wt(this,hg,new Map),wt(this,pg,new Map),wt(this,yd,0)}mount(){cb(this,yd)._++,me(this,yd)===1&&(wt(this,mg,hP.subscribe(async t=>{t&&(await this.resumePausedMutations(),me(this,Sr).onFocus())})),wt(this,gg,Q_.subscribe(async t=>{t&&(await this.resumePausedMutations(),me(this,Sr).onOnline())})))}unmount(){var t,e;cb(this,yd)._--,me(this,yd)===0&&((t=me(this,mg))==null||t.call(this),wt(this,mg,void 0),(e=me(this,gg))==null||e.call(this),wt(this,gg,void 0))}isFetching(t){return me(this,Sr).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return me(this,gd).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=me(this,Sr).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=me(this,Sr).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(bd(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return me(this,Sr).findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),i=me(this,Sr).get(r.queryHash),s=i==null?void 0:i.state.data,o=LW(e,s);if(o!==void 0)return me(this,Sr).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(t,e,n){return Fi.batch(()=>me(this,Sr).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=me(this,Sr).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=me(this,Sr);Fi.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=me(this,Sr);return Fi.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=Fi.batch(()=>me(this,Sr).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(Xs).catch(Xs)}invalidateQueries(t,e={}){return Fi.batch(()=>(me(this,Sr).findAll(t).forEach(n=>{n.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},r=Fi.batch(()=>me(this,Sr).findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(Xs)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(Xs)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=me(this,Sr).build(this,e);return n.isStaleByTime(bd(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Xs).catch(Xs)}fetchInfiniteQuery(t){return t._type="infinite",this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Xs).catch(Xs)}ensureInfiniteQueryData(t){return t._type="infinite",this.ensureQueryData(t)}resumePausedMutations(){return Q_.isOnline()?me(this,gd).resumePausedMutations():Promise.resolve()}getQueryCache(){return me(this,Sr)}getMutationCache(){return me(this,gd)}getDefaultOptions(){return me(this,vd)}setDefaultOptions(t){wt(this,vd,t)}setQueryDefaults(t,e){me(this,hg).set(ey(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...me(this,hg).values()],n={};return e.forEach(r=>{ty(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){me(this,pg).set(ey(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...me(this,pg).values()],n={};return e.forEach(r=>{ty(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...me(this,vd).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=pP(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===mP&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...me(this,vd).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){me(this,Sr).clear(),me(this,gd).clear()}},Sr=new WeakMap,gd=new WeakMap,vd=new WeakMap,hg=new WeakMap,pg=new WeakMap,yd=new WeakMap,mg=new WeakMap,gg=new WeakMap,Bj),eF=R.createContext(void 0),$h=t=>{const e=R.useContext(eF);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},n8=({client:t,children:e})=>(R.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),v.jsx(eF.Provider,{value:t,children:e})),tF=R.createContext(!1),r8=()=>R.useContext(tF);tF.Provider;function i8(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var s8=R.createContext(i8()),o8=()=>R.useContext(s8),a8=(t,e,n)=>{const r=n!=null&&n.state.error&&typeof t.throwOnError=="function"?Xj(t.throwOnError,[n.state.error,n]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},l8=t=>{R.useEffect(()=>{t.clearReset()},[t])},c8=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||Xj(n,[t.error,r])),u8=t=>{if(t.suspense){const n=i=>i==="static"?i:Math.max(i??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...i)=>n(r(...i)):n(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},d8=(t,e)=>t.isLoading&&t.isFetching&&!e,f8=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,nI=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function h8(t,e,n){var y,x,S,_;const r=r8(),i=o8(),s=$h(),o=s.defaultQueryOptions(t);(x=(y=s.getDefaultOptions().queries)==null?void 0:y._experimental_beforeQuery)==null||x.call(y,o);const a=s.getQueryCache().get(o.queryHash),l=t.subscribed!==!1;o._optimisticResults=r?"isRestoring":l?"optimistic":void 0,u8(o),a8(o,i,a),l8(i);const c=!s.getQueryCache().get(o.queryHash),[d]=R.useState(()=>new e(s,o)),f=d.getOptimisticResult(o),m=!r&&l;if(R.useSyncExternalStore(R.useCallback(w=>{const A=m?d.subscribe(Fi.batchCalls(w)):Xs;return d.updateResult(),A},[d,m]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),R.useEffect(()=>{d.setOptions(o)},[o,d]),f8(o,f))throw nI(o,d,i);if(c8({result:f,errorResetBoundary:i,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw f.error;if((_=(S=s.getDefaultOptions().queries)==null?void 0:S._experimental_afterQuery)==null||_.call(S,o,f),o.experimental_prefetchInRender&&!ny.isServer()&&d8(f,r)){const w=c?nI(o,d,i):a==null?void 0:a.promise;w==null||w.catch(Xs).finally(()=>{d.updateResult()})}return o.notifyOnChangeProps?f:d.trackResult(f)}function ls(t,e){return h8(t,qW)}/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const p8=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),nF=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim();/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/var m8={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const g8=R.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:o,...a},l)=>R.createElement("svg",{ref:l,...m8,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:nF("lucide",i),...a},[...o.map(([c,d])=>R.createElement(c,d)),...Array.isArray(s)?s:[s]]));/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const yt=(t,e)=>{const n=R.forwardRef(({className:r,...i},s)=>R.createElement(g8,{ref:s,iconNode:e,className:nF(`lucide-${p8(t)}`,r),...i}));return n.displayName=`${t}`,n};/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const ry=yt("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const rI=yt("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const v8=yt("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const AT=yt("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const qc=yt("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const y8=yt("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const TT=yt("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const H1=yt("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const x8=yt("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Go=yt("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const b8=yt("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const _8=yt("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const rF=yt("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const w8=yt("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const S8=yt("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const M8=yt("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const E8=yt("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const A8=yt("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const iF=yt("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const T8=yt("Command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const CT=yt("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const C8=yt("Construction",[["rect",{x:"2",y:"6",width:"20",height:"8",rx:"1",key:"1estib"}],["path",{d:"M17 14v7",key:"7m2elx"}],["path",{d:"M7 14v7",key:"1cm7wv"}],["path",{d:"M17 3v3",key:"1v4jwn"}],["path",{d:"M7 3v3",key:"7o6guu"}],["path",{d:"M10 14 2.3 6.3",key:"1023jk"}],["path",{d:"m14 6 7.7 7.7",key:"1s8pl2"}],["path",{d:"m8 6 8 8",key:"hl96qh"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const J_=yt("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const El=yt("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const P8=yt("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const vg=yt("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const iy=yt("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const iI=yt("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const PT=yt("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const R8=yt("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const N8=yt("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const I8=yt("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const k8=yt("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const tE=yt("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const sI=yt("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const O8=yt("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const L8=yt("Laptop",[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const V1=yt("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const D8=yt("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const U8=yt("LifeBuoy",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.93 4.93 4.24 4.24",key:"1ymg45"}],["path",{d:"m14.83 9.17 4.24-4.24",key:"1cb5xl"}],["path",{d:"m14.83 14.83 4.24 4.24",key:"q42g0n"}],["path",{d:"m9.17 14.83-4.24 4.24",key:"bqpfvv"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const j8=yt("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const F8=yt("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const vP=yt("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const z8=yt("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const B8=yt("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const sF=yt("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const H8=yt("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const V8=yt("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const G8=yt("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const W8=yt("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const RT=yt("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const NT=yt("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const $8=yt("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const X8=yt("Puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const B0=yt("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const q8=yt("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const K8=yt("Scroll",[["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const yP=yt("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Y8=yt("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const xP=yt("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Z8=yt("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Q8=yt("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const sy=yt("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Vm=yt("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const oF=yt("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const J8=yt("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const aF=yt("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const IT=yt("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const yg=yt("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const e9=yt("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const lF=yt("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const ew=yt("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Bc=yt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
|
||
* @license lucide-react v0.460.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const xh=yt("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),kT=[{id:"dashboard",label:"Zentrale",hint:"System- & Stack-Status",icon:D8},{id:"models",label:"Modell-Manager",hint:"Verwalten, laden & Gateway-Routing",icon:TT},{id:"memory",label:"Gedächtnis",hint:"Geteiltes Memory verwalten",icon:H1},{id:"connect",label:"Verbinden",hint:"IDE-/Agent-Configs erzeugen",icon:RT},{id:"agent",label:"Hermes",hint:"Agent-Status & Verdrahtung",icon:qc},{id:"terminal",label:"Terminal",hint:"Interaktives Hermes-Agent-Terminal",icon:oF},{id:"voice",label:"Sprechen",hint:"Mit Hermes per Sprache reden (3D-Avatar)",icon:sF},{id:"guide",label:"Anleitung",hint:"Einrichten & Vibe-Coding",icon:M8}];var oI=1,t9=.9,n9=.8,r9=.17,nE=.1,rE=.999,i9=.9999,s9=.99,o9=/[\\\/_+.#"@\[\(\{&]/,a9=/[\\\/_+.#"@\[\(\{&]/g,l9=/[\s-]/,cF=/[\s-]/g;function OT(t,e,n,r,i,s,o){if(s===e.length)return i===t.length?oI:s9;var a=`${i},${s}`;if(o[a]!==void 0)return o[a];for(var l=r.charAt(s),c=n.indexOf(l,i),d=0,f,m,y,x;c>=0;)f=OT(t,e,n,r,c+1,s+1,o),f>d&&(c===i?f*=oI:o9.test(t.charAt(c-1))?(f*=n9,y=t.slice(i,c-1).match(a9),y&&i>0&&(f*=Math.pow(rE,y.length))):l9.test(t.charAt(c-1))?(f*=t9,x=t.slice(i,c-1).match(cF),x&&i>0&&(f*=Math.pow(rE,x.length))):(f*=r9,i>0&&(f*=Math.pow(rE,c-i))),t.charAt(c)!==e.charAt(s)&&(f*=i9)),(f<nE&&n.charAt(c-1)===r.charAt(s+1)||r.charAt(s+1)===r.charAt(s)&&n.charAt(c-1)!==r.charAt(s))&&(m=OT(t,e,n,r,c+1,s+2,o),m*nE>f&&(f=m*nE)),f>d&&(d=f),c=n.indexOf(l,c+1);return o[a]=d,d}function aI(t){return t.toLowerCase().replace(cF," ")}function c9(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,OT(t,e,aI(t),aI(e),0,0,{})}function _d(t,e,{checkForDefaultPrevented:n=!0}={}){return function(i){if(t==null||t(i),n===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function lI(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function xg(...t){return e=>{let n=!1;const r=t.map(i=>{const s=lI(i,e);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i<r.length;i++){const s=r[i];typeof s=="function"?s():lI(t[i],null)}}}}function Xh(...t){return R.useCallback(xg(...t),t)}function u9(t,e=[]){let n=[];function r(s,o){const a=R.createContext(o);a.displayName=s+"Context";const l=n.length;n=[...n,o];const c=f=>{var w;const{scope:m,children:y,...x}=f,S=((w=m==null?void 0:m[t])==null?void 0:w[l])||a,_=R.useMemo(()=>x,Object.values(x));return v.jsx(S.Provider,{value:_,children:y})};c.displayName=s+"Provider";function d(f,m){var S;const y=((S=m==null?void 0:m[t])==null?void 0:S[l])||a,x=R.useContext(y);if(x)return x;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[c,d]}const i=()=>{const s=n.map(o=>R.createContext(o));return function(a){const l=(a==null?void 0:a[t])||s;return R.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return i.scopeName=t,[r,d9(i,...e)]}function d9(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(s)[`__scope${c}`];return{...a,...f}},{});return R.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var oy=globalThis!=null&&globalThis.document?R.useLayoutEffect:()=>{},f9=B1[" useId ".trim().toString()]||(()=>{}),h9=0;function Hc(t){const[e,n]=R.useState(f9());return oy(()=>{n(r=>r??String(h9++))},[t]),e?`radix-${e}`:""}var p9=B1[" useInsertionEffect ".trim().toString()]||oy;function m9({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[i,s,o]=g9({defaultProp:e,onChange:n}),a=t!==void 0,l=a?t:i;{const d=R.useRef(t!==void 0);R.useEffect(()=>{const f=d.current;f!==a&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=a},[a,r])}const c=R.useCallback(d=>{var f;if(a){const m=v9(d)?d(t):d;m!==t&&((f=o.current)==null||f.call(o,m))}else s(d)},[a,t,s,o]);return[l,c]}function g9({defaultProp:t,onChange:e}){const[n,r]=R.useState(t),i=R.useRef(n),s=R.useRef(e);return p9(()=>{s.current=e},[e]),R.useEffect(()=>{var o;i.current!==n&&((o=s.current)==null||o.call(s,n),i.current=n)},[n,i]),[n,r,s]}function v9(t){return typeof t=="function"}var G1=Vj();function uF(t){const e=R.forwardRef((n,r)=>{let{children:i,...s}=n,o=null,a=!1;const l=[];cI(i)&&typeof fb=="function"&&(i=fb(i._payload)),R.Children.forEach(i,m=>{var y;if(w9(m)){a=!0;const x=m;let S="child"in x.props?x.props.child:x.props.children;cI(S)&&typeof fb=="function"&&(S=fb(S._payload)),o=x9(x,S),l.push((y=o==null?void 0:o.props)==null?void 0:y.children)}else l.push(m)}),o?o=R.cloneElement(o,void 0,l):!a&&R.Children.count(i)===1&&R.isValidElement(i)&&(o=i);const c=o?_9(o):void 0,d=Xh(r,c);if(!o){if(i||i===0)throw new Error(a?A9(t):E9(t));return i}const f=b9(s,o.props??{});return o.type!==R.Fragment&&(f.ref=r?d:c),R.cloneElement(o,f)});return e.displayName=`${t}.Slot`,e}var y9=Symbol.for("radix.slottable"),x9=(t,e)=>{if("child"in t.props){const n=t.props.child;return R.isValidElement(n)?R.cloneElement(n,void 0,t.props.children(n.props.children)):null}return R.isValidElement(e)?e:null};function b9(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function _9(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function w9(t){return R.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===y9}var S9=Symbol.for("react.lazy");function cI(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===S9&&"_payload"in t&&M9(t._payload)}function M9(t){return typeof t=="object"&&t!==null&&"then"in t}var E9=t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,A9=t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,fb=B1[" use ".trim().toString()],T9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Vi=T9.reduce((t,e)=>{const n=uF(`Primitive.${e}`),r=R.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),v.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function C9(t,e){t&&G1.flushSync(()=>t.dispatchEvent(e))}function ay(t){const e=R.useRef(t);return R.useEffect(()=>{e.current=t}),R.useMemo(()=>((...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)}),[])}function P9(t,e=globalThis==null?void 0:globalThis.document){const n=ay(t);R.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var R9="DismissableLayer",LT="dismissableLayer.update",N9="dismissableLayer.pointerDownOutside",I9="dismissableLayer.focusOutside",uI,bP=R.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),dF=R.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:a,onDismiss:l,...c}=t,d=R.useContext(bP),[f,m]=R.useState(null),y=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=R.useState({}),S=Xh(e,V=>m(V)),_=Array.from(d.layers),[w]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),A=_.indexOf(w),T=f?_.indexOf(f):-1,C=d.layersWithOutsidePointerEventsDisabled.size>0,O=T>=A,N=R.useRef(!1),D=D9(V=>{const k=V.target;if(!(k instanceof Node))return;const j=[...d.branches].some(H=>H.contains(k));!O||j||(s==null||s(V),a==null||a(V),V.defaultPrevented||l==null||l())},{ownerDocument:y,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:N,dismissableSurfaces:d.dismissableSurfaces}),F=U9(V=>{if(r&&N.current)return;const k=V.target;[...d.branches].some(H=>H.contains(k))||(o==null||o(V),a==null||a(V),V.defaultPrevented||l==null||l())},y);return P9(V=>{T===d.layers.size-1&&(i==null||i(V),!V.defaultPrevented&&l&&(V.preventDefault(),l()))},y),R.useEffect(()=>{if(f)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(uI=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),dI(),()=>{n&&(d.layersWithOutsidePointerEventsDisabled.delete(f),d.layersWithOutsidePointerEventsDisabled.size===0&&(y.body.style.pointerEvents=uI))}},[f,y,n,d]),R.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),dI())},[f,d]),R.useEffect(()=>{const V=()=>x({});return document.addEventListener(LT,V),()=>document.removeEventListener(LT,V)},[]),v.jsx(Vi.div,{...c,ref:S,style:{pointerEvents:C?O?"auto":"none":void 0,...t.style},onFocusCapture:_d(t.onFocusCapture,F.onFocusCapture),onBlurCapture:_d(t.onBlurCapture,F.onBlurCapture),onPointerDownCapture:_d(t.onPointerDownCapture,D.onPointerDownCapture)})});dF.displayName=R9;var k9="DismissableLayerBranch",O9=R.forwardRef((t,e)=>{const n=R.useContext(bP),r=R.useRef(null),i=Xh(e,r);return R.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),v.jsx(Vi.div,{...t,ref:i})});O9.displayName=k9;function L9(){const t=R.useContext(bP),[e,n]=R.useState(null);return R.useEffect(()=>{if(e)return t.dismissableSurfaces.add(e),()=>{t.dismissableSurfaces.delete(e)}},[e,t.dismissableSurfaces]),n}function D9(t,e){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:s}=e,o=ay(t),a=R.useRef(!1),l=R.useRef(!1),c=R.useRef(new Map),d=R.useRef(()=>{});return R.useEffect(()=>{function f(){l.current=!1,i.current=!1,c.current.clear()}function m(){return Array.from(c.current.values()).some(Boolean)}function y(A){if(!l.current)return;const T=A.target;T instanceof Node&&[...s].some(O=>O.contains(T))||c.current.set(A.type,!0),A.type==="click"&&window.setTimeout(()=>{l.current&&d.current()},0)}function x(A){l.current&&c.current.set(A.type,!1)}const S=A=>{if(A.target&&!a.current){let T=function(){n.removeEventListener("click",d.current);const O=m();f(),O||fF(N9,o,C,{discrete:!0})};const C={originalEvent:A};l.current=!0,i.current=r&&A.button===0,c.current.clear(),!r||A.button!==0?T():(n.removeEventListener("click",d.current),d.current=T,n.addEventListener("click",d.current,{once:!0}))}else n.removeEventListener("click",d.current),f();a.current=!1},_=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const A of _)n.addEventListener(A,y,!0),n.addEventListener(A,x);const w=window.setTimeout(()=>{n.addEventListener("pointerdown",S)},0);return()=>{window.clearTimeout(w),n.removeEventListener("pointerdown",S),n.removeEventListener("click",d.current);for(const A of _)n.removeEventListener(A,y,!0),n.removeEventListener(A,x)}},[n,o,r,i,s]),{onPointerDownCapture:()=>a.current=!0}}function U9(t,e=globalThis==null?void 0:globalThis.document){const n=ay(t),r=R.useRef(!1);return R.useEffect(()=>{const i=s=>{s.target&&!r.current&&fF(I9,n,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function dI(){const t=new CustomEvent(LT);document.dispatchEvent(t)}function fF(t,e,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?C9(i,s):i.dispatchEvent(s)}var iE="focusScope.autoFocusOnMount",sE="focusScope.autoFocusOnUnmount",fI={bubbles:!1,cancelable:!0},j9="FocusScope",hF=R.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=t,[a,l]=R.useState(null),c=ay(i),d=ay(s),f=R.useRef(null),m=Xh(e,S=>l(S)),y=R.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;R.useEffect(()=>{if(r){let S=function(T){if(y.paused||!a)return;const C=T.target;a.contains(C)?f.current=C:od(f.current,{select:!0})},_=function(T){if(y.paused||!a)return;const C=T.relatedTarget;C!==null&&(a.contains(C)||od(f.current,{select:!0}))},w=function(T){if(document.activeElement===document.body)for(const O of T)O.removedNodes.length>0&&od(a)};document.addEventListener("focusin",S),document.addEventListener("focusout",_);const A=new MutationObserver(w);return a&&A.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",_),A.disconnect()}}},[r,a,y.paused]),R.useEffect(()=>{if(a){pI.add(y);const S=document.activeElement;if(!a.contains(S)){const w=new CustomEvent(iE,fI);a.addEventListener(iE,c),a.dispatchEvent(w),w.defaultPrevented||(F9(G9(pF(a)),{select:!0}),document.activeElement===S&&od(a))}return()=>{a.removeEventListener(iE,c),setTimeout(()=>{const w=new CustomEvent(sE,fI);a.addEventListener(sE,d),a.dispatchEvent(w),w.defaultPrevented||od(S??document.body,{select:!0}),a.removeEventListener(sE,d),pI.remove(y)},0)}}},[a,c,d,y]);const x=R.useCallback(S=>{if(!n&&!r||y.paused)return;const _=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,w=document.activeElement;if(_&&w){const A=S.currentTarget,[T,C]=z9(A);T&&C?!S.shiftKey&&w===C?(S.preventDefault(),n&&od(T,{select:!0})):S.shiftKey&&w===T&&(S.preventDefault(),n&&od(C,{select:!0})):w===A&&S.preventDefault()}},[n,r,y.paused]);return v.jsx(Vi.div,{tabIndex:-1,...o,ref:m,onKeyDown:x})});hF.displayName=j9;function F9(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(od(r,{select:e}),document.activeElement!==n)return}function z9(t){const e=pF(t),n=hI(e,t),r=hI(e.reverse(),t);return[n,r]}function pF(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function hI(t,e){for(const n of t)if(!B9(n,{upTo:e}))return n}function B9(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function H9(t){return t instanceof HTMLInputElement&&"select"in t}function od(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&H9(t)&&e&&t.select()}}var pI=V9();function V9(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=mI(t,e),t.unshift(e)},remove(e){var n;t=mI(t,e),(n=t[0])==null||n.resume()}}}function mI(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function G9(t){return t.filter(e=>e.tagName!=="A")}var W9="Portal",mF=R.forwardRef((t,e)=>{var a;const{container:n,...r}=t,[i,s]=R.useState(!1);oy(()=>s(!0),[]);const o=n||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?G1.createPortal(v.jsx(Vi.div,{...r,ref:e}),o):null});mF.displayName=W9;function $9(t,e){return R.useReducer((n,r)=>e[n][r]??n,t)}var W1=t=>{const{present:e,children:n}=t,r=X9(e),i=typeof n=="function"?n({present:r.isPresent}):R.Children.only(n),s=q9(r.ref,K9(i));return typeof n=="function"||r.isPresent?R.cloneElement(i,{ref:s}):null};W1.displayName="Presence";function X9(t){const[e,n]=R.useState(),r=R.useRef(null),i=R.useRef(t),s=R.useRef("none"),o=t?"mounted":"unmounted",[a,l]=$9(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return R.useEffect(()=>{const c=hb(r.current);s.current=a==="mounted"?c:"none"},[a]),oy(()=>{const c=r.current,d=i.current;if(d!==t){const m=s.current,y=hb(c);t?l("MOUNT"):y==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(d&&m!==y?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),oy(()=>{if(e){let c;const d=e.ownerDocument.defaultView??window,f=y=>{const S=hb(r.current).includes(CSS.escape(y.animationName));if(y.target===e&&S&&(l("ANIMATION_END"),!i.current)){const _=e.style.animationFillMode;e.style.animationFillMode="forwards",c=d.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=_)})}},m=y=>{y.target===e&&(s.current=hb(r.current))};return e.addEventListener("animationstart",m),e.addEventListener("animationcancel",f),e.addEventListener("animationend",f),()=>{d.clearTimeout(c),e.removeEventListener("animationstart",m),e.removeEventListener("animationcancel",f),e.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:R.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function gI(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function q9(...t){const e=R.useRef(t);return e.current=t,R.useCallback(n=>{const r=e.current;let i=!1;const s=r.map(o=>{const a=gI(o,n);return!i&&typeof a=="function"&&(i=!0),a});if(i)return()=>{for(let o=0;o<s.length;o++){const a=s[o];typeof a=="function"?a():gI(r[o],null)}}},[])}function hb(t){return(t==null?void 0:t.animationName)||"none"}function K9(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var pb=0,dl=null;function Y9(){R.useEffect(()=>{dl||(dl={start:vI(),end:vI()});const{start:t,end:e}=dl;return document.body.firstElementChild!==t&&document.body.insertAdjacentElement("afterbegin",t),document.body.lastElementChild!==e&&document.body.insertAdjacentElement("beforeend",e),pb++,()=>{pb===1&&(dl==null||dl.start.remove(),dl==null||dl.end.remove(),dl=null),pb=Math.max(0,pb-1)}},[])}function vI(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var _l=function(){return _l=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},_l.apply(this,arguments)};function gF(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function Z9(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||Array.prototype.slice.call(e))}var D_="right-scroll-bar-position",U_="width-before-scroll-bar",Q9="with-scroll-bars-hidden",J9="--removed-body-scroll-bar-size";function oE(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function e$(t,e){var n=R.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=e,n.facade}var t$=typeof window<"u"?R.useLayoutEffect:R.useEffect,yI=new WeakMap;function n$(t,e){var n=e$(null,function(r){return t.forEach(function(i){return oE(i,r)})});return t$(function(){var r=yI.get(n);if(r){var i=new Set(r),s=new Set(t),o=n.current;i.forEach(function(a){s.has(a)||oE(a,null)}),s.forEach(function(a){i.has(a)||oE(a,o)})}yI.set(n,t)},[t]),n}function r$(t){return t}function i$(t,e){e===void 0&&(e=r$);var n=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(s){var o=e(s,r);return n.push(o),function(){n=n.filter(function(a){return a!==o})}},assignSyncMedium:function(s){for(r=!0;n.length;){var o=n;n=[],o.forEach(s)}n={push:function(a){return s(a)},filter:function(){return n}}},assignMedium:function(s){r=!0;var o=[];if(n.length){var a=n;n=[],a.forEach(s),o=n}var l=function(){var d=o;o=[],d.forEach(s)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(d){o.push(d),c()},filter:function(d){return o=o.filter(d),n}}}};return i}function s$(t){t===void 0&&(t={});var e=i$(null);return e.options=_l({async:!0,ssr:!1},t),e}var vF=function(t){var e=t.sideCar,n=gF(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=e.read();if(!r)throw new Error("Sidecar medium not found");return R.createElement(r,_l({},n))};vF.isSideCarExport=!0;function o$(t,e){return t.useMedium(e),vF}var yF=s$(),aE=function(){},$1=R.forwardRef(function(t,e){var n=R.useRef(null),r=R.useState({onScrollCapture:aE,onWheelCapture:aE,onTouchMoveCapture:aE}),i=r[0],s=r[1],o=t.forwardProps,a=t.children,l=t.className,c=t.removeScrollBar,d=t.enabled,f=t.shards,m=t.sideCar,y=t.noRelative,x=t.noIsolation,S=t.inert,_=t.allowPinchZoom,w=t.as,A=w===void 0?"div":w,T=t.gapMode,C=gF(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),O=m,N=n$([n,e]),D=_l(_l({},C),i);return R.createElement(R.Fragment,null,d&&R.createElement(O,{sideCar:yF,removeScrollBar:c,shards:f,noRelative:y,noIsolation:x,inert:S,setCallbacks:s,allowPinchZoom:!!_,lockRef:n,gapMode:T}),o?R.cloneElement(R.Children.only(a),_l(_l({},D),{ref:N})):R.createElement(A,_l({},D,{className:l,ref:N}),a))});$1.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};$1.classNames={fullWidth:U_,zeroRight:D_};var a$=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function l$(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=a$();return e&&t.setAttribute("nonce",e),t}function c$(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function u$(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var d$=function(){var t=0,e=null;return{add:function(n){t==0&&(e=l$())&&(c$(e,n),u$(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},f$=function(){var t=d$();return function(e,n){R.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},xF=function(){var t=f$(),e=function(n){var r=n.styles,i=n.dynamic;return t(r,i),null};return e},h$={left:0,top:0,right:0,gap:0},lE=function(t){return parseInt(t||"",10)||0},p$=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],i=e[t==="padding"?"paddingRight":"marginRight"];return[lE(n),lE(r),lE(i)]},m$=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return h$;var e=p$(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},g$=xF(),Ym="data-scroll-locked",v$=function(t,e,n,r){var i=t.left,s=t.top,o=t.right,a=t.gap;return n===void 0&&(n="margin"),`
|
||
.`.concat(Q9,` {
|
||
overflow: hidden `).concat(r,`;
|
||
padding-right: `).concat(a,"px ").concat(r,`;
|
||
}
|
||
body[`).concat(Ym,`] {
|
||
overflow: hidden `).concat(r,`;
|
||
overscroll-behavior: contain;
|
||
`).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&`
|
||
padding-left: `.concat(i,`px;
|
||
padding-top: `).concat(s,`px;
|
||
padding-right: `).concat(o,`px;
|
||
margin-left:0;
|
||
margin-top:0;
|
||
margin-right: `).concat(a,"px ").concat(r,`;
|
||
`),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
|
||
}
|
||
|
||
.`).concat(D_,` {
|
||
right: `).concat(a,"px ").concat(r,`;
|
||
}
|
||
|
||
.`).concat(U_,` {
|
||
margin-right: `).concat(a,"px ").concat(r,`;
|
||
}
|
||
|
||
.`).concat(D_," .").concat(D_,` {
|
||
right: 0 `).concat(r,`;
|
||
}
|
||
|
||
.`).concat(U_," .").concat(U_,` {
|
||
margin-right: 0 `).concat(r,`;
|
||
}
|
||
|
||
body[`).concat(Ym,`] {
|
||
`).concat(J9,": ").concat(a,`px;
|
||
}
|
||
`)},xI=function(){var t=parseInt(document.body.getAttribute(Ym)||"0",10);return isFinite(t)?t:0},y$=function(){R.useEffect(function(){return document.body.setAttribute(Ym,(xI()+1).toString()),function(){var t=xI()-1;t<=0?document.body.removeAttribute(Ym):document.body.setAttribute(Ym,t.toString())}},[])},x$=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;y$();var s=R.useMemo(function(){return m$(i)},[i]);return R.createElement(g$,{styles:v$(s,!e,i,n?"":"!important")})},DT=!1;if(typeof window<"u")try{var mb=Object.defineProperty({},"passive",{get:function(){return DT=!0,!0}});window.addEventListener("test",mb,mb),window.removeEventListener("test",mb,mb)}catch{DT=!1}var tm=DT?{passive:!1}:!1,b$=function(t){return t.tagName==="TEXTAREA"},bF=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!b$(t)&&n[e]==="visible")},_$=function(t){return bF(t,"overflowY")},w$=function(t){return bF(t,"overflowX")},bI=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=_F(t,r);if(i){var s=wF(t,r),o=s[1],a=s[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},S$=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},M$=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},_F=function(t,e){return t==="v"?_$(e):w$(e)},wF=function(t,e){return t==="v"?S$(e):M$(e)},E$=function(t,e){return t==="h"&&e==="rtl"?-1:1},A$=function(t,e,n,r,i){var s=E$(t,window.getComputedStyle(e).direction),o=s*r,a=n.target,l=e.contains(a),c=!1,d=o>0,f=0,m=0;do{if(!a)break;var y=wF(t,a),x=y[0],S=y[1],_=y[2],w=S-_-s*x;(x||w)&&_F(t,a)&&(f+=w,m+=x);var A=a.parentNode;a=A&&A.nodeType===Node.DOCUMENT_FRAGMENT_NODE?A.host:A}while(!l&&a!==document.body||l&&(e.contains(a)||e===a));return(d&&Math.abs(f)<1||!d&&Math.abs(m)<1)&&(c=!0),c},gb=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},_I=function(t){return[t.deltaX,t.deltaY]},wI=function(t){return t&&"current"in t?t.current:t},T$=function(t,e){return t[0]===e[0]&&t[1]===e[1]},C$=function(t){return`
|
||
.block-interactivity-`.concat(t,` {pointer-events: none;}
|
||
.allow-interactivity-`).concat(t,` {pointer-events: all;}
|
||
`)},P$=0,nm=[];function R$(t){var e=R.useRef([]),n=R.useRef([0,0]),r=R.useRef(),i=R.useState(P$++)[0],s=R.useState(xF)[0],o=R.useRef(t);R.useEffect(function(){o.current=t},[t]),R.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var S=Z9([t.lockRef.current],(t.shards||[]).map(wI),!0).filter(Boolean);return S.forEach(function(_){return _.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),S.forEach(function(_){return _.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var a=R.useCallback(function(S,_){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!o.current.allowPinchZoom;var w=gb(S),A=n.current,T="deltaX"in S?S.deltaX:A[0]-w[0],C="deltaY"in S?S.deltaY:A[1]-w[1],O,N=S.target,D=Math.abs(T)>Math.abs(C)?"h":"v";if("touches"in S&&D==="h"&&N.type==="range")return!1;var F=window.getSelection(),V=F&&F.anchorNode,k=V?V===N||V.contains(N):!1;if(k)return!1;var j=bI(D,N);if(!j)return!0;if(j?O=D:(O=D==="v"?"h":"v",j=bI(D,N)),!j)return!1;if(!r.current&&"changedTouches"in S&&(T||C)&&(r.current=O),!O)return!0;var H=r.current||O;return A$(H,_,S,H==="h"?T:C)},[]),l=R.useCallback(function(S){var _=S;if(!(!nm.length||nm[nm.length-1]!==s)){var w="deltaY"in _?_I(_):gb(_),A=e.current.filter(function(O){return O.name===_.type&&(O.target===_.target||_.target===O.shadowParent)&&T$(O.delta,w)})[0];if(A&&A.should){_.cancelable&&_.preventDefault();return}if(!A){var T=(o.current.shards||[]).map(wI).filter(Boolean).filter(function(O){return O.contains(_.target)}),C=T.length>0?a(_,T[0]):!o.current.noIsolation;C&&_.cancelable&&_.preventDefault()}}},[]),c=R.useCallback(function(S,_,w,A){var T={name:S,delta:_,target:w,should:A,shadowParent:N$(w)};e.current.push(T),setTimeout(function(){e.current=e.current.filter(function(C){return C!==T})},1)},[]),d=R.useCallback(function(S){n.current=gb(S),r.current=void 0},[]),f=R.useCallback(function(S){c(S.type,_I(S),S.target,a(S,t.lockRef.current))},[]),m=R.useCallback(function(S){c(S.type,gb(S),S.target,a(S,t.lockRef.current))},[]);R.useEffect(function(){return nm.push(s),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",l,tm),document.addEventListener("touchmove",l,tm),document.addEventListener("touchstart",d,tm),function(){nm=nm.filter(function(S){return S!==s}),document.removeEventListener("wheel",l,tm),document.removeEventListener("touchmove",l,tm),document.removeEventListener("touchstart",d,tm)}},[]);var y=t.removeScrollBar,x=t.inert;return R.createElement(R.Fragment,null,x?R.createElement(s,{styles:C$(i)}):null,y?R.createElement(x$,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function N$(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const I$=o$(yF,R$);var SF=R.forwardRef(function(t,e){return R.createElement($1,_l({},t,{ref:e,sideCar:I$}))});SF.classNames=$1.classNames;var k$=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},rm=new WeakMap,vb=new WeakMap,yb={},cE=0,MF=function(t){return t&&(t.host||MF(t.parentNode))},O$=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=MF(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},L$=function(t,e,n,r){var i=O$(e,Array.isArray(t)?t:[t]);yb[n]||(yb[n]=new WeakMap);var s=yb[n],o=[],a=new Set,l=new Set(i),c=function(f){!f||a.has(f)||(a.add(f),c(f.parentNode))};i.forEach(c);var d=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(m){if(a.has(m))d(m);else try{var y=m.getAttribute(r),x=y!==null&&y!=="false",S=(rm.get(m)||0)+1,_=(s.get(m)||0)+1;rm.set(m,S),s.set(m,_),o.push(m),S===1&&x&&vb.set(m,!0),_===1&&m.setAttribute(n,"true"),x||m.setAttribute(r,"true")}catch(w){console.error("aria-hidden: cannot operate on ",m,w)}})};return d(e),a.clear(),cE++,function(){o.forEach(function(f){var m=rm.get(f)-1,y=s.get(f)-1;rm.set(f,m),s.set(f,y),m||(vb.has(f)||f.removeAttribute(r),vb.delete(f)),y||f.removeAttribute(n)}),cE--,cE||(rm=new WeakMap,rm=new WeakMap,vb=new WeakMap,yb={})}},D$=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=k$(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),L$(r,i,n,"aria-hidden")):function(){return null}},X1="Dialog",[EF]=u9(X1),[U$,Wa]=EF(X1),AF=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!0}=t,a=R.useRef(null),l=R.useRef(null),[c,d]=m9({prop:r,defaultProp:i??!1,onChange:s,caller:X1});return v.jsx(U$,{scope:e,triggerRef:a,contentRef:l,contentId:Hc(),titleId:Hc(),descriptionId:Hc(),open:c,onOpenChange:d,onOpenToggle:R.useCallback(()=>d(f=>!f),[d]),modal:o,children:n})};AF.displayName=X1;var TF="DialogTrigger",j$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Wa(TF,n),s=Xh(e,i.triggerRef);return v.jsx(Vi.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":wP(i.open),...r,ref:s,onClick:_d(t.onClick,i.onOpenToggle)})});j$.displayName=TF;var _P="DialogPortal",[F$,CF]=EF(_P,{forceMount:void 0}),PF=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:i}=t,s=Wa(_P,e);return v.jsx(F$,{scope:e,forceMount:n,children:R.Children.map(r,o=>v.jsx(W1,{present:n||s.open,children:v.jsx(mF,{asChild:!0,container:i,children:o})}))})};PF.displayName=_P;var tw="DialogOverlay",RF=R.forwardRef((t,e)=>{const n=CF(tw,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=Wa(tw,t.__scopeDialog);return s.modal?v.jsx(W1,{present:r||s.open,children:v.jsx(B$,{...i,ref:e})}):null});RF.displayName=tw;var z$=uF("DialogOverlay.RemoveScroll"),B$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Wa(tw,n),s=L9(),o=Xh(e,s);return v.jsx(SF,{as:z$,allowPinchZoom:!0,shards:[i.contentRef],children:v.jsx(Vi.div,{"data-state":wP(i.open),...r,ref:o,style:{pointerEvents:"auto",...r.style}})})}),bg="DialogContent",NF=R.forwardRef((t,e)=>{const n=CF(bg,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=Wa(bg,t.__scopeDialog);return v.jsx(W1,{present:r||s.open,children:s.modal?v.jsx(H$,{...i,ref:e}):v.jsx(V$,{...i,ref:e})})});NF.displayName=bg;var H$=R.forwardRef((t,e)=>{const n=Wa(bg,t.__scopeDialog),r=R.useRef(null),i=Xh(e,n.contentRef,r);return R.useEffect(()=>{const s=r.current;if(s)return D$(s)},[]),v.jsx(IF,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:_d(t.onCloseAutoFocus,s=>{var o;s.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:_d(t.onPointerDownOutside,s=>{const o=s.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&s.preventDefault()}),onFocusOutside:_d(t.onFocusOutside,s=>s.preventDefault())})}),V$=R.forwardRef((t,e)=>{const n=Wa(bg,t.__scopeDialog),r=R.useRef(!1),i=R.useRef(!1);return v.jsx(IF,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=t.onCloseAutoFocus)==null||o.call(t,s),s.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var l,c;(l=t.onInteractOutside)==null||l.call(t,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=s.target;((c=n.triggerRef.current)==null?void 0:c.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),IF=R.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,...o}=t,a=Wa(bg,n);return Y9(),v.jsx(v.Fragment,{children:v.jsx(hF,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:v.jsx(dF,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":wP(a.open),...o,ref:e,deferPointerDownOutside:!0,onDismiss:()=>a.onOpenChange(!1)})})})}),kF="DialogTitle",G$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Wa(kF,n);return v.jsx(Vi.h2,{id:i.titleId,...r,ref:e})});G$.displayName=kF;var OF="DialogDescription",W$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Wa(OF,n);return v.jsx(Vi.p,{id:i.descriptionId,...r,ref:e})});W$.displayName=OF;var LF="DialogClose",$$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Wa(LF,n);return v.jsx(Vi.button,{type:"button",...r,ref:e,onClick:_d(t.onClick,()=>i.onOpenChange(!1))})});$$.displayName=LF;function wP(t){return t?"open":"closed"}var e0='[cmdk-group=""]',uE='[cmdk-group-items=""]',X$='[cmdk-group-heading=""]',DF='[cmdk-item=""]',SI=`${DF}:not([aria-disabled="true"])`,UT="cmdk-item-select",Dm="data-value",q$=(t,e,n)=>c9(t,e,n),UF=R.createContext(void 0),Vy=()=>R.useContext(UF),jF=R.createContext(void 0),SP=()=>R.useContext(jF),FF=R.createContext(void 0),zF=R.forwardRef((t,e)=>{let n=Um(()=>{var Z,ge;return{search:"",value:(ge=(Z=t.value)!=null?Z:t.defaultValue)!=null?ge:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Um(()=>new Set),i=Um(()=>new Map),s=Um(()=>new Map),o=Um(()=>new Set),a=BF(t),{label:l,children:c,value:d,onValueChange:f,filter:m,shouldFilter:y,loop:x,disablePointerSelection:S=!1,vimBindings:_=!0,...w}=t,A=Hc(),T=Hc(),C=Hc(),O=R.useRef(null),N=s7();Ch(()=>{if(d!==void 0){let Z=d.trim();n.current.value=Z,D.emit()}},[d]),Ch(()=>{N(6,ne)},[]);let D=R.useMemo(()=>({subscribe:Z=>(o.current.add(Z),()=>o.current.delete(Z)),snapshot:()=>n.current,setState:(Z,ge,ae)=>{var fe,_e,Se,$e;if(!Object.is(n.current[Z],ge)){if(n.current[Z]=ge,Z==="search")H(),k(),N(1,j);else if(Z==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Me=document.getElementById(C);Me?Me.focus():(fe=document.getElementById(A))==null||fe.focus()}if(N(7,()=>{var Me;n.current.selectedItemId=(Me=te())==null?void 0:Me.id,D.emit()}),ae||N(5,ne),((_e=a.current)==null?void 0:_e.value)!==void 0){let Me=ge??"";($e=(Se=a.current).onValueChange)==null||$e.call(Se,Me);return}}D.emit()}},emit:()=>{o.current.forEach(Z=>Z())}}),[]),F=R.useMemo(()=>({value:(Z,ge,ae)=>{var fe;ge!==((fe=s.current.get(Z))==null?void 0:fe.value)&&(s.current.set(Z,{value:ge,keywords:ae}),n.current.filtered.items.set(Z,V(ge,ae)),N(2,()=>{k(),D.emit()}))},item:(Z,ge)=>(r.current.add(Z),ge&&(i.current.has(ge)?i.current.get(ge).add(Z):i.current.set(ge,new Set([Z]))),N(3,()=>{H(),k(),n.current.value||j(),D.emit()}),()=>{s.current.delete(Z),r.current.delete(Z),n.current.filtered.items.delete(Z);let ae=te();N(4,()=>{H(),(ae==null?void 0:ae.getAttribute("id"))===Z&&j(),D.emit()})}),group:Z=>(i.current.has(Z)||i.current.set(Z,new Set),()=>{s.current.delete(Z),i.current.delete(Z)}),filter:()=>a.current.shouldFilter,label:l||t["aria-label"],getDisablePointerSelection:()=>a.current.disablePointerSelection,listId:A,inputId:C,labelId:T,listInnerRef:O}),[]);function V(Z,ge){var ae,fe;let _e=(fe=(ae=a.current)==null?void 0:ae.filter)!=null?fe:q$;return Z?_e(Z,n.current.search,ge):0}function k(){if(!n.current.search||a.current.shouldFilter===!1)return;let Z=n.current.filtered.items,ge=[];n.current.filtered.groups.forEach(fe=>{let _e=i.current.get(fe),Se=0;_e.forEach($e=>{let Me=Z.get($e);Se=Math.max(Me,Se)}),ge.push([fe,Se])});let ae=O.current;pe().sort((fe,_e)=>{var Se,$e;let Me=fe.getAttribute("id"),He=_e.getAttribute("id");return((Se=Z.get(He))!=null?Se:0)-(($e=Z.get(Me))!=null?$e:0)}).forEach(fe=>{let _e=fe.closest(uE);_e?_e.appendChild(fe.parentElement===_e?fe:fe.closest(`${uE} > *`)):ae.appendChild(fe.parentElement===ae?fe:fe.closest(`${uE} > *`))}),ge.sort((fe,_e)=>_e[1]-fe[1]).forEach(fe=>{var _e;let Se=(_e=O.current)==null?void 0:_e.querySelector(`${e0}[${Dm}="${encodeURIComponent(fe[0])}"]`);Se==null||Se.parentElement.appendChild(Se)})}function j(){let Z=pe().find(ae=>ae.getAttribute("aria-disabled")!=="true"),ge=Z==null?void 0:Z.getAttribute(Dm);D.setState("value",ge||void 0)}function H(){var Z,ge,ae,fe;if(!n.current.search||a.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let _e=0;for(let Se of r.current){let $e=(ge=(Z=s.current.get(Se))==null?void 0:Z.value)!=null?ge:"",Me=(fe=(ae=s.current.get(Se))==null?void 0:ae.keywords)!=null?fe:[],He=V($e,Me);n.current.filtered.items.set(Se,He),He>0&&_e++}for(let[Se,$e]of i.current)for(let Me of $e)if(n.current.filtered.items.get(Me)>0){n.current.filtered.groups.add(Se);break}n.current.filtered.count=_e}function ne(){var Z,ge,ae;let fe=te();fe&&(((Z=fe.parentElement)==null?void 0:Z.firstChild)===fe&&((ae=(ge=fe.closest(e0))==null?void 0:ge.querySelector(X$))==null||ae.scrollIntoView({block:"nearest"})),fe.scrollIntoView({block:"nearest"}))}function te(){var Z;return(Z=O.current)==null?void 0:Z.querySelector(`${DF}[aria-selected="true"]`)}function pe(){var Z;return Array.from(((Z=O.current)==null?void 0:Z.querySelectorAll(SI))||[])}function oe(Z){let ge=pe()[Z];ge&&D.setState("value",ge.getAttribute(Dm))}function ce(Z){var ge;let ae=te(),fe=pe(),_e=fe.findIndex($e=>$e===ae),Se=fe[_e+Z];(ge=a.current)!=null&&ge.loop&&(Se=_e+Z<0?fe[fe.length-1]:_e+Z===fe.length?fe[0]:fe[_e+Z]),Se&&D.setState("value",Se.getAttribute(Dm))}function B(Z){let ge=te(),ae=ge==null?void 0:ge.closest(e0),fe;for(;ae&&!fe;)ae=Z>0?r7(ae,e0):i7(ae,e0),fe=ae==null?void 0:ae.querySelector(SI);fe?D.setState("value",fe.getAttribute(Dm)):ce(Z)}let K=()=>oe(pe().length-1),q=Z=>{Z.preventDefault(),Z.metaKey?K():Z.altKey?B(1):ce(1)},$=Z=>{Z.preventDefault(),Z.metaKey?oe(0):Z.altKey?B(-1):ce(-1)};return R.createElement(Vi.div,{ref:e,tabIndex:-1,...w,"cmdk-root":"",onKeyDown:Z=>{var ge;(ge=w.onKeyDown)==null||ge.call(w,Z);let ae=Z.nativeEvent.isComposing||Z.keyCode===229;if(!(Z.defaultPrevented||ae))switch(Z.key){case"n":case"j":{_&&Z.ctrlKey&&q(Z);break}case"ArrowDown":{q(Z);break}case"p":case"k":{_&&Z.ctrlKey&&$(Z);break}case"ArrowUp":{$(Z);break}case"Home":{Z.preventDefault(),oe(0);break}case"End":{Z.preventDefault(),K();break}case"Enter":{Z.preventDefault();let fe=te();if(fe){let _e=new Event(UT);fe.dispatchEvent(_e)}}}}},R.createElement("label",{"cmdk-label":"",htmlFor:F.inputId,id:F.labelId,style:a7},l),q1(t,Z=>R.createElement(jF.Provider,{value:D},R.createElement(UF.Provider,{value:F},Z))))}),K$=R.forwardRef((t,e)=>{var n,r;let i=Hc(),s=R.useRef(null),o=R.useContext(FF),a=Vy(),l=BF(t),c=(r=(n=l.current)==null?void 0:n.forceMount)!=null?r:o==null?void 0:o.forceMount;Ch(()=>{if(!c)return a.item(i,o==null?void 0:o.id)},[c]);let d=HF(i,s,[t.value,t.children,s],t.keywords),f=SP(),m=Ed(N=>N.value&&N.value===d.current),y=Ed(N=>c||a.filter()===!1?!0:N.search?N.filtered.items.get(i)>0:!0);R.useEffect(()=>{let N=s.current;if(!(!N||t.disabled))return N.addEventListener(UT,x),()=>N.removeEventListener(UT,x)},[y,t.onSelect,t.disabled]);function x(){var N,D;S(),(D=(N=l.current).onSelect)==null||D.call(N,d.current)}function S(){f.setState("value",d.current,!0)}if(!y)return null;let{disabled:_,value:w,onSelect:A,forceMount:T,keywords:C,...O}=t;return R.createElement(Vi.div,{ref:xg(s,e),...O,id:i,"cmdk-item":"",role:"option","aria-disabled":!!_,"aria-selected":!!m,"data-disabled":!!_,"data-selected":!!m,onPointerMove:_||a.getDisablePointerSelection()?void 0:S,onClick:_?void 0:x},t.children)}),Y$=R.forwardRef((t,e)=>{let{heading:n,children:r,forceMount:i,...s}=t,o=Hc(),a=R.useRef(null),l=R.useRef(null),c=Hc(),d=Vy(),f=Ed(y=>i||d.filter()===!1?!0:y.search?y.filtered.groups.has(o):!0);Ch(()=>d.group(o),[]),HF(o,a,[t.value,t.heading,l]);let m=R.useMemo(()=>({id:o,forceMount:i}),[i]);return R.createElement(Vi.div,{ref:xg(a,e),...s,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},n&&R.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:c},n),q1(t,y=>R.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?c:void 0},R.createElement(FF.Provider,{value:m},y))))}),Z$=R.forwardRef((t,e)=>{let{alwaysRender:n,...r}=t,i=R.useRef(null),s=Ed(o=>!o.search);return!n&&!s?null:R.createElement(Vi.div,{ref:xg(i,e),...r,"cmdk-separator":"",role:"separator"})}),Q$=R.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,i=t.value!=null,s=SP(),o=Ed(c=>c.search),a=Ed(c=>c.selectedItemId),l=Vy();return R.useEffect(()=>{t.value!=null&&s.setState("search",t.value)},[t.value]),R.createElement(Vi.input,{ref:e,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":a,id:l.inputId,type:"text",value:i?t.value:o,onChange:c=>{i||s.setState("search",c.target.value),n==null||n(c.target.value)}})}),J$=R.forwardRef((t,e)=>{let{children:n,label:r="Suggestions",...i}=t,s=R.useRef(null),o=R.useRef(null),a=Ed(c=>c.selectedItemId),l=Vy();return R.useEffect(()=>{if(o.current&&s.current){let c=o.current,d=s.current,f,m=new ResizeObserver(()=>{f=requestAnimationFrame(()=>{let y=c.offsetHeight;d.style.setProperty("--cmdk-list-height",y.toFixed(1)+"px")})});return m.observe(c),()=>{cancelAnimationFrame(f),m.unobserve(c)}}},[]),R.createElement(Vi.div,{ref:xg(s,e),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":a,"aria-label":r,id:l.listId},q1(t,c=>R.createElement("div",{ref:xg(o,l.listInnerRef),"cmdk-list-sizer":""},c)))}),e7=R.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:s,container:o,...a}=t;return R.createElement(AF,{open:n,onOpenChange:r},R.createElement(PF,{container:o},R.createElement(RF,{"cmdk-overlay":"",className:i}),R.createElement(NF,{"aria-label":t.label,"cmdk-dialog":"",className:s},R.createElement(zF,{ref:e,...a}))))}),t7=R.forwardRef((t,e)=>Ed(n=>n.filtered.count===0)?R.createElement(Vi.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),n7=R.forwardRef((t,e)=>{let{progress:n,children:r,label:i="Loading...",...s}=t;return R.createElement(Vi.div,{ref:e,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},q1(t,o=>R.createElement("div",{"aria-hidden":!0},o)))}),im=Object.assign(zF,{List:J$,Item:K$,Input:Q$,Group:Y$,Separator:Z$,Dialog:e7,Empty:t7,Loading:n7});function r7(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function i7(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function BF(t){let e=R.useRef(t);return Ch(()=>{e.current=t}),e}var Ch=typeof window>"u"?R.useEffect:R.useLayoutEffect;function Um(t){let e=R.useRef();return e.current===void 0&&(e.current=t()),e}function Ed(t){let e=SP(),n=()=>t(e.snapshot());return R.useSyncExternalStore(e.subscribe,n,n)}function HF(t,e,n,r=[]){let i=R.useRef(),s=Vy();return Ch(()=>{var o;let a=(()=>{var c;for(let d of n){if(typeof d=="string")return d.trim();if(typeof d=="object"&&"current"in d)return d.current?(c=d.current.textContent)==null?void 0:c.trim():i.current}})(),l=r.map(c=>c.trim());s.value(t,a,l),(o=e.current)==null||o.setAttribute(Dm,a),i.current=a}),i}var s7=()=>{let[t,e]=R.useState(),n=Um(()=>new Map);return Ch(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,i)=>{n.current.set(r,i),e({})}};function o7(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function q1({asChild:t,children:e},n){return t&&R.isValidElement(e)?R.cloneElement(o7(e),{ref:e.ref},n(e.props.children)):n(e)}var a7={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function l7({onNavigate:t}){const[e,n]=R.useState(!1);return R.useEffect(()=>{const r=i=>{(i.metaKey||i.ctrlKey)&&i.key.toLowerCase()==="k"&&(i.preventDefault(),n(s=>!s))};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[]),v.jsx(im.Dialog,{open:e,onOpenChange:n,label:"Befehlspalette",className:"fixed inset-0 z-50 flex items-start justify-center bg-black/50 p-4 pt-[12vh]",onClick:()=>n(!1),children:v.jsxs("div",{className:"w-full max-w-lg overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-2xl",onClick:r=>r.stopPropagation(),children:[v.jsx(im.Input,{autoFocus:!0,placeholder:"Springe zu… (Modelle, Routing, System …)",className:"w-full border-b border-border bg-transparent px-4 py-3 text-sm outline-none placeholder:text-muted-foreground"}),v.jsxs(im.List,{className:"max-h-80 overflow-y-auto p-2",children:[v.jsx(im.Empty,{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"Nichts gefunden."}),v.jsx(im.Group,{heading:"Bereiche",className:"px-1 py-1 text-xs text-muted-foreground",children:kT.map(r=>v.jsxs(im.Item,{value:`${r.label} ${r.hint}`,onSelect:()=>{t(r.id),n(!1)},className:"flex cursor-pointer items-center gap-3 rounded-md px-3 py-2 text-sm text-foreground aria-selected:bg-accent aria-selected:text-accent-foreground",children:[v.jsx(r.icon,{className:"h-4 w-4 text-primary"}),v.jsx("span",{children:r.label}),v.jsx("span",{className:"ml-auto truncate text-xs text-muted-foreground",children:r.hint})]},r.id))})]})]})})}async function jt(t,e){var l;const n={"Content-Type":"application/json",...e==null?void 0:e.headers},r=localStorage.getItem("mc_sudo_password"),i=localStorage.getItem("mc_hf_token");r&&(n["X-Sudo-Password"]=r);let s=e==null?void 0:e.body;if((((l=e==null?void 0:e.method)==null?void 0:l.toUpperCase())||"GET")==="POST"){if(typeof s=="string")try{const c=JSON.parse(s);let d=!1;r&&!("sudo_password"in c)&&(c.sudo_password=r,d=!0),i&&!("hf_token"in c)&&(c.hf_token=i,d=!0),d&&(s=JSON.stringify(c))}catch{}else if(!s){const c={};r&&(c.sudo_password=r),i&&(c.hf_token=i),Object.keys(c).length>0&&(s=JSON.stringify(c))}}const a=await fetch(t,{...e,headers:n,body:s});if(!a.ok)throw new Error(`${a.status} ${a.statusText}`);return a.json()}const Lr={health:["health"],systemStatus:["system-status"],services:["services"],models:["models"],routing:["routing"],jobs:["jobs"],tokenStats:["token-stats"],agentStatus:["agent-status"],hermesBrain:["hermes-brain"],updates:["updates"],discover:["discover"],drafts:t=>["drafts",t??""],connect:t=>["connect",t??""],connectHealth:["connect-health"],memory:(t,e)=>["memory",t??"",e??""],memoryGraph:["memory-graph"]},c7=(t=!0)=>ls({queryKey:Lr.memoryGraph,queryFn:()=>jt("/api/memory/graph"),enabled:t}),u7=()=>ls({queryKey:Lr.health,queryFn:()=>jt("/api/health"),refetchInterval:1e4}),K1=(t=5e3)=>ls({queryKey:Lr.systemStatus,queryFn:()=>jt("/api/system/status"),refetchInterval:t}),d7=(t=3e3)=>ls({queryKey:Lr.services,queryFn:()=>jt("/api/system/services"),refetchInterval:t}),qh=(t=4e3)=>ls({queryKey:Lr.models,queryFn:()=>jt("/api/models"),refetchInterval:t}),f7=(t=4e3)=>ls({queryKey:Lr.routing,queryFn:()=>jt("/api/routing"),refetchInterval:t}),h7=(t=2e3)=>ls({queryKey:Lr.jobs,queryFn:()=>jt("/api/jobs"),refetchInterval:t,select:e=>e.jobs??[]}),MP=(t=3e3)=>ls({queryKey:Lr.tokenStats,queryFn:()=>jt("/api/system/token-stats"),refetchInterval:t}),EP=(t=5e3)=>ls({queryKey:Lr.agentStatus,queryFn:()=>jt("/api/agent/status"),refetchInterval:t}),p7=(t=6e4)=>ls({queryKey:Lr.hermesBrain,queryFn:()=>jt("/api/agent/brain"),refetchInterval:t}),AP=t=>ls({queryKey:Lr.updates,queryFn:()=>jt("/api/maintenance/updates"),refetchInterval:t}),m7=()=>ls({queryKey:Lr.discover,queryFn:()=>jt("/api/discover")}),g7=t=>ls({queryKey:Lr.drafts(t),queryFn:()=>jt(`/api/models/drafts?target=${encodeURIComponent(t??"")}`),enabled:!!t}),VF=t=>ls({queryKey:Lr.connect(t),queryFn:()=>jt(t?`/api/connect?${t}`:"/api/connect")}),v7=()=>ls({queryKey:Lr.connectHealth,queryFn:()=>jt("/api/connect/health"),refetchInterval:15e3}),jT=t=>ls({queryKey:Lr.memory(t==null?void 0:t.q,t==null?void 0:t.category),queryFn:()=>{const e=new URLSearchParams;return t!=null&&t.q&&e.set("q",t.q),t!=null&&t.category&&e.set("category",t.category),jt(`/api/memory?${e}`)},select:e=>t!=null&&t.limit?e.slice(0,t.limit):e});function sm(t){return(t/1024**3).toFixed(1)}function FT(t){return t?t>1024**3?`${(t/1024**3).toFixed(1)} GB`:`${(t/1024**2).toFixed(0)} MB`:""}function Bo(t){if(!t)return"—";const e=t/1024**3;return e>=1?`${e.toFixed(1)} GB`:`${(t/1024**2).toFixed(0)} MB`}function y7(t){if(!t)return"";const e=Math.floor(t/60);return e>0?`${e} min`:`${t} s`}function MI(t){return t?`${Math.round(t/1024)}k`:"—"}function GF(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(n=GF(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function er(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=GF(t))&&(r&&(r+=" "),r+=e);return r}const TP="-",x7=t=>{const e=_7(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{const a=o.split(TP);return a[0]===""&&a.length!==1&&a.shift(),WF(a,e)||b7(o)},getConflictingClassGroupIds:(o,a)=>{const l=n[o]||[];return a&&r[o]?[...l,...r[o]]:l}}},WF=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),i=r?WF(t.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(TP);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},EI=/^\[(.+)\]$/,b7=t=>{if(EI.test(t)){const e=EI.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},_7=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return S7(Object.entries(t.classGroups),n).forEach(([s,o])=>{zT(o,r,s,e)}),r},zT=(t,e,n,r)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:AI(e,i);s.classGroupId=n;return}if(typeof i=="function"){if(w7(i)){zT(i(r),e,n,r);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([s,o])=>{zT(o,AI(e,s),n,r)})})},AI=(t,e)=>{let n=t;return e.split(TP).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},w7=t=>t.isThemeGetter,S7=(t,e)=>e?t.map(([n,r])=>{const i=r.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[n,i]}):t,M7=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const i=(s,o)=>{n.set(s,o),e++,e>t&&(e=0,r=n,n=new Map)};return{get(s){let o=n.get(s);if(o!==void 0)return o;if((o=r.get(s))!==void 0)return i(s,o),o},set(s,o){n.has(s)?n.set(s,o):i(s,o)}}},$F="!",E7=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,i=e[0],s=e.length,o=a=>{const l=[];let c=0,d=0,f;for(let _=0;_<a.length;_++){let w=a[_];if(c===0){if(w===i&&(r||a.slice(_,_+s)===e)){l.push(a.slice(d,_)),d=_+s;continue}if(w==="/"){f=_;continue}}w==="["?c++:w==="]"&&c--}const m=l.length===0?a:a.substring(d),y=m.startsWith($F),x=y?m.substring(1):m,S=f&&f>d?f-d:void 0;return{modifiers:l,hasImportantModifier:y,baseClassName:x,maybePostfixModifierPosition:S}};return n?a=>n({className:a,parseClassName:o}):o},A7=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e},T7=t=>({cache:M7(t.cacheSize),parseClassName:E7(t),...x7(t)}),C7=/\s+/,P7=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(C7);let a="";for(let l=o.length-1;l>=0;l-=1){const c=o[l],{modifiers:d,hasImportantModifier:f,baseClassName:m,maybePostfixModifierPosition:y}=n(c);let x=!!y,S=r(x?m.substring(0,y):m);if(!S){if(!x){a=c+(a.length>0?" "+a:a);continue}if(S=r(m),!S){a=c+(a.length>0?" "+a:a);continue}x=!1}const _=A7(d).join(":"),w=f?_+$F:_,A=w+S;if(s.includes(A))continue;s.push(A);const T=i(S,x);for(let C=0;C<T.length;++C){const O=T[C];s.push(w+O)}a=c+(a.length>0?" "+a:a)}return a};function R7(){let t=0,e,n,r="";for(;t<arguments.length;)(e=arguments[t++])&&(n=XF(e))&&(r&&(r+=" "),r+=n);return r}const XF=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=XF(t[r]))&&(n&&(n+=" "),n+=e);return n};function N7(t,...e){let n,r,i,s=o;function o(l){const c=e.reduce((d,f)=>f(d),t());return n=T7(c),r=n.cache.get,i=n.cache.set,s=a,a(l)}function a(l){const c=r(l);if(c)return c;const d=P7(l,n);return i(l,d),d}return function(){return s(R7.apply(null,arguments))}}const rr=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},qF=/^\[(?:([a-z-]+):)?(.+)\]$/i,I7=/^\d+\/\d+$/,k7=new Set(["px","full","screen"]),O7=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,L7=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,D7=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,U7=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,j7=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,_c=t=>Zm(t)||k7.has(t)||I7.test(t),Gu=t=>Fg(t,"length",$7),Zm=t=>!!t&&!Number.isNaN(Number(t)),dE=t=>Fg(t,"number",Zm),t0=t=>!!t&&Number.isInteger(Number(t)),F7=t=>t.endsWith("%")&&Zm(t.slice(0,-1)),fn=t=>qF.test(t),Wu=t=>O7.test(t),z7=new Set(["length","size","percentage"]),B7=t=>Fg(t,z7,KF),H7=t=>Fg(t,"position",KF),V7=new Set(["image","url"]),G7=t=>Fg(t,V7,q7),W7=t=>Fg(t,"",X7),n0=()=>!0,Fg=(t,e,n)=>{const r=qF.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},$7=t=>L7.test(t)&&!D7.test(t),KF=()=>!1,X7=t=>U7.test(t),q7=t=>j7.test(t),K7=()=>{const t=rr("colors"),e=rr("spacing"),n=rr("blur"),r=rr("brightness"),i=rr("borderColor"),s=rr("borderRadius"),o=rr("borderSpacing"),a=rr("borderWidth"),l=rr("contrast"),c=rr("grayscale"),d=rr("hueRotate"),f=rr("invert"),m=rr("gap"),y=rr("gradientColorStops"),x=rr("gradientColorStopPositions"),S=rr("inset"),_=rr("margin"),w=rr("opacity"),A=rr("padding"),T=rr("saturate"),C=rr("scale"),O=rr("sepia"),N=rr("skew"),D=rr("space"),F=rr("translate"),V=()=>["auto","contain","none"],k=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto",fn,e],H=()=>[fn,e],ne=()=>["",_c,Gu],te=()=>["auto",Zm,fn],pe=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],oe=()=>["solid","dashed","dotted","double","none"],ce=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],B=()=>["start","end","center","between","around","evenly","stretch"],K=()=>["","0",fn],q=()=>["auto","avoid","all","avoid-page","page","left","right","column"],$=()=>[Zm,fn];return{cacheSize:500,separator:":",theme:{colors:[n0],spacing:[_c,Gu],blur:["none","",Wu,fn],brightness:$(),borderColor:[t],borderRadius:["none","","full",Wu,fn],borderSpacing:H(),borderWidth:ne(),contrast:$(),grayscale:K(),hueRotate:$(),invert:K(),gap:H(),gradientColorStops:[t],gradientColorStopPositions:[F7,Gu],inset:j(),margin:j(),opacity:$(),padding:H(),saturate:$(),scale:$(),sepia:K(),skew:$(),space:H(),translate:H()},classGroups:{aspect:[{aspect:["auto","square","video",fn]}],container:["container"],columns:[{columns:[Wu]}],"break-after":[{"break-after":q()}],"break-before":[{"break-before":q()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...pe(),fn]}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:V()}],"overscroll-x":[{"overscroll-x":V()}],"overscroll-y":[{"overscroll-y":V()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[S]}],"inset-x":[{"inset-x":[S]}],"inset-y":[{"inset-y":[S]}],start:[{start:[S]}],end:[{end:[S]}],top:[{top:[S]}],right:[{right:[S]}],bottom:[{bottom:[S]}],left:[{left:[S]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",t0,fn]}],basis:[{basis:j()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",fn]}],grow:[{grow:K()}],shrink:[{shrink:K()}],order:[{order:["first","last","none",t0,fn]}],"grid-cols":[{"grid-cols":[n0]}],"col-start-end":[{col:["auto",{span:["full",t0,fn]},fn]}],"col-start":[{"col-start":te()}],"col-end":[{"col-end":te()}],"grid-rows":[{"grid-rows":[n0]}],"row-start-end":[{row:["auto",{span:[t0,fn]},fn]}],"row-start":[{"row-start":te()}],"row-end":[{"row-end":te()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",fn]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",fn]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal",...B()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...B(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...B(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[A]}],px:[{px:[A]}],py:[{py:[A]}],ps:[{ps:[A]}],pe:[{pe:[A]}],pt:[{pt:[A]}],pr:[{pr:[A]}],pb:[{pb:[A]}],pl:[{pl:[A]}],m:[{m:[_]}],mx:[{mx:[_]}],my:[{my:[_]}],ms:[{ms:[_]}],me:[{me:[_]}],mt:[{mt:[_]}],mr:[{mr:[_]}],mb:[{mb:[_]}],ml:[{ml:[_]}],"space-x":[{"space-x":[D]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[D]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",fn,e]}],"min-w":[{"min-w":[fn,e,"min","max","fit"]}],"max-w":[{"max-w":[fn,e,"none","full","min","max","fit","prose",{screen:[Wu]},Wu]}],h:[{h:[fn,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[fn,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[fn,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[fn,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Wu,Gu]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",dE]}],"font-family":[{font:[n0]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",fn]}],"line-clamp":[{"line-clamp":["none",Zm,dE]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",_c,fn]}],"list-image":[{"list-image":["none",fn]}],"list-style-type":[{list:["none","disc","decimal",fn]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[w]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[w]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...oe(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",_c,Gu]}],"underline-offset":[{"underline-offset":["auto",_c,fn]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:H()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",fn]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",fn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[w]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...pe(),H7]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",B7]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},G7]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[x]}],"gradient-via-pos":[{via:[x]}],"gradient-to-pos":[{to:[x]}],"gradient-from":[{from:[y]}],"gradient-via":[{via:[y]}],"gradient-to":[{to:[y]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[w]}],"border-style":[{border:[...oe(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[w]}],"divide-style":[{divide:oe()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...oe()]}],"outline-offset":[{"outline-offset":[_c,fn]}],"outline-w":[{outline:[_c,Gu]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:ne()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[w]}],"ring-offset-w":[{"ring-offset":[_c,Gu]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Wu,W7]}],"shadow-color":[{shadow:[n0]}],opacity:[{opacity:[w]}],"mix-blend":[{"mix-blend":[...ce(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":ce()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Wu,fn]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[T]}],sepia:[{sepia:[O]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[w]}],"backdrop-saturate":[{"backdrop-saturate":[T]}],"backdrop-sepia":[{"backdrop-sepia":[O]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",fn]}],duration:[{duration:$()}],ease:[{ease:["linear","in","out","in-out",fn]}],delay:[{delay:$()}],animate:[{animate:["none","spin","ping","pulse","bounce",fn]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[t0,fn]}],"translate-x":[{"translate-x":[F]}],"translate-y":[{"translate-y":[F]}],"skew-x":[{"skew-x":[N]}],"skew-y":[{"skew-y":[N]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",fn]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",fn]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":H()}],"scroll-mx":[{"scroll-mx":H()}],"scroll-my":[{"scroll-my":H()}],"scroll-ms":[{"scroll-ms":H()}],"scroll-me":[{"scroll-me":H()}],"scroll-mt":[{"scroll-mt":H()}],"scroll-mr":[{"scroll-mr":H()}],"scroll-mb":[{"scroll-mb":H()}],"scroll-ml":[{"scroll-ml":H()}],"scroll-p":[{"scroll-p":H()}],"scroll-px":[{"scroll-px":H()}],"scroll-py":[{"scroll-py":H()}],"scroll-ps":[{"scroll-ps":H()}],"scroll-pe":[{"scroll-pe":H()}],"scroll-pt":[{"scroll-pt":H()}],"scroll-pr":[{"scroll-pr":H()}],"scroll-pb":[{"scroll-pb":H()}],"scroll-pl":[{"scroll-pl":H()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",fn]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[_c,Gu,dE]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},Y7=N7(K7);function nt(...t){return Y7(er(t))}function _g(t){return t?t.replace(/127\.0\.0\.1|localhost/g,"192.168.178.151"):""}const YF=["fast","heavy","coder","vision","scout"],Z7={fast:"bg-cyan-500/15 text-cyan-400 border-cyan-500/25",heavy:"bg-amber-500/15 text-amber-400 border-amber-500/25",coder:"bg-violet-500/15 text-violet-400 border-violet-500/25",vision:"bg-pink-500/15 text-pink-400 border-pink-500/25",scout:"bg-teal-500/15 text-teal-400 border-teal-500/25",hermes:"bg-indigo-500/15 text-indigo-400 border-indigo-500/25"},CP=t=>t&&Z7[t]||"bg-slate-500/15 text-slate-300 border-slate-500/25";function Q7({fit:t}){const e={perfect:"bg-emerald-500/15 text-emerald-400 border border-emerald-500/20",marginal:"bg-amber-500/15 text-amber-400 border border-amber-500/20",too_tight:"bg-red-500/15 text-red-400 border border-red-500/20"}[t.level];return v.jsxs("span",{className:nt("rounded px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider font-mono",e),children:[t.text," • ",t.req_gb," GB RAM"]})}function TI(t){const e=t.toLowerCase();return e.includes("qwen")?{name:"Qwen",color:"bg-purple-500/20 text-purple-300 border-purple-500/30",initial:"Q"}:e.includes("gemma")?{name:"Gemma",color:"bg-blue-500/20 text-blue-300 border-blue-500/30",initial:"G"}:e.includes("llama")?{name:"Llama",color:"bg-red-500/20 text-red-300 border-red-500/30",initial:"🦙"}:e.includes("mistral")||e.includes("mixtral")?{name:"Mistral",color:"bg-orange-500/20 text-orange-300 border-orange-500/30",initial:"M"}:e.includes("deepseek")?{name:"DeepSeek",color:"bg-cyan-500/20 text-cyan-300 border-cyan-500/30",initial:"D"}:e.includes("hermes")||e.includes("nous")?{name:"Hermes",color:"bg-amber-500/20 text-amber-300 border-amber-500/30",initial:"H"}:e.includes("phi")?{name:"Phi",color:"bg-emerald-500/20 text-emerald-300 border-emerald-500/30",initial:"Φ"}:{name:"Other",color:"bg-slate-500/20 text-slate-300 border-slate-500/30",initial:"AI"}}function J7(){const{data:t}=qh(2e3),{data:e}=MP(2e3),n=(t==null?void 0:t.models)??[],r=(t==null?void 0:t.running)??[],i=n.filter(l=>r.includes(l.name)),s=R.useRef(null),[o,a]=R.useState(!1);return R.useEffect(()=>{if(!e)return;const l=e.total_tokens;if(s.current!==null&&l>s.current){a(!0);const c=setTimeout(()=>a(!1),4e3);return s.current=l,()=>clearTimeout(c)}s.current=l},[e==null?void 0:e.total_tokens]),v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[v.jsxs("div",{className:"flex items-center justify-between mb-4",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(ry,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Aktive Modelle (Live)"})]}),v.jsxs("span",{className:nt("flex items-center gap-1.5 text-[10px] font-bold uppercase tracking-wider font-mono px-2 py-0.5 rounded-full border transition-colors",o?"bg-emerald-500/10 text-emerald-400 border-emerald-500/30":"bg-background/30 text-muted-foreground/70 border-border/40"),children:[o?v.jsx(xh,{className:"h-3 w-3 animate-pulse"}):v.jsx(V8,{className:"h-3 w-3"}),o?"Inferenz aktiv":"Idle"]})]}),i.length===0?v.jsx("div",{className:"flex items-center justify-center gap-2 h-20 text-xs text-muted-foreground/70 italic",children:"Kein Modell geladen — Auto-Swap lädt bei Anfrage."}):v.jsx("div",{className:"grid gap-2",children:i.map(l=>{var c;return v.jsxs("div",{className:"flex items-center justify-between gap-2 p-3 rounded-xl bg-emerald-500/5 border border-emerald-500/20",children:[v.jsxs("div",{className:"min-w-0",children:[v.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[l.role&&v.jsx("span",{className:nt("text-[8px] font-semibold uppercase px-1.5 py-0.5 rounded font-mono border tracking-wider shrink-0",CP(l.role)),children:l.role}),v.jsx("span",{className:"text-xs font-semibold font-mono text-foreground truncate",children:(c=l.name.split("/").pop())==null?void 0:c.replace(/\.gguf$/i,"")})]}),v.jsxs("div",{className:"text-[9px] font-mono text-muted-foreground/70 mt-0.5",children:[Bo(l.size_bytes)," im Unified-RAM"]})]}),v.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider font-mono shrink-0",children:[v.jsx("span",{className:nt("h-1.5 w-1.5 rounded-full bg-emerald-500",o&&"animate-pulse")})," warm"]})]},l.name)})})]})}let BT=[],HT=[];const VT=new Set,ZF=()=>VT.forEach(t=>t());function QF(t){return VT.add(t),()=>{VT.delete(t)}}function eX(t){BT=[...BT,t].slice(-40),ZF()}function tX(t){HT=[...HT,t].slice(-40),ZF()}const nX=()=>R.useSyncExternalStore(QF,()=>BT),rX=()=>R.useSyncExternalStore(QF,()=>HT);function iX(){const{data:t,dataUpdatedAt:e}=K1(3e3),{data:n,dataUpdatedAt:r}=MP(3e3),i=R.useRef(null);R.useEffect(()=>{var s,o,a,l;t&&eX({t:Date.now(),cpu:((s=t.cpu)==null?void 0:s.percent)??0,ram:((o=t.ram)==null?void 0:o.percent)??0,gpu:((a=t.gpu)==null?void 0:a.busy_percent)??null,disk:((l=t.disk)==null?void 0:l.percent)??null})},[e]),R.useEffect(()=>{if(!n)return;const s=Date.now(),o=n.prompt_tokens,a=n.completion_tokens;if(i.current){const l=Math.max((s-i.current.t)/1e3,.001);tX({t:s,prompt:Math.max(0,(o-i.current.p)/l),completion:Math.max(0,(a-i.current.c)/l)})}i.current={p:o,c:a,t:s}},[r])}function sX(){const{data:t,error:e}=K1(3e3),n=nX();return{sys:t,hist:n,error:e}}var oX=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"];function PP(t){if(typeof t!="string")return!1;var e=oX;return e.includes(t)}var aX=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],lX=new Set(aX);function JF(t){return typeof t!="string"?!1:lX.has(t)}function e5(t){return typeof t=="string"&&t.startsWith("data-")}function za(t){if(typeof t!="object"||t===null)return{};var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(JF(n)||e5(n))&&(e[n]=t[n]);return e}function Y1(t){if(t==null)return null;if(R.isValidElement(t)&&typeof t.props=="object"&&t.props!==null){var e=t.props;return za(e)}return typeof t=="object"&&!Array.isArray(t)?za(t):null}function Ko(t){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(JF(n)||e5(n)||PP(n))&&(e[n]=t[n]);return e}function cX(t){return t==null?null:R.isValidElement(t)?Ko(t.props):typeof t=="object"&&!Array.isArray(t)?Ko(t):null}var uX=["children","width","height","viewBox","className","style","title","desc"];function GT(){return GT=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},GT.apply(null,arguments)}function dX(t,e){if(t==null)return{};var n,r,i=fX(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function fX(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var t5=R.forwardRef((t,e)=>{var n=t.children,r=t.width,i=t.height,s=t.viewBox,o=t.className,a=t.style,l=t.title,c=t.desc,d=dX(t,uX),f=s||{width:r,height:i,x:0,y:0},m=er("recharts-surface",o);return R.createElement("svg",GT({},Ko(d),{className:m,width:r,height:i,style:a,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height),ref:e}),R.createElement("title",null,l),R.createElement("desc",null,c),n)}),hX=["children","className"];function WT(){return WT=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},WT.apply(null,arguments)}function pX(t,e){if(t==null)return{};var n,r,i=mX(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function mX(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var Yo=R.forwardRef((t,e)=>{var n=t.children,r=t.className,i=pX(t,hX),s=er("recharts-layer",r);return R.createElement("g",WT({className:s},Ko(i),{ref:e}),n)}),gX=R.createContext(null);function Mr(t){return function(){return t}}const $T=Math.PI,XT=2*$T,Gf=1e-6,vX=XT-Gf;function n5(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function yX(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return n5;const n=10**e;return function(r){this._+=r[0];for(let i=1,s=r.length;i<s;++i)this._+=Math.round(arguments[i]*n)/n+r[i]}}let xX=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?n5:yX(e)}moveTo(e,n){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,n){this._append`L${this._x1=+e},${this._y1=+n}`}quadraticCurveTo(e,n,r,i){this._append`Q${+e},${+n},${this._x1=+r},${this._y1=+i}`}bezierCurveTo(e,n,r,i,s,o){this._append`C${+e},${+n},${+r},${+i},${this._x1=+s},${this._y1=+o}`}arcTo(e,n,r,i,s){if(e=+e,n=+n,r=+r,i=+i,s=+s,s<0)throw new Error(`negative radius: ${s}`);let o=this._x1,a=this._y1,l=r-e,c=i-n,d=o-e,f=a-n,m=d*d+f*f;if(this._x1===null)this._append`M${this._x1=e},${this._y1=n}`;else if(m>Gf)if(!(Math.abs(f*l-c*d)>Gf)||!s)this._append`L${this._x1=e},${this._y1=n}`;else{let y=r-o,x=i-a,S=l*l+c*c,_=y*y+x*x,w=Math.sqrt(S),A=Math.sqrt(m),T=s*Math.tan(($T-Math.acos((S+m-_)/(2*w*A)))/2),C=T/A,O=T/w;Math.abs(C-1)>Gf&&this._append`L${e+C*d},${n+C*f}`,this._append`A${s},${s},0,0,${+(f*y>d*x)},${this._x1=e+O*l},${this._y1=n+O*c}`}}arc(e,n,r,i,s,o){if(e=+e,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let a=r*Math.cos(i),l=r*Math.sin(i),c=e+a,d=n+l,f=1^o,m=o?i-s:s-i;this._x1===null?this._append`M${c},${d}`:(Math.abs(this._x1-c)>Gf||Math.abs(this._y1-d)>Gf)&&this._append`L${c},${d}`,r&&(m<0&&(m=m%XT+XT),m>vX?this._append`A${r},${r},0,1,${f},${e-a},${n-l}A${r},${r},0,1,${f},${this._x1=c},${this._y1=d}`:m>Gf&&this._append`A${r},${r},0,${+(m>=$T)},${f},${this._x1=e+r*Math.cos(s)},${this._y1=n+r*Math.sin(s)}`)}rect(e,n,r,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}};function r5(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(n==null)e=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);e=r}return t},()=>new xX(e)}function RP(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function i5(t){this._context=t}i5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function Z1(t){return new i5(t)}function s5(t){return t[0]}function o5(t){return t[1]}function a5(t,e){var n=Mr(!0),r=null,i=Z1,s=null,o=r5(a);t=typeof t=="function"?t:t===void 0?s5:Mr(t),e=typeof e=="function"?e:e===void 0?o5:Mr(e);function a(l){var c,d=(l=RP(l)).length,f,m=!1,y;for(r==null&&(s=i(y=o())),c=0;c<=d;++c)!(c<d&&n(f=l[c],c,l))===m&&((m=!m)?s.lineStart():s.lineEnd()),m&&s.point(+t(f,c,l),+e(f,c,l));if(y)return s=null,y+""||null}return a.x=function(l){return arguments.length?(t=typeof l=="function"?l:Mr(+l),a):t},a.y=function(l){return arguments.length?(e=typeof l=="function"?l:Mr(+l),a):e},a.defined=function(l){return arguments.length?(n=typeof l=="function"?l:Mr(!!l),a):n},a.curve=function(l){return arguments.length?(i=l,r!=null&&(s=i(r)),a):i},a.context=function(l){return arguments.length?(l==null?r=s=null:s=i(r=l),a):r},a}function xb(t,e,n){var r=null,i=Mr(!0),s=null,o=Z1,a=null,l=r5(c);t=typeof t=="function"?t:t===void 0?s5:Mr(+t),e=typeof e=="function"?e:Mr(e===void 0?0:+e),n=typeof n=="function"?n:n===void 0?o5:Mr(+n);function c(f){var m,y,x,S=(f=RP(f)).length,_,w=!1,A,T=new Array(S),C=new Array(S);for(s==null&&(a=o(A=l())),m=0;m<=S;++m){if(!(m<S&&i(_=f[m],m,f))===w)if(w=!w)y=m,a.areaStart(),a.lineStart();else{for(a.lineEnd(),a.lineStart(),x=m-1;x>=y;--x)a.point(T[x],C[x]);a.lineEnd(),a.areaEnd()}w&&(T[m]=+t(_,m,f),C[m]=+e(_,m,f),a.point(r?+r(_,m,f):T[m],n?+n(_,m,f):C[m]))}if(A)return a=null,A+""||null}function d(){return a5().defined(i).curve(o).context(s)}return c.x=function(f){return arguments.length?(t=typeof f=="function"?f:Mr(+f),r=null,c):t},c.x0=function(f){return arguments.length?(t=typeof f=="function"?f:Mr(+f),c):t},c.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Mr(+f),c):r},c.y=function(f){return arguments.length?(e=typeof f=="function"?f:Mr(+f),n=null,c):e},c.y0=function(f){return arguments.length?(e=typeof f=="function"?f:Mr(+f),c):e},c.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Mr(+f),c):n},c.lineX0=c.lineY0=function(){return d().x(t).y(e)},c.lineY1=function(){return d().x(t).y(n)},c.lineX1=function(){return d().x(r).y(e)},c.defined=function(f){return arguments.length?(i=typeof f=="function"?f:Mr(!!f),c):i},c.curve=function(f){return arguments.length?(o=f,s!=null&&(a=o(s)),c):o},c.context=function(f){return arguments.length?(f==null?s=a=null:a=o(s=f),c):s},c}class l5{constructor(e,n){this._context=e,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,n){switch(e=+e,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,n,e,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,e,this._y0,e,n);break}}this._x0=e,this._y0=n}}function bX(t){return new l5(t,!0)}function _X(t){return new l5(t,!1)}function nw(){}function rw(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function c5(t){this._context=t}c5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:rw(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:rw(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function wX(t){return new c5(t)}function u5(t){this._context=t}u5.prototype={areaStart:nw,areaEnd:nw,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:rw(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function SX(t){return new u5(t)}function d5(t){this._context=t}d5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:rw(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function MX(t){return new d5(t)}function f5(t){this._context=t}f5.prototype={areaStart:nw,areaEnd:nw,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function EX(t){return new f5(t)}function CI(t){return t<0?-1:1}function PI(t,e,n){var r=t._x1-t._x0,i=e-t._x1,s=(t._y1-t._y0)/(r||i<0&&-0),o=(n-t._y1)/(i||r<0&&-0),a=(s*i+o*r)/(r+i);return(CI(s)+CI(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(a))||0}function RI(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function fE(t,e,n){var r=t._x0,i=t._y0,s=t._x1,o=t._y1,a=(s-r)/3;t._context.bezierCurveTo(r+a,i+a*e,s-a,o-a*n,s,o)}function iw(t){this._context=t}iw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:fE(this,this._t0,RI(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,fE(this,RI(this,n=PI(this,t,e)),n);break;default:fE(this,this._t0,n=PI(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function h5(t){this._context=new p5(t)}(h5.prototype=Object.create(iw.prototype)).point=function(t,e){iw.prototype.point.call(this,e,t)};function p5(t){this._context=t}p5.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,i,s){this._context.bezierCurveTo(e,t,r,n,s,i)}};function AX(t){return new iw(t)}function TX(t){return new h5(t)}function m5(t){this._context=t}m5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),n===2)this._context.lineTo(t[1],e[1]);else for(var r=NI(t),i=NI(e),s=0,o=1;o<n;++s,++o)this._context.bezierCurveTo(r[0][s],i[0][s],r[1][s],i[1][s],t[o],e[o]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}};function NI(t){var e,n=t.length-1,r,i=new Array(n),s=new Array(n),o=new Array(n);for(i[0]=0,s[0]=2,o[0]=t[0]+2*t[1],e=1;e<n-1;++e)i[e]=1,s[e]=4,o[e]=4*t[e]+2*t[e+1];for(i[n-1]=2,s[n-1]=7,o[n-1]=8*t[n-1]+t[n],e=1;e<n;++e)r=i[e]/s[e-1],s[e]-=r,o[e]-=r*o[e-1];for(i[n-1]=o[n-1]/s[n-1],e=n-2;e>=0;--e)i[e]=(o[e]-i[e+1])/s[e];for(s[n-1]=(t[n]+i[n-1])/2,e=0;e<n-1;++e)s[e]=2*t[e+1]-i[e+1];return[i,s]}function CX(t){return new m5(t)}function Q1(t,e){this._context=t,this._t=e}Q1.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}break}}this._x=t,this._y=e}};function PX(t){return new Q1(t,.5)}function RX(t){return new Q1(t,0)}function NX(t){return new Q1(t,1)}function Ph(t,e){if((o=t.length)>1)for(var n=1,r,i,s=t[e[0]],o,a=s.length;n<o;++n)for(i=s,s=t[e[n]],r=0;r<a;++r)s[r][1]+=s[r][0]=isNaN(i[r][1])?i[r][0]:i[r][1]}function qT(t){for(var e=t.length,n=new Array(e);--e>=0;)n[e]=e;return n}function IX(t,e){return t[e]}function kX(t){const e=[];return e.key=t,e}function OX(){var t=Mr([]),e=qT,n=Ph,r=IX;function i(s){var o=Array.from(t.apply(this,arguments),kX),a,l=o.length,c=-1,d;for(const f of s)for(a=0,++c;a<l;++a)(o[a][c]=[0,+r(f,o[a].key,c,s)]).data=f;for(a=0,d=RP(e(o));a<l;++a)o[d[a]].index=a;return n(o,d),o}return i.keys=function(s){return arguments.length?(t=typeof s=="function"?s:Mr(Array.from(s)),i):t},i.value=function(s){return arguments.length?(r=typeof s=="function"?s:Mr(+s),i):r},i.order=function(s){return arguments.length?(e=s==null?qT:typeof s=="function"?s:Mr(Array.from(s)),i):e},i.offset=function(s){return arguments.length?(n=s??Ph,i):n},i}function LX(t,e){if((r=t.length)>0){for(var n,r,i=0,s=t[0].length,o;i<s;++i){for(o=n=0;n<r;++n)o+=t[n][i][1]||0;if(o)for(n=0;n<r;++n)t[n][i][1]/=o}Ph(t,e)}}function DX(t,e){if((i=t.length)>0){for(var n=0,r=t[e[0]],i,s=r.length;n<s;++n){for(var o=0,a=0;o<i;++o)a+=t[o][n][1]||0;r[n][1]+=r[n][0]=-a/2}Ph(t,e)}}function UX(t,e){if(!(!((o=t.length)>0)||!((s=(i=t[e[0]]).length)>0))){for(var n=0,r=1,i,s,o;r<s;++r){for(var a=0,l=0,c=0;a<o;++a){for(var d=t[e[a]],f=d[r][1]||0,m=d[r-1][1]||0,y=(f-m)/2,x=0;x<a;++x){var S=t[e[x]],_=S[r][1]||0,w=S[r-1][1]||0;y+=_-w}l+=f,c+=y*f}i[r-1][1]+=i[r-1][0]=n,l&&(n-=c/l)}i[r-1][1]+=i[r-1][0]=n,Ph(t,e)}}function KT(t){return t==="__proto__"}function g5(t){switch(typeof t){case"number":case"symbol":return!1;case"string":return t.includes(".")||t.includes("[")||t.includes("]")}}function NP(t){var e;return typeof t=="string"||typeof t=="symbol"?t:Object.is((e=t==null?void 0:t.valueOf)==null?void 0:e.call(t),-0)?"-0":String(t)}function v5(t){if(t==null)return"";if(typeof t=="string")return t;if(Array.isArray(t))return t.map(v5).join(",");const e=String(t);return e==="0"&&Object.is(Number(t),-0)?"-0":e}function IP(t){if(Array.isArray(t))return t.map(NP);if(typeof t=="symbol")return[t];t=v5(t);const e=[],n=t.length;if(n===0)return e;let r=0,i="",s="",o=!1;for(t.charCodeAt(0)===46&&e.push("");r<n;){const a=t[r];if(s)a==="\\"&&r+1<n?(r++,i+=t[r]):a===s?s="":i+=a;else if(o)a==='"'||a==="'"?s=a:a==="]"?(o=!1,e.push(i),i=""):i+=a;else if(a==="[")o=!0,i&&(e.push(i),i="");else if(a==="."){i&&(e.push(i),i="");const l=t[r+1];(l===void 0||l===".")&&e.push("")}else i+=a;r++}return i&&e.push(i),e}function Kh(t,e,n){if(t==null)return n;switch(typeof e){case"string":{if(KT(e))return n;const r=t[e];return r===void 0?g5(e)&&!Object.hasOwn(t,e)?Kh(t,IP(e),n):n:r}case"number":case"symbol":{typeof e=="number"&&(e=NP(e));const r=t[e];return r===void 0?n:r}default:{if(Array.isArray(e))return jX(t,e,n);if(Object.is(e==null?void 0:e.valueOf(),-0)?e="-0":e=String(e),KT(e))return n;const r=t[e];return r===void 0?n:r}}}function jX(t,e,n){if(e.length===0)return n;let r=t;for(let i=0;i<e.length;i++){if(r==null||KT(e[i]))return n;r=r[e[i]]}return r===void 0?n:r}var FX=4;function xd(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:FX,n=10**e,r=Math.round(t*n)/n;return Object.is(r,-0)?0:r}function Di(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return t.reduce((i,s,o)=>{var a=n[o-1];return typeof a=="string"?i+a+s:a!==void 0?i+xd(a)+s:i+s},"")}var Wo=t=>t===0?0:t>0?1:-1,Nl=t=>typeof t=="number"&&t!=+t,Rh=t=>typeof t=="string"&&t.length>1&&t.indexOf("%")===t.length-1,Nt=t=>(typeof t=="number"||t instanceof Number)&&!Nl(t),Il=t=>Nt(t)||typeof t=="string",zX=0,ly=t=>{var e=++zX;return"".concat(t||"").concat(e)},Ad=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Nt(e)&&typeof e!="string")return r;var s;if(Rh(e)){if(n==null)return r;var o=e.indexOf("%");s=n*parseFloat(e.slice(0,o))/100}else s=+e;return Nl(s)&&(s=r),i&&n!=null&&s>n&&(s=n),s},y5=t=>{if(!Array.isArray(t))return!1;for(var e=t.length,n={},r=0;r<e;r++)if(!n[String(t[r])])n[String(t[r])]=!0;else return!0;return!1};function Uc(t,e,n){return Nt(t)&&Nt(e)?xd(t+n*(e-t)):e}function x5(t,e,n){if(!(!t||!t.length))return t.find(r=>r&&(typeof e=="function"?e(r):Kh(r,e))===n)}var Hi=t=>t===null||typeof t>"u",kP=t=>Hi(t)?t:"".concat(t.charAt(0).toUpperCase()).concat(t.slice(1));function Ks(t){return t!=null}function zg(){}var b5=t=>"radius"in t&&"startAngle"in t&&"endAngle"in t,OP=(t,e)=>{if(!t||typeof t=="function"||typeof t=="boolean")return null;var n=t;if(R.isValidElement(t)&&(n=t.props),typeof n!="object"&&typeof n!="function")return null;var r={};return Object.keys(n).forEach(i=>{PP(i)&&typeof n[i]=="function"&&(r[i]=(s=>n[i](n,s)))}),r},BX=(t,e,n)=>r=>(t(e,n,r),null),HX=(t,e,n)=>{if(t===null||typeof t!="object"&&typeof t!="function")return null;var r=null;return Object.keys(t).forEach(i=>{var s=t[i];PP(i)&&typeof s=="function"&&(r||(r={}),r[i]=BX(s,e,n))}),r};function II(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function VX(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?II(Object(n),!0).forEach(function(r){GX(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):II(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function GX(t,e,n){return(e=WX(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function WX(t){var e=$X(t,"string");return typeof e=="symbol"?e:e+""}function $X(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Jo(t,e){var n=VX({},t),r=e,i=Object.keys(e),s=i.reduce((o,a)=>(o[a]===void 0&&r[a]!==void 0&&(o[a]=r[a]),o),n);return s}function XX(t,e){const n=new Map;for(let r=0;r<t.length;r++){const i=t[r],s=e(i,r,t);n.has(s)||n.set(s,i)}return Array.from(n.values())}function qX(t,e){return function(...n){return t.apply(this,n.slice(0,e))}}function _5(t){return t}function KX(t){return function(e){return Kh(e,t)}}function YT(t){return t==null||typeof t!="object"&&typeof t!="function"}function YX(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function ZX(t){return Object.getOwnPropertySymbols(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}function LP(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const QX="[object RegExp]",w5="[object String]",S5="[object Number]",M5="[object Boolean]",E5="[object Arguments]",JX="[object Symbol]",eq="[object Date]",tq="[object Map]",nq="[object Set]",rq="[object Array]",iq="[object ArrayBuffer]",sq="[object Object]",oq="[object DataView]",aq="[object Uint8Array]",lq="[object Uint8ClampedArray]",cq="[object Uint16Array]",uq="[object Uint32Array]",dq="[object Int8Array]",fq="[object Int16Array]",hq="[object Int32Array]",pq="[object Float32Array]",mq="[object Float64Array]",kI=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})();function gq(t){return typeof kI.Buffer<"u"&&kI.Buffer.isBuffer(t)}function vq(t,e){return Jf(t,void 0,t,new Map,e)}function Jf(t,e,n,r=new Map,i=void 0){const s=i==null?void 0:i(t,e,n,r);if(s!==void 0)return s;if(YT(t))return t;if(r.has(t))return r.get(t);if(Array.isArray(t)){const o=new Array(t.length);r.set(t,o);for(let a=0;a<t.length;a++)o[a]=Jf(t[a],a,n,r,i);return Object.hasOwn(t,"index")&&(o.index=t.index),Object.hasOwn(t,"input")&&(o.input=t.input),o}if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){const o=new RegExp(t.source,t.flags);return o.lastIndex=t.lastIndex,o}if(t instanceof Map){const o=new Map;r.set(t,o);for(const[a,l]of t)o.set(a,Jf(l,a,n,r,i));return o}if(t instanceof Set){const o=new Set;r.set(t,o);for(const a of t)o.add(Jf(a,void 0,n,r,i));return o}if(gq(t))return t.subarray();if(YX(t)){const o=new(Object.getPrototypeOf(t)).constructor(t.length);r.set(t,o);for(let a=0;a<t.length;a++)o[a]=Jf(t[a],a,n,r,i);return o}if(t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer)return t.slice(0);if(t instanceof DataView){const o=new DataView(t.buffer.slice(0),t.byteOffset,t.byteLength);return r.set(t,o),ka(o,t,n,r,i),o}if(typeof File<"u"&&t instanceof File){const o=new File([t],t.name,{type:t.type});return r.set(t,o),ka(o,t,n,r,i),o}if(typeof Blob<"u"&&t instanceof Blob){const o=new Blob([t],{type:t.type});return r.set(t,o),ka(o,t,n,r,i),o}if(t instanceof Error){const o=structuredClone(t);return r.set(t,o),o.message=t.message,o.name=t.name,o.stack=t.stack,o.cause=t.cause,o.constructor=t.constructor,ka(o,t,n,r,i),o}if(t instanceof Boolean){const o=new Boolean(t.valueOf());return r.set(t,o),ka(o,t,n,r,i),o}if(t instanceof Number){const o=new Number(t.valueOf());return r.set(t,o),ka(o,t,n,r,i),o}if(t instanceof String){const o=new String(t.valueOf());return r.set(t,o),ka(o,t,n,r,i),o}if(typeof t=="object"&&yq(t)){const o=Object.create(Object.getPrototypeOf(t));return r.set(t,o),ka(o,t,n,r,i),o}return t}function ka(t,e,n=t,r,i){const s=[...Object.keys(e),...ZX(e)];for(let o=0;o<s.length;o++){const a=s[o],l=Object.getOwnPropertyDescriptor(t,a);(l==null||l.writable)&&(t[a]=Jf(e[a],a,n,r,i))}}function yq(t){switch(LP(t)){case E5:case rq:case iq:case oq:case M5:case eq:case pq:case mq:case dq:case fq:case hq:case tq:case S5:case sq:case QX:case nq:case w5:case JX:case aq:case lq:case cq:case uq:return!0;default:return!1}}function xq(t){return Jf(t,void 0,t,new Map,void 0)}function j_(t,e){return t===e||Number.isNaN(t)&&Number.isNaN(e)}function A5(t){return t!==null&&(typeof t=="object"||typeof t=="function")}function T5(t,e,n){return typeof n!="function"?T5(t,e,()=>{}):ZT(t,e,function r(i,s,o,a,l,c){const d=n(i,s,o,a,l,c);return d!==void 0?!!d:ZT(i,s,r,c,!1)},new Map,!0)}function ZT(t,e,n,r,i=!1){if(e===t)return!0;switch(typeof e){case"object":return bq(t,e,n,r);case"function":return Object.keys(e).length>0?ZT(t,{...e},n,r,i):j_(t,e);default:return A5(t)&&i?typeof e=="string"?e==="":!0:j_(t,e)}}function bq(t,e,n,r){if(e==null)return!0;if(Array.isArray(e))return C5(t,e,n,r);if(e instanceof Map)return _q(t,e,n,r);if(e instanceof Set)return wq(t,e,n,r);const i=Object.keys(e);if(t==null||YT(t))return i.length===0;if(i.length===0)return!0;if(r!=null&&r.has(e))return r.get(e)===t;r==null||r.set(e,t);try{for(let s=0;s<i.length;s++){const o=i[s];if(!YT(t)&&!(o in t)||e[o]===void 0&&t[o]!==void 0||e[o]===null&&t[o]!==null||!n(t[o],e[o],o,t,e,r))return!1}return!0}finally{r==null||r.delete(e)}}function _q(t,e,n,r){if(e.size===0)return!0;if(!(t instanceof Map))return!1;for(const[i,s]of e.entries())if(n(t.get(i),s,i,t,e,r)===!1)return!1;return!0}function C5(t,e,n,r){if(e.length===0)return!0;if(!Array.isArray(t))return!1;const i=new Set;for(let s=0;s<e.length;s++){const o=e[s];let a=!1;for(let l=0;l<t.length;l++){if(i.has(l))continue;const c=t[l];let d=!1;if(n(c,o,s,t,e,r)&&(d=!0),d){i.add(l),a=!0;break}}if(!a)return!1}return!0}function wq(t,e,n,r){return e.size===0?!0:t instanceof Set?C5([...t],[...e],n,r):!1}function P5(t,e){return T5(t,e,()=>{})}function Sq(t){return t=xq(t),e=>P5(e,t)}function Mq(t,e){return vq(t,(n,r,i,s)=>{if(typeof t=="object"){if(LP(t)==="[object Object]"&&typeof t.constructor!="function"){const o={};return s.set(t,o),ka(o,t,i,s),o}switch(Object.prototype.toString.call(t)){case S5:case w5:case M5:{const o=new t.constructor(t==null?void 0:t.valueOf());return ka(o,t),o}case E5:{const o={};return ka(o,t),o.length=t.length,o[Symbol.iterator]=t[Symbol.iterator],o}default:return}}})}function Eq(t){return Mq(t)}const Aq=/^(?:0|[1-9]\d*)$/;function R5(t,e=Number.MAX_SAFE_INTEGER){switch(typeof t){case"number":return Number.isInteger(t)&&t>=0&&t<e;case"symbol":return!1;case"string":return Aq.test(t)}}function Tq(t){return t!==null&&typeof t=="object"&&LP(t)==="[object Arguments]"}function Cq(t,e){let n;if(Array.isArray(e)?n=e:typeof e=="string"&&g5(e)&&(t==null?void 0:t[e])==null?n=IP(e):n=[e],n.length===0)return!1;let r=t;for(let i=0;i<n.length;i++){const s=n[i];if((r==null||!Object.hasOwn(r,s))&&!((Array.isArray(r)||Tq(r))&&R5(s)&&s<r.length))return!1;r=r[s]}return!0}function Pq(t,e){switch(typeof t){case"object":Object.is(t==null?void 0:t.valueOf(),-0)&&(t="-0");break;case"number":t=NP(t);break}return e=Eq(e),function(n){const r=Kh(n,t);return r===void 0?Cq(n,t):e===void 0?r===void 0:P5(r,e)}}function Rq(t){if(t==null)return _5;switch(typeof t){case"function":return t;case"object":return Array.isArray(t)&&t.length===2?Pq(t[0],t[1]):Sq(t);case"string":case"symbol":case"number":return KX(t)}}function Nq(t){return Number.isSafeInteger(t)&&t>=0}function N5(t){return t!=null&&typeof t!="function"&&Nq(t.length)}function Iq(t){return typeof t=="object"&&t!==null}function kq(t){return Iq(t)&&N5(t)}function OI(t,e=_5){return kq(t)?XX(Array.from(t),qX(Rq(e),1)):[]}function Oq(t,e,n){return e===!0?OI(t,n):typeof e=="function"?OI(t,e):t}var hE={exports:{}},pE={},mE={exports:{}},gE={};/**
|
||
* @license React
|
||
* use-sync-external-store-shim.production.js
|
||
*
|
||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var LI;function Lq(){if(LI)return gE;LI=1;var t=Wh();function e(f,m){return f===m&&(f!==0||1/f===1/m)||f!==f&&m!==m}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,s=t.useLayoutEffect,o=t.useDebugValue;function a(f,m){var y=m(),x=r({inst:{value:y,getSnapshot:m}}),S=x[0].inst,_=x[1];return s(function(){S.value=y,S.getSnapshot=m,l(S)&&_({inst:S})},[f,y,m]),i(function(){return l(S)&&_({inst:S}),f(function(){l(S)&&_({inst:S})})},[f]),o(y),y}function l(f){var m=f.getSnapshot;f=f.value;try{var y=m();return!n(f,y)}catch{return!0}}function c(f,m){return m()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return gE.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:d,gE}var DI;function Dq(){return DI||(DI=1,mE.exports=Lq()),mE.exports}/**
|
||
* @license React
|
||
* use-sync-external-store-shim/with-selector.production.js
|
||
*
|
||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var UI;function Uq(){if(UI)return pE;UI=1;var t=Wh(),e=Dq();function n(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,s=t.useRef,o=t.useEffect,a=t.useMemo,l=t.useDebugValue;return pE.useSyncExternalStoreWithSelector=function(c,d,f,m,y){var x=s(null);if(x.current===null){var S={hasValue:!1,value:null};x.current=S}else S=x.current;x=a(function(){function w(N){if(!A){if(A=!0,T=N,N=m(N),y!==void 0&&S.hasValue){var D=S.value;if(y(D,N))return C=D}return C=N}if(D=C,r(T,N))return D;var F=m(N);return y!==void 0&&y(D,F)?(T=N,D):(T=N,C=F)}var A=!1,T,C,O=f===void 0?null:f;return[function(){return w(d())},O===null?void 0:function(){return w(O())}]},[d,f,m,y]);var _=i(c,x[0],x[1]);return o(function(){S.hasValue=!0,S.value=_},[_]),l(_),_},pE}var jI;function jq(){return jI||(jI=1,hE.exports=Uq()),hE.exports}var Fq=jq(),DP=R.createContext(null),zq=t=>t,Wr=()=>{var t=R.useContext(DP);return t?t.store.dispatch:zq},F_=()=>{},Bq=()=>F_,Hq=(t,e)=>t===e;function zt(t){var e=R.useContext(DP),n=R.useMemo(()=>e?r=>{if(r!=null)return t(r)}:F_,[e,t]);return Fq.useSyncExternalStoreWithSelector(e?e.subscription.addNestedSub:Bq,e?e.store.getState:F_,e?e.store.getState:F_,n,Hq)}function Vq(t,e=`expected a function, instead received ${typeof t}`){if(typeof t!="function")throw new TypeError(e)}function Gq(t,e="expected all items to be functions, instead received the following types: "){if(!t.every(n=>typeof n=="function")){const n=t.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${e}[${n}]`)}}var FI=t=>Array.isArray(t)?t:[t];function Wq(t){const e=Array.isArray(t[0])?t[0]:t;return Gq(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function $q(t,e){const n=[],{length:r}=t;for(let i=0;i<r;i++)n.push(t[i].apply(null,e));return n}var Xq=class{constructor(t){this.value=t}deref(){return this.value}},qq=()=>typeof WeakRef>"u"?Xq:WeakRef,I5=qq(),Kq=0,zI=1;function bb(){return{s:Kq,v:void 0,o:null,p:null}}function Yq(t){return t instanceof I5?t.deref():t}function k5(t,e={}){let n=bb();const{resultEqualityCheck:r}=e;let i,s=0;function o(){let a=n;const{length:l}=arguments;for(let f=0,m=l;f<m;f++){const y=arguments[f];if(typeof y=="function"||typeof y=="object"&&y!==null){let x=a.o;x===null&&(a.o=x=new WeakMap);const S=x.get(y);S===void 0?(a=bb(),x.set(y,a)):a=S}else{let x=a.p;x===null&&(a.p=x=new Map);const S=x.get(y);S===void 0?(a=bb(),x.set(y,a)):a=S}}const c=a;let d;if(a.s===zI)d=a.v;else if(d=t.apply(null,arguments),s++,r){const f=Yq(i);f!=null&&r(f,d)&&(d=f,s!==0&&s--),i=typeof d=="object"&&d!==null||typeof d=="function"?new I5(d):d}return c.s=zI,c.v=d,d}return o.clearCache=()=>{n=bb(),o.resetResultsCount()},o.resultsCount=()=>s,o.resetResultsCount=()=>{s=0},o}function Zq(t,...e){const n=typeof t=="function"?{memoize:t,memoizeOptions:e}:t,r=(...i)=>{let s=0,o=0,a,l={},c=i.pop();typeof c=="object"&&(l=c,c=i.pop()),Vq(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);const d={...n,...l},{memoize:f,memoizeOptions:m=[],argsMemoize:y=k5,argsMemoizeOptions:x=[]}=d,S=FI(m),_=FI(x),w=Wq(i),A=f(function(){return s++,c.apply(null,arguments)},...S),T=y(function(){o++;const O=$q(w,arguments);return a=A.apply(null,O),a},..._);return Object.assign(T,{resultFunc:c,memoizedResultFunc:A,dependencies:w,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>a,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:f,argsMemoize:y})};return Object.assign(r,{withTypes:()=>r}),r}var Oe=Zq(k5);function Qq(t,e=1){const n=[],r=Math.floor(e),i=(s,o)=>{for(let a=0;a<s.length;a++){const l=s[a];Array.isArray(l)&&o<r?i(l,o+1):n.push(l)}};return i(t,0),n}function QT(t,e,n){return A5(n)&&(typeof e=="number"&&N5(n)&&R5(e)&&e<n.length||typeof e=="string"&&e in n)?j_(n[e],t):!1}function BI(t){return typeof t=="symbol"?1:t===null?2:t===void 0?3:t!==t?4:0}const Jq=(t,e,n)=>{if(t!==e){const r=BI(t),i=BI(e);if(r===i&&r===0){if(t<e)return n==="desc"?1:-1;if(t>e)return n==="desc"?-1:1}return n==="desc"?i-r:r-i}return 0};function O5(t){return typeof t=="symbol"||t instanceof Symbol}const eK=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,tK=/^\w*$/;function nK(t,e){return Array.isArray(t)?!1:typeof t=="number"||typeof t=="boolean"||t==null||O5(t)?!0:typeof t=="string"&&(tK.test(t)||!eK.test(t))||e!=null}function rK(t,e,n,r){if(t==null)return[];n=n,Array.isArray(t)||(t=Object.values(t)),Array.isArray(e)||(e=e==null?[null]:[e]),e.length===0&&(e=[null]),Array.isArray(n)||(n=n==null?[]:[n]),n=n.map(a=>String(a));const i=(a,l)=>{let c=a;for(let d=0;d<l.length&&c!=null;++d)c=c[l[d]];return c},s=(a,l)=>l==null||a==null?l:typeof a=="object"&&"key"in a?Object.hasOwn(l,a.key)?l[a.key]:i(l,a.path):typeof a=="function"?a(l):Array.isArray(a)?i(l,a):typeof l=="object"?l[a]:l,o=e.map(a=>(Array.isArray(a)&&a.length===1&&(a=a[0]),a==null||typeof a=="function"||Array.isArray(a)||nK(a)?a:{key:a,path:IP(a)}));return t.map(a=>({original:a,criteria:o.map(l=>s(l,a))})).slice().sort((a,l)=>{for(let c=0;c<o.length;c++){const d=Jq(a.criteria[c],l.criteria[c],n[c]);if(d!==0)return d}return 0}).map(a=>a.original)}function J1(t,...e){const n=e.length;return n>1&&QT(t,e[0],e[1])?e=[]:n>2&&QT(e[0],e[1],e[2])&&(e=[e[0]]),rK(t,Qq(e),["asc"])}var L5=t=>t.legend.settings,iK=t=>t.legend.size,sK=t=>t.legend.payload;Oe([sK,L5],(t,e)=>{var n=e.itemSorter,r=t.flat(1);return n?J1(r,n):r});function oK(t,e){return uK(t)||cK(t,e)||lK(t,e)||aK()}function aK(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lK(t,e){if(t){if(typeof t=="string")return HI(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?HI(t,e):void 0}}function HI(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function cK(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function uK(t){if(Array.isArray(t))return t}var _b=1;function VI(t,e){return Math.abs(t.height-e.height)>_b||Math.abs(t.left-e.left)>_b||Math.abs(t.top-e.top)>_b||Math.abs(t.width-e.width)>_b}function GI(t){var e=t.getBoundingClientRect();return{height:e.height,left:e.left,top:e.top,width:e.width}}function dK(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=R.useState({height:0,left:0,top:0,width:0}),n=oK(e,2),r=n[0],i=n[1],s=R.useRef(null),o=R.useRef(r);o.current=r;var a=R.useCallback(l=>{if(s.current!=null&&(s.current.disconnect(),s.current=null),l!=null){var c=GI(l);if(VI(c,o.current)&&i(c),typeof ResizeObserver<"u"){var d=new ResizeObserver(()=>{var f=GI(l);VI(f,o.current)&&i(f)});d.observe(l),s.current=d}}},[...t]);return R.useEffect(()=>()=>{var l;(l=s.current)===null||l===void 0||l.disconnect()},[]),[r,a]}function Li(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var fK=typeof Symbol=="function"&&Symbol.observable||"@@observable",WI=fK,vE=()=>Math.random().toString(36).substring(7).split("").join("."),hK={INIT:`@@redux/INIT${vE()}`,REPLACE:`@@redux/REPLACE${vE()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${vE()}`},sw=hK;function UP(t){if(typeof t!="object"||t===null)return!1;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||Object.getPrototypeOf(t)===null}function D5(t,e,n){if(typeof t!="function")throw new Error(Li(2));if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(Li(0));if(typeof e=="function"&&typeof n>"u"&&(n=e,e=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Li(1));return n(D5)(t,e)}let r=t,i=e,s=new Map,o=s,a=0,l=!1;function c(){o===s&&(o=new Map,s.forEach((_,w)=>{o.set(w,_)}))}function d(){if(l)throw new Error(Li(3));return i}function f(_){if(typeof _!="function")throw new Error(Li(4));if(l)throw new Error(Li(5));let w=!0;c();const A=a++;return o.set(A,_),function(){if(w){if(l)throw new Error(Li(6));w=!1,c(),o.delete(A),s=null}}}function m(_){if(!UP(_))throw new Error(Li(7));if(typeof _.type>"u")throw new Error(Li(8));if(typeof _.type!="string")throw new Error(Li(17));if(l)throw new Error(Li(9));try{l=!0,i=r(i,_)}finally{l=!1}return(s=o).forEach(A=>{A()}),_}function y(_){if(typeof _!="function")throw new Error(Li(10));r=_,m({type:sw.REPLACE})}function x(){const _=f;return{subscribe(w){if(typeof w!="object"||w===null)throw new Error(Li(11));function A(){const C=w;C.next&&C.next(d())}return A(),{unsubscribe:_(A)}},[WI](){return this}}}return m({type:sw.INIT}),{dispatch:m,subscribe:f,getState:d,replaceReducer:y,[WI]:x}}function pK(t){Object.keys(t).forEach(e=>{const n=t[e];if(typeof n(void 0,{type:sw.INIT})>"u")throw new Error(Li(12));if(typeof n(void 0,{type:sw.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Li(13))})}function U5(t){const e=Object.keys(t),n={};for(let s=0;s<e.length;s++){const o=e[s];typeof t[o]=="function"&&(n[o]=t[o])}const r=Object.keys(n);let i;try{pK(n)}catch(s){i=s}return function(o={},a){if(i)throw i;let l=!1;const c={};for(let d=0;d<r.length;d++){const f=r[d],m=n[f],y=o[f],x=m(y,a);if(typeof x>"u")throw a&&a.type,new Error(Li(14));c[f]=x,l=l||x!==y}return l=l||r.length!==Object.keys(o).length,l?c:o}}function ow(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,n)=>(...r)=>e(n(...r)))}function mK(...t){return e=>(n,r)=>{const i=e(n,r);let s=()=>{throw new Error(Li(15))};const o={getState:i.getState,dispatch:(l,...c)=>s(l,...c)},a=t.map(l=>l(o));return s=ow(...a)(i.dispatch),{...i,dispatch:s}}}function j5(t){return UP(t)&&"type"in t&&typeof t.type=="string"}var F5=Symbol.for("immer-nothing"),$I=Symbol.for("immer-draftable"),Cs=Symbol.for("immer-state");function Ua(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var bo=Object,wg=bo.getPrototypeOf,aw="constructor",eS="prototype",JT="configurable",lw="enumerable",z_="writable",cy="value",Kc=t=>!!t&&!!t[Cs];function Ba(t){var e;return t?z5(t)||nS(t)||!!t[$I]||!!((e=t[aw])!=null&&e[$I])||rS(t)||iS(t):!1}var gK=bo[eS][aw].toString(),XI=new WeakMap;function z5(t){if(!t||!jP(t))return!1;const e=wg(t);if(e===null||e===bo[eS])return!0;const n=bo.hasOwnProperty.call(e,aw)&&e[aw];if(n===Object)return!0;if(!jm(n))return!1;let r=XI.get(n);return r===void 0&&(r=Function.toString.call(n),XI.set(n,r)),r===gK}function tS(t,e,n=!0){Gy(t)===0?(n?Reflect.ownKeys(t):bo.keys(t)).forEach(i=>{e(i,t[i],t)}):t.forEach((r,i)=>e(i,r,t))}function Gy(t){const e=t[Cs];return e?e.type_:nS(t)?1:rS(t)?2:iS(t)?3:0}var qI=(t,e,n=Gy(t))=>n===2?t.has(e):bo[eS].hasOwnProperty.call(t,e),eC=(t,e,n=Gy(t))=>n===2?t.get(e):t[e],cw=(t,e,n,r=Gy(t))=>{r===2?t.set(e,n):r===3?t.add(n):t[e]=n};function vK(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}var nS=Array.isArray,rS=t=>t instanceof Map,iS=t=>t instanceof Set,jP=t=>typeof t=="object",jm=t=>typeof t=="function",yE=t=>typeof t=="boolean";function yK(t){const e=+t;return Number.isInteger(e)&&String(e)===t}var Rc=t=>t.copy_||t.base_,FP=t=>t.modified_?t.copy_:t.base_;function tC(t,e){if(rS(t))return new Map(t);if(iS(t))return new Set(t);if(nS(t))return Array[eS].slice.call(t);const n=z5(t);if(e===!0||e==="class_only"&&!n){const r=bo.getOwnPropertyDescriptors(t);delete r[Cs];let i=Reflect.ownKeys(r);for(let s=0;s<i.length;s++){const o=i[s],a=r[o];a[z_]===!1&&(a[z_]=!0,a[JT]=!0),(a.get||a.set)&&(r[o]={[JT]:!0,[z_]:!0,[lw]:a[lw],[cy]:t[o]})}return bo.create(wg(t),r)}else{const r=wg(t);if(r!==null&&n)return{...t};const i=bo.create(r);return bo.assign(i,t)}}function zP(t,e=!1){return sS(t)||Kc(t)||!Ba(t)||(Gy(t)>1&&bo.defineProperties(t,{set:wb,add:wb,clear:wb,delete:wb}),bo.freeze(t),e&&tS(t,(n,r)=>{zP(r,!0)},!1)),t}function xK(){Ua(2)}var wb={[cy]:xK};function sS(t){return t===null||!jP(t)?!0:bo.isFrozen(t)}var uw="MapSet",nC="Patches",KI="ArrayMethods",B5={};function Nh(t){const e=B5[t];return e||Ua(0,t),e}var YI=t=>!!B5[t],uy,H5=()=>uy,bK=(t,e)=>({drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:YI(uw)?Nh(uw):void 0,arrayMethodsPlugin_:YI(KI)?Nh(KI):void 0});function ZI(t,e){e&&(t.patchPlugin_=Nh(nC),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function rC(t){iC(t),t.drafts_.forEach(_K),t.drafts_=null}function iC(t){t===uy&&(uy=t.parent_)}var QI=t=>uy=bK(uy,t);function _K(t){const e=t[Cs];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function JI(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];if(t!==void 0&&t!==n){n[Cs].modified_&&(rC(e),Ua(4)),Ba(t)&&(t=ek(e,t));const{patchPlugin_:i}=e;i&&i.generateReplacementPatches_(n[Cs].base_,t,e)}else t=ek(e,n);return wK(e,t,!0),rC(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==F5?t:void 0}function ek(t,e){if(sS(e))return e;const n=e[Cs];if(!n)return dw(e,t.handledSet_,t);if(!oS(n,t))return e;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:r}=n;if(r)for(;r.length>0;)r.pop()(t);W5(n,t)}return n.copy_}function wK(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&zP(e,n)}function V5(t){t.finalized_=!0,t.scope_.unfinalizedDrafts_--}var oS=(t,e)=>t.scope_===e,SK=[];function G5(t,e,n,r){const i=Rc(t),s=t.type_;if(r!==void 0&&eC(i,r,s)===e){cw(i,r,n,s);return}if(!t.draftLocations_){const a=t.draftLocations_=new Map;tS(i,(l,c)=>{if(Kc(c)){const d=a.get(c)||[];d.push(l),a.set(c,d)}})}const o=t.draftLocations_.get(e)??SK;for(const a of o)cw(i,a,n,s)}function MK(t,e,n){t.callbacks_.push(function(i){var a;const s=e;if(!s||!oS(s,i))return;(a=i.mapSetPlugin_)==null||a.fixSetContents(s);const o=FP(s);G5(t,s.draft_??s,o,n),W5(s,i)})}function W5(t,e){var r;if(t.modified_&&!t.finalized_&&(t.type_===3||t.type_===1&&t.allIndicesReassigned_||(((r=t.assigned_)==null?void 0:r.size)??0)>0)){const{patchPlugin_:i}=e;if(i){const s=i.getPath(t);s&&i.generatePatches_(t,s,e)}V5(t)}}function EK(t,e,n){const{scope_:r}=t;if(Kc(n)){const i=n[Cs];oS(i,r)&&i.callbacks_.push(function(){B_(t);const o=FP(i);G5(t,n,o,e)})}else Ba(n)&&t.callbacks_.push(function(){const s=Rc(t);t.type_===3?s.has(n)&&dw(n,r.handledSet_,r):eC(s,e,t.type_)===n&&r.drafts_.length>1&&(t.assigned_.get(e)??!1)===!0&&t.copy_&&dw(eC(t.copy_,e,t.type_),r.handledSet_,r)})}function dw(t,e,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Kc(t)||e.has(t)||!Ba(t)||sS(t)||(e.add(t),tS(t,(r,i)=>{if(Kc(i)){const s=i[Cs];if(oS(s,n)){const o=FP(s);cw(t,r,o,t.type_),V5(s)}}else Ba(i)&&dw(i,e,n)})),t}function AK(t,e){const n=nS(t),r={type_:n?1:0,scope_:e?e.scope_:H5(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=r,s=fw;n&&(i=[r],s=dy);const{revoke:o,proxy:a}=Proxy.revocable(i,s);return r.draft_=a,r.revoke_=o,[a,r]}var fw={get(t,e){if(e===Cs)return t;let n=t.scope_.arrayMethodsPlugin_;const r=t.type_===1&&typeof e=="string";if(r&&n!=null&&n.isArrayOperationMethod(e))return n.createMethodInterceptor(t,e);const i=Rc(t);if(!qI(i,e,t.type_))return TK(t,i,e);const s=i[e];if(t.finalized_||!Ba(s)||r&&t.operationMethod&&(n!=null&&n.isMutatingArrayMethod(t.operationMethod))&&yK(e))return s;if(s===xE(t.base_,e)){B_(t);const o=t.type_===1?+e:e,a=oC(t.scope_,s,t,o);return t.copy_[o]=a}return s},has(t,e){return e in Rc(t)},ownKeys(t){return Reflect.ownKeys(Rc(t))},set(t,e,n){const r=$5(Rc(t),e);if(r!=null&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const i=xE(Rc(t),e),s=i==null?void 0:i[Cs];if(s&&s.base_===n)return t.copy_[e]=n,t.assigned_.set(e,!1),!0;if(vK(n,i)&&(n!==void 0||qI(t.base_,e,t.type_)))return!0;B_(t),sC(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_.set(e,!0),EK(t,e,n)),!0},deleteProperty(t,e){return B_(t),xE(t.base_,e)!==void 0||e in t.base_?(t.assigned_.set(e,!1),sC(t)):t.assigned_.delete(e),t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=Rc(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{[z_]:!0,[JT]:t.type_!==1||e!=="length",[lw]:r[lw],[cy]:n[e]}},defineProperty(){Ua(11)},getPrototypeOf(t){return wg(t.base_)},setPrototypeOf(){Ua(12)}},dy={};for(let t in fw){let e=fw[t];dy[t]=function(){const n=arguments;return n[0]=n[0][0],e.apply(this,n)}}dy.deleteProperty=function(t,e){return dy.set.call(this,t,e,void 0)};dy.set=function(t,e,n){return fw.set.call(this,t[0],e,n,t[0])};function xE(t,e){const n=t[Cs];return(n?Rc(n):t)[e]}function TK(t,e,n){var i;const r=$5(e,n);return r?cy in r?r[cy]:(i=r.get)==null?void 0:i.call(t.draft_):void 0}function $5(t,e){if(!(e in t))return;let n=wg(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=wg(n)}}function sC(t){t.modified_||(t.modified_=!0,t.parent_&&sC(t.parent_))}function B_(t){t.copy_||(t.assigned_=new Map,t.copy_=tC(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var CK=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(n,r,i)=>{if(jm(n)&&!jm(r)){const o=r;r=n;const a=this;return function(c=o,...d){return a.produce(c,f=>r.call(this,f,...d))}}jm(r)||Ua(6),i!==void 0&&!jm(i)&&Ua(7);let s;if(Ba(n)){const o=QI(this),a=oC(o,n,void 0);let l=!0;try{s=r(a),l=!1}finally{l?rC(o):iC(o)}return ZI(o,i),JI(s,o)}else if(!n||!jP(n)){if(s=r(n),s===void 0&&(s=n),s===F5&&(s=void 0),this.autoFreeze_&&zP(s,!0),i){const o=[],a=[];Nh(nC).generateReplacementPatches_(n,s,{patches_:o,inversePatches_:a}),i(o,a)}return s}else Ua(1,n)},this.produceWithPatches=(n,r)=>{if(jm(n))return(a,...l)=>this.produceWithPatches(a,c=>n(c,...l));let i,s;return[this.produce(n,r,(a,l)=>{i=a,s=l}),i,s]},yE(e==null?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),yE(e==null?void 0:e.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),yE(e==null?void 0:e.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Ba(e)||Ua(8),Kc(e)&&(e=$o(e));const n=QI(this),r=oC(n,e,void 0);return r[Cs].isManual_=!0,iC(n),r}finishDraft(e,n){const r=e&&e[Cs];(!r||!r.isManual_)&&Ua(9);const{scope_:i}=r;return ZI(i,n),JI(void 0,i)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,n){let r;for(r=n.length-1;r>=0;r--){const s=n[r];if(s.path.length===0&&s.op==="replace"){e=s.value;break}}r>-1&&(n=n.slice(r+1));const i=Nh(nC).applyPatches_;return Kc(e)?i(e,n):this.produce(e,s=>i(s,n))}};function oC(t,e,n,r){const[i,s]=rS(e)?Nh(uw).proxyMap_(e,n):iS(e)?Nh(uw).proxySet_(e,n):AK(e,n);return((n==null?void 0:n.scope_)??H5()).drafts_.push(i),s.callbacks_=(n==null?void 0:n.callbacks_)??[],s.key_=r,n&&r!==void 0?MK(n,s,r):s.callbacks_.push(function(l){var d;(d=l.mapSetPlugin_)==null||d.fixSetContents(s);const{patchPlugin_:c}=l;s.modified_&&c&&c.generatePatches_(s,[],l)}),i}function $o(t){return Kc(t)||Ua(10,t),X5(t)}function X5(t){if(!Ba(t)||sS(t))return t;const e=t[Cs];let n,r=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=tC(t,e.scope_.immer_.useStrictShallowCopy_),r=e.scope_.immer_.shouldUseStrictIteration()}else n=tC(t,!0);return tS(n,(i,s)=>{cw(n,i,X5(s))},r),e&&(e.finalized_=!1),n}var PK=new CK,q5=PK.produce;function K5(t){return({dispatch:n,getState:r})=>i=>s=>typeof s=="function"?s(n,r,t):i(s)}var RK=K5(),NK=K5,IK=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?ow:ow.apply(null,arguments)};function Mo(t,e){function n(...r){if(e){let i=e(...r);if(!i)throw new Error(wo(0));return{type:t,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:t,payload:r[0]}}return n.toString=()=>`${t}`,n.type=t,n.match=r=>j5(r)&&r.type===t,n}var Y5=class L0 extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,L0.prototype)}static get[Symbol.species](){return L0}concat(...e){return super.concat.apply(this,e)}prepend(...e){return e.length===1&&Array.isArray(e[0])?new L0(...e[0].concat(this)):new L0(...e.concat(this))}};function tk(t){return Ba(t)?q5(t,()=>{}):t}function Sb(t,e,n){return t.has(e)?t.get(e):t.set(e,n(e)).get(e)}function kK(t){return typeof t=="boolean"}var OK=()=>function(e){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:s=!0}=e??{};let o=new Y5;return n&&(kK(n)?o.push(RK):o.push(NK(n.extraArgument))),o},Z5="RTK_autoBatch",sr=()=>t=>({payload:t,meta:{[Z5]:!0}}),nk=t=>e=>{setTimeout(e,t)},LK=(t,e)=>n=>{let r=!1;const i=()=>{r||(r=!0,cancelAnimationFrame(s),clearTimeout(o),n())},s=t(i),o=setTimeout(i,e)},Q5=(t={type:"raf"})=>e=>(...n)=>{const r=e(...n);let i=!0,s=!1,o=!1;const a=new Set,l=t.type==="tick"?queueMicrotask:t.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?LK(window.requestAnimationFrame,100):nk(10):t.type==="callback"?t.queueNotification:nk(t.timeout),c=()=>{o=!1,s&&(s=!1,a.forEach(d=>d()))};return Object.assign({},r,{subscribe(d){const f=()=>i&&d(),m=r.subscribe(f);return a.add(d),()=>{m(),a.delete(d)}},dispatch(d){var f;try{return i=!((f=d==null?void 0:d.meta)!=null&&f[Z5]),s=!i,s&&(o||(o=!0,l(c))),r.dispatch(d)}finally{i=!0}}})},DK=t=>function(n){const{autoBatch:r=!0}=n??{};let i=new Y5(t);return r&&i.push(Q5(typeof r=="object"?r:void 0)),i};function UK(t){const e=OK(),{reducer:n=void 0,middleware:r,devTools:i=!0,preloadedState:s=void 0,enhancers:o=void 0}=t||{};let a;if(typeof n=="function")a=n;else if(UP(n))a=U5(n);else throw new Error(wo(1));let l;typeof r=="function"?l=r(e):l=e();let c=ow;i&&(c=IK({trace:!1,...typeof i=="object"&&i}));const d=mK(...l),f=DK(d);let m=typeof o=="function"?o(f):f();const y=c(...m);return D5(a,s,y)}function J5(t){const e={},n=[];let r;const i={addCase(s,o){const a=typeof s=="string"?s:s.type;if(!a)throw new Error(wo(28));if(a in e)throw new Error(wo(29));return e[a]=o,i},addAsyncThunk(s,o){return o.pending&&(e[s.pending.type]=o.pending),o.rejected&&(e[s.rejected.type]=o.rejected),o.fulfilled&&(e[s.fulfilled.type]=o.fulfilled),o.settled&&n.push({matcher:s.settled,reducer:o.settled}),i},addMatcher(s,o){return n.push({matcher:s,reducer:o}),i},addDefaultCase(s){return r=s,i}};return t(i),[e,n,r]}function jK(t){return typeof t=="function"}function FK(t,e){let[n,r,i]=J5(e),s;if(jK(t))s=()=>tk(t());else{const a=tk(t);s=()=>a}function o(a=s(),l){let c=[n[l.type],...r.filter(({matcher:d})=>d(l)).map(({reducer:d})=>d)];return c.filter(d=>!!d).length===0&&(c=[i]),c.reduce((d,f)=>{if(f)if(Kc(d)){const y=f(d,l);return y===void 0?d:y}else{if(Ba(d))return q5(d,m=>f(m,l));{const m=f(d,l);if(m===void 0){if(d===null)return d;throw Error("A case reducer on a non-draftable value must not return undefined")}return m}}return d},a)}return o.getInitialState=s,o}var zK="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",BK=(t=21)=>{let e="",n=t;for(;n--;)e+=zK[Math.random()*64|0];return e},HK=Symbol.for("rtk-slice-createasyncthunk");function VK(t,e){return`${t}/${e}`}function GK({creators:t}={}){var n;const e=(n=t==null?void 0:t.asyncThunk)==null?void 0:n[HK];return function(i){const{name:s,reducerPath:o=s}=i;if(!s)throw new Error(wo(11));const a=(typeof i.reducers=="function"?i.reducers($K()):i.reducers)||{},l=Object.keys(a),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},d={addCase(C,O){const N=typeof C=="string"?C:C.type;if(!N)throw new Error(wo(12));if(N in c.sliceCaseReducersByType)throw new Error(wo(13));return c.sliceCaseReducersByType[N]=O,d},addMatcher(C,O){return c.sliceMatchers.push({matcher:C,reducer:O}),d},exposeAction(C,O){return c.actionCreators[C]=O,d},exposeCaseReducer(C,O){return c.sliceCaseReducersByName[C]=O,d}};l.forEach(C=>{const O=a[C],N={reducerName:C,type:VK(s,C),createNotation:typeof i.reducers=="function"};qK(O)?YK(N,O,d,e):XK(N,O,d)});function f(){const[C={},O=[],N=void 0]=typeof i.extraReducers=="function"?J5(i.extraReducers):[i.extraReducers],D={...C,...c.sliceCaseReducersByType};return FK(i.initialState,F=>{for(let V in D)F.addCase(V,D[V]);for(let V of c.sliceMatchers)F.addMatcher(V.matcher,V.reducer);for(let V of O)F.addMatcher(V.matcher,V.reducer);N&&F.addDefaultCase(N)})}const m=C=>C,y=new Map,x=new WeakMap;let S;function _(C,O){return S||(S=f()),S(C,O)}function w(){return S||(S=f()),S.getInitialState()}function A(C,O=!1){function N(F){let V=F[C];return typeof V>"u"&&O&&(V=Sb(x,N,w)),V}function D(F=m){const V=Sb(y,O,()=>new WeakMap);return Sb(V,F,()=>{const k={};for(const[j,H]of Object.entries(i.selectors??{}))k[j]=WK(H,F,()=>Sb(x,F,w),O);return k})}return{reducerPath:C,getSelectors:D,get selectors(){return D(N)},selectSlice:N}}const T={name:s,reducer:_,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:w,...A(o),injectInto(C,{reducerPath:O,...N}={}){const D=O??o;return C.inject({reducerPath:D,reducer:_},N),{...T,...A(D,!0)}}};return T}}function WK(t,e,n,r){function i(s,...o){let a=e(s);return typeof a>"u"&&r&&(a=n()),t(a,...o)}return i.unwrapped=t,i}var cs=GK();function $K(){function t(e,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...n}}return t.withTypes=()=>t,{reducer(e){return Object.assign({[e.name](...n){return e(...n)}}[e.name],{_reducerDefinitionType:"reducer"})},preparedReducer(e,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:n}},asyncThunk:t}}function XK({type:t,reducerName:e,createNotation:n},r,i){let s,o;if("reducer"in r){if(n&&!KK(r))throw new Error(wo(17));s=r.reducer,o=r.prepare}else s=r;i.addCase(t,s).exposeCaseReducer(e,s).exposeAction(e,o?Mo(t,o):Mo(t))}function qK(t){return t._reducerDefinitionType==="asyncThunk"}function KK(t){return t._reducerDefinitionType==="reducerWithPrepare"}function YK({type:t,reducerName:e},n,r,i){if(!i)throw new Error(wo(18));const{payloadCreator:s,fulfilled:o,pending:a,rejected:l,settled:c,options:d}=n,f=i(t,s,d);r.exposeAction(e,f),o&&r.addCase(f.fulfilled,o),a&&r.addCase(f.pending,a),l&&r.addCase(f.rejected,l),c&&r.addMatcher(f.settled,c),r.exposeCaseReducer(e,{fulfilled:o||Mb,pending:a||Mb,rejected:l||Mb,settled:c||Mb})}function Mb(){}var ZK="task",e4="listener",t4="completed",BP="cancelled",QK=`task-${BP}`,JK=`task-${t4}`,aC=`${e4}-${BP}`,eY=`${e4}-${t4}`,aS=class{constructor(t){fo(this,"code");fo(this,"name","TaskAbortError");fo(this,"message");this.code=t,this.message=`${ZK} ${BP} (reason: ${t})`}},HP=(t,e)=>{if(typeof t!="function")throw new TypeError(wo(32))},hw=()=>{},n4=(t,e=hw)=>(t.catch(e),t),r4=(t,e)=>(t.addEventListener("abort",e,{once:!0}),()=>t.removeEventListener("abort",e)),bh=t=>{if(t.aborted)throw new aS(t.reason)};function i4(t,e){let n=hw;return new Promise((r,i)=>{const s=()=>i(new aS(t.reason));if(t.aborted){s();return}n=r4(t,s),e.finally(()=>n()).then(r,i)}).finally(()=>{n=hw})}var tY=async(t,e)=>{try{return await Promise.resolve(),{status:"ok",value:await t()}}catch(n){return{status:n instanceof aS?"cancelled":"rejected",error:n}}finally{e==null||e()}},pw=t=>e=>n4(i4(t,e).then(n=>(bh(t),n))),s4=t=>{const e=pw(t);return n=>e(new Promise(r=>setTimeout(r,n)))},{assign:Qm}=Object,rk={},lS="listenerMiddleware",nY=(t,e)=>{const n=r=>r4(t,()=>r.abort(t.reason));return(r,i)=>{HP(r);const s=new AbortController;n(s);const o=tY(async()=>{bh(t),bh(s.signal);const a=await r({pause:pw(s.signal),delay:s4(s.signal),signal:s.signal});return bh(s.signal),a},()=>s.abort(JK));return i!=null&&i.autoJoin&&e.push(o.catch(hw)),{result:pw(t)(o),cancel(){s.abort(QK)}}}},rY=(t,e)=>{const n=async(r,i)=>{bh(e);let s=()=>{};const a=[new Promise((l,c)=>{let d=t({predicate:r,effect:(f,m)=>{m.unsubscribe(),l([f,m.getState(),m.getOriginalState()])}});s=()=>{d(),c()}})];i!=null&&a.push(new Promise(l=>setTimeout(l,i,null)));try{const l=await i4(e,Promise.race(a));return bh(e),l}finally{s()}};return((r,i)=>n4(n(r,i)))},o4=t=>{let{type:e,actionCreator:n,matcher:r,predicate:i,effect:s}=t;if(e)i=Mo(e).match;else if(n)e=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(wo(21));return HP(s),{predicate:i,type:e,effect:s}},a4=Qm(t=>{const{type:e,predicate:n,effect:r}=o4(t);return{id:BK(),effect:r,type:e,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(wo(22))}}},{withTypes:()=>a4}),ik=(t,e)=>{const{type:n,effect:r,predicate:i}=o4(e);return Array.from(t.values()).find(s=>(typeof n=="string"?s.type===n:s.predicate===i)&&s.effect===r)},lC=t=>{t.pending.forEach(e=>{e.abort(aC)})},iY=(t,e)=>()=>{for(const n of e.keys())lC(n);t.clear()},sk=(t,e,n)=>{try{t(e,n)}catch(r){setTimeout(()=>{throw r},0)}},l4=Qm(Mo(`${lS}/add`),{withTypes:()=>l4}),sY=Mo(`${lS}/removeAll`),c4=Qm(Mo(`${lS}/remove`),{withTypes:()=>c4}),oY=(...t)=>{console.error(`${lS}/error`,...t)},Wy=(t={})=>{const e=new Map,n=new Map,r=y=>{const x=n.get(y)??0;n.set(y,x+1)},i=y=>{const x=n.get(y)??1;x===1?n.delete(y):n.set(y,x-1)},{extra:s,onError:o=oY}=t;HP(o);const a=y=>(y.unsubscribe=()=>e.delete(y.id),e.set(y.id,y),x=>{y.unsubscribe(),x!=null&&x.cancelActive&&lC(y)}),l=(y=>{const x=ik(e,y)??a4(y);return a(x)});Qm(l,{withTypes:()=>l});const c=y=>{const x=ik(e,y);return x&&(x.unsubscribe(),y.cancelActive&&lC(x)),!!x};Qm(c,{withTypes:()=>c});const d=async(y,x,S,_)=>{const w=new AbortController,A=rY(l,w.signal),T=[];try{y.pending.add(w),r(y),await Promise.resolve(y.effect(x,Qm({},S,{getOriginalState:_,condition:(C,O)=>A(C,O).then(Boolean),take:A,delay:s4(w.signal),pause:pw(w.signal),extra:s,signal:w.signal,fork:nY(w.signal,T),unsubscribe:y.unsubscribe,subscribe:()=>{e.set(y.id,y)},cancelActiveListeners:()=>{y.pending.forEach((C,O,N)=>{C!==w&&(C.abort(aC),N.delete(C))})},cancel:()=>{w.abort(aC),y.pending.delete(w)},throwIfCancelled:()=>{bh(w.signal)}})))}catch(C){C instanceof aS||sk(o,C,{raisedBy:"effect"})}finally{await Promise.all(T),w.abort(eY),i(y),y.pending.delete(w)}},f=iY(e,n);return{middleware:y=>x=>S=>{if(!j5(S))return x(S);if(l4.match(S))return l(S.payload);if(sY.match(S)){f();return}if(c4.match(S))return c(S.payload);let _=y.getState();const w=()=>{if(_===rk)throw new Error(wo(23));return _};let A;try{if(A=x(S),e.size>0){const T=y.getState(),C=Array.from(e.values());for(const O of C){let N=!1;try{N=O.predicate(S,T,_)}catch(D){N=!1,sk(o,D,{raisedBy:"predicate"})}N&&d(O,S,y,w)}}}finally{_=rk}return A},startListening:l,stopListening:c,clearListeners:f}};function wo(t){return`Minified Redux Toolkit error #${t}; visit https://redux-toolkit.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var aY={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},u4=cs({name:"chartLayout",initialState:aY,reducers:{setLayout(t,e){t.layoutType=e.payload},setChartSize(t,e){t.width=e.payload.width,t.height=e.payload.height},setMargin(t,e){var n,r,i,s;t.margin.top=(n=e.payload.top)!==null&&n!==void 0?n:0,t.margin.right=(r=e.payload.right)!==null&&r!==void 0?r:0,t.margin.bottom=(i=e.payload.bottom)!==null&&i!==void 0?i:0,t.margin.left=(s=e.payload.left)!==null&&s!==void 0?s:0},setScale(t,e){t.scale=e.payload}}}),cS=u4.actions,lY=cS.setMargin,cY=cS.setLayout,uY=cS.setChartSize,dY=cS.setScale,fY=u4.reducer;function d4(t,e,n){return Array.isArray(t)&&t&&e+n!==0?t.slice(e,n+1):t}function wn(t){return Number.isFinite(t)}function kl(t){return typeof t=="number"&&t>0&&Number.isFinite(t)}function ok(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Gm(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ok(Object(n),!0).forEach(function(r){hY(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ok(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function hY(t,e,n){return(e=pY(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function pY(t){var e=mY(t,"string");return typeof e=="symbol"?e:e+""}function mY(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function yi(t,e,n){return Hi(t)||Hi(e)?n:Il(e)?Kh(t,e,n):typeof e=="function"?e(t):n}var gY=(t,e,n)=>{if(e&&n){var r=n.width,i=n.height,s=e.align,o=e.verticalAlign,a=e.layout;if((a==="vertical"||a==="horizontal"&&o==="middle")&&s!=="center"&&Nt(t[s]))return Gm(Gm({},t),{},{[s]:t[s]+(r||0)});if((a==="horizontal"||a==="vertical"&&s==="center")&&o!=="middle"&&Nt(t[o]))return Gm(Gm({},t),{},{[o]:t[o]+(i||0)})}return t},Fl=(t,e)=>t==="horizontal"&&e==="xAxis"||t==="vertical"&&e==="yAxis"||t==="centric"&&e==="angleAxis"||t==="radial"&&e==="radiusAxis",f4=(t,e,n,r)=>{if(r)return t.map(a=>a.coordinate);var i,s,o=t.map(a=>(a.coordinate===e&&(i=!0),a.coordinate===n&&(s=!0),a.coordinate));return i||o.push(e),s||o.push(n),o},h4=(t,e,n)=>{if(!t)return null;var r=t.duplicateDomain,i=t.type,s=t.range,o=t.scale,a=t.realScaleType,l=t.isCategorical,c=t.categoricalDomain,d=t.tickCount,f=t.ticks,m=t.niceTicks,y=t.axisType;if(!o)return null;var x=a==="scaleBand"&&o.bandwidth?o.bandwidth()/2:2,S=i==="category"&&o.bandwidth?o.bandwidth()/x:0;if(S=y==="angleAxis"&&s&&s.length>=2?Wo(s[0]-s[1])*2*S:S,f||m){var _=(f||m||[]).map((w,A)=>{var T=r?r.indexOf(w):w,C=o.map(T);return wn(C)?{coordinate:C+S,value:w,offset:S,index:A}:null}).filter(Ks);return _}return l&&c?c.map((w,A)=>{var T=o.map(w);return wn(T)?{coordinate:T+S,value:w,index:A,offset:S}:null}).filter(Ks):o.ticks&&d!=null?o.ticks(d).map((w,A)=>{var T=o.map(w);return wn(T)?{coordinate:T+S,value:w,index:A,offset:S}:null}).filter(Ks):o.domain().map((w,A)=>{var T=o.map(w);return wn(T)?{coordinate:T+S,value:r?r[w]:w,index:A,offset:S}:null}).filter(Ks)},vY=t=>{var e,n=t.length;if(!(n<=0)){var r=(e=t[0])===null||e===void 0?void 0:e.length;if(!(r==null||r<=0))for(var i=0;i<r;++i)for(var s=0,o=0,a=0;a<n;++a){var l=t[a],c=l==null?void 0:l[i];if(c!=null){var d=c[1],f=c[0],m=Nl(d)?f:d;m>=0?(c[0]=s,s+=m,c[1]=s):(c[0]=o,o+=m,c[1]=o)}}}},yY=t=>{var e,n=t.length;if(!(n<=0)){var r=(e=t[0])===null||e===void 0?void 0:e.length;if(!(r==null||r<=0))for(var i=0;i<r;++i)for(var s=0,o=0;o<n;++o){var a=t[o],l=a==null?void 0:a[i];if(l!=null){var c=Nl(l[1])?l[0]:l[1];c>=0?(l[0]=s,s+=c,l[1]=s):(l[0]=0,l[1]=0)}}}},xY={sign:vY,expand:LX,none:Ph,silhouette:DX,wiggle:UX,positive:yY},bY=(t,e,n)=>{var r,i=(r=xY[n])!==null&&r!==void 0?r:Ph,s=OX().keys(e).value((a,l)=>Number(yi(a,l,0))).order(qT).offset(i),o=s(t);return o.forEach((a,l)=>{a.forEach((c,d)=>{var f=yi(t[d],e[l],0);Array.isArray(f)&&f.length===2&&Nt(f[0])&&Nt(f[1])&&(c[0]=f[0],c[1]=f[1])})}),o};function _Y(t){return t==null?void 0:String(t)}function ak(t){var e=t.axis,n=t.ticks,r=t.bandSize,i=t.entry,s=t.index,o=t.dataKey;if(e.type==="category"){if(!e.allowDuplicatedCategory&&e.dataKey&&!Hi(i[e.dataKey])){var a=x5(n,"value",i[e.dataKey]);if(a)return a.coordinate+r/2}return n!=null&&n[s]?n[s].coordinate+r/2:null}var l=yi(i,Hi(o)?e.dataKey:o),c=e.scale.map(l);return Nt(c)?c:null}var wY=t=>{var e=t.flat(2).filter(Nt);return[Math.min(...e),Math.max(...e)]},SY=t=>[t[0]===1/0?0:t[0],t[1]===-1/0?0:t[1]],MY=(t,e,n)=>{if(!(t==null||Object.keys(t).length===0))return SY(Object.keys(t).reduce((r,i)=>{var s=t[i];if(!s)return r;var o=s.stackedData,a=o.reduce((l,c)=>{var d=d4(c,e,n),f=wY(d);return!wn(f[0])||!wn(f[1])?l:[Math.min(l[0],f[0]),Math.max(l[1],f[1])]},[1/0,-1/0]);return[Math.min(a[0],r[0]),Math.max(a[1],r[1])]},[1/0,-1/0]))},lk=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,ck=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,mw=(t,e,n)=>{if(t&&t.scale&&t.scale.bandwidth){var r=t.scale.bandwidth();if(!n||r>0)return r}if(t&&e&&e.length>=2){for(var i=J1(e,d=>d.coordinate),s=1/0,o=1,a=i.length;o<a;o++){var l=i[o],c=i[o-1];s=Math.min(((l==null?void 0:l.coordinate)||0)-((c==null?void 0:c.coordinate)||0),s)}return s===1/0?0:s}return n?void 0:0};function uk(t){var e=t.tooltipEntrySettings,n=t.dataKey,r=t.payload,i=t.value,s=t.name;return Gm(Gm({},e),{},{dataKey:n,payload:r,value:i,name:s})}function p4(t,e){if(t!=null)return String(t);if(typeof e=="string")return e}var EY=(t,e)=>{if(e==="horizontal")return t.relativeX;if(e==="vertical")return t.relativeY},AY=(t,e)=>e==="centric"?t.angle:t.radius,tu=t=>t.layout.width,nu=t=>t.layout.height,TY=t=>t.layout.scale,m4=t=>t.layout.margin,uS=Oe(t=>t.cartesianAxis.xAxis,t=>Object.values(t)),dS=Oe(t=>t.cartesianAxis.yAxis,t=>Object.values(t)),CY="data-recharts-item-index",PY="data-recharts-item-id",$y=60;function dk(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Eb(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?dk(Object(n),!0).forEach(function(r){RY(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):dk(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function RY(t,e,n){return(e=NY(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function NY(t){var e=IY(t,"string");return typeof e=="symbol"?e:e+""}function IY(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var kY=t=>t.brush.height;function OY(t){var e=dS(t);return e.reduce((n,r)=>{if(r.orientation==="left"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:$y;return n+i}return n},0)}function LY(t){var e=dS(t);return e.reduce((n,r)=>{if(r.orientation==="right"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:$y;return n+i}return n},0)}function DY(t){var e=uS(t);return e.reduce((n,r)=>r.orientation==="top"&&!r.mirror&&!r.hide?n+r.height:n,0)}function UY(t){var e=uS(t);return e.reduce((n,r)=>r.orientation==="bottom"&&!r.mirror&&!r.hide?n+r.height:n,0)}var Gi=Oe([tu,nu,m4,kY,OY,LY,DY,UY,L5,iK],(t,e,n,r,i,s,o,a,l,c)=>{var d={left:(n.left||0)+i,right:(n.right||0)+s},f={top:(n.top||0)+o,bottom:(n.bottom||0)+a},m=Eb(Eb({},f),d),y=m.bottom;m.bottom+=r,m=gY(m,l,c);var x=t-m.left-m.right,S=e-m.top-m.bottom;return Eb(Eb({brushBottom:y},m),{},{width:Math.max(x,0),height:Math.max(S,0)})}),jY=Oe(Gi,t=>({x:t.left,y:t.top,width:t.width,height:t.height})),g4=Oe(tu,nu,(t,e)=>({x:0,y:0,width:t,height:e})),FY=R.createContext(null),Qs=()=>R.useContext(FY)!=null,fS=t=>t.brush,hS=Oe([fS,Gi,m4],(t,e,n)=>({height:t.height,x:Nt(t.x)?t.x:e.left,y:Nt(t.y)?t.y:e.top+e.height+e.brushBottom-((n==null?void 0:n.bottom)||0),width:Nt(t.width)?t.width:e.width}));function zY(t,e,{signal:n,edges:r}={}){let i,s=null;const o=r!=null&&r.includes("leading"),a=r==null||r.includes("trailing"),l=()=>{s!==null&&(t.apply(i,s),i=void 0,s=null)},c=()=>{a&&l(),y()};let d=null;const f=()=>{d!=null&&clearTimeout(d),d=setTimeout(()=>{d=null,c()},e)},m=()=>{d!==null&&(clearTimeout(d),d=null)},y=()=>{m(),i=void 0,s=null},x=()=>{l()},S=function(..._){if(n!=null&&n.aborted)return;i=this,s=_;const w=d==null;f(),o&&w&&l()};return S.schedule=f,S.cancel=y,S.flush=x,n==null||n.addEventListener("abort",y,{once:!0}),S}function BY(t,e=0,n={}){typeof n!="object"&&(n={});const{leading:r=!1,trailing:i=!0,maxWait:s}=n,o=Array(2);r&&(o[0]="leading"),i&&(o[1]="trailing");let a,l=null;const c=zY(function(...m){a=t.apply(this,m),l=null},e,{edges:o}),d=function(...m){return s!=null&&(l===null&&(l=Date.now()),Date.now()-l>=s)?(a=t.apply(this,m),l=Date.now(),c.cancel(),c.schedule(),a):(c.apply(this,m),a)},f=()=>(c.flush(),a);return d.cancel=c.cancel,d.flush=f,d}function HY(t,e=0,n={}){const{leading:r=!0,trailing:i=!0}=n;return BY(t,e,{leading:r,maxWait:e,trailing:i})}var gw=function(e,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;s<r;s++)i[s-2]=arguments[s];if(typeof console<"u"&&console.warn&&(n===void 0&&console.warn("LogUtils requires an error message argument"),!e))if(n===void 0)console.warn("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var o=0;console.warn(n.replace(/%s/g,()=>i[o++]))}},wl={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},v4=(t,e,n)=>{var r=n.width,i=r===void 0?wl.width:r,s=n.height,o=s===void 0?wl.height:s,a=n.aspect,l=n.maxHeight,c=Rh(i)?t:Number(i),d=Rh(o)?e:Number(o);return a&&a>0&&(c?d=c/a:d&&(c=d*a),l&&d!=null&&d>l&&(d=l)),{calculatedWidth:c,calculatedHeight:d}},VY={width:0,height:0,overflow:"visible"},GY={width:0,overflowX:"visible"},WY={height:0,overflowY:"visible"},$Y={},XY=t=>{var e=t.width,n=t.height,r=Rh(e),i=Rh(n);return r&&i?VY:r?GY:i?WY:$Y};function qY(t){var e=t.width,n=t.height,r=t.aspect,i=e,s=n;return i===void 0&&s===void 0?(i=wl.width,s=wl.height):i===void 0?i=r&&r>0?void 0:wl.width:s===void 0&&(s=r&&r>0?void 0:wl.height),{width:i,height:s}}var KY=["aspect","initialDimension","width","height","minWidth","minHeight","maxHeight","children","debounce","id","className","onResize","style"];function vw(){return vw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},vw.apply(null,arguments)}function fk(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function hk(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?fk(Object(n),!0).forEach(function(r){YY(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):fk(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function YY(t,e,n){return(e=ZY(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ZY(t){var e=QY(t,"string");return typeof e=="symbol"?e:e+""}function QY(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function JY(t,e){return rZ(t)||nZ(t,e)||tZ(t,e)||eZ()}function eZ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tZ(t,e){if(t){if(typeof t=="string")return pk(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?pk(t,e):void 0}}function pk(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function nZ(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function rZ(t){if(Array.isArray(t))return t}function iZ(t,e){if(t==null)return{};var n,r,i=sZ(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function sZ(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var y4=R.createContext(wl.initialDimension);function oZ(t){return kl(t.width)&&kl(t.height)}function x4(t){var e=t.children,n=t.width,r=t.height,i=R.useMemo(()=>({width:n,height:r}),[n,r]);return oZ(i)?R.createElement(y4.Provider,{value:i},e):null}var VP=()=>R.useContext(y4),aZ=R.forwardRef((t,e)=>{var n=t.aspect,r=t.initialDimension,i=r===void 0?wl.initialDimension:r,s=t.width,o=t.height,a=t.minWidth,l=a===void 0?wl.minWidth:a,c=t.minHeight,d=t.maxHeight,f=t.children,m=t.debounce,y=m===void 0?wl.debounce:m,x=t.id,S=t.className,_=t.onResize,w=t.style,A=w===void 0?{}:w,T=iZ(t,KY),C=R.useRef(null),O=R.useRef();O.current=_,R.useImperativeHandle(e,()=>C.current);var N=R.useState({containerWidth:i.width,containerHeight:i.height}),D=JY(N,2),F=D[0],V=D[1],k=R.useCallback((oe,ce)=>{V(B=>{var K=Math.round(oe),q=Math.round(ce);return B.containerWidth===K&&B.containerHeight===q?B:{containerWidth:K,containerHeight:q}})},[]);R.useEffect(()=>{if(C.current==null||typeof ResizeObserver>"u")return zg;var oe=$=>{var Z,ge=$[0];if(ge!=null){var ae=ge.contentRect,fe=ae.width,_e=ae.height;k(fe,_e),(Z=O.current)===null||Z===void 0||Z.call(O,fe,_e)}};y>0&&(oe=HY(oe,y,{trailing:!0,leading:!1}));var ce=new ResizeObserver(oe),B=C.current.getBoundingClientRect(),K=B.width,q=B.height;return k(K,q),ce.observe(C.current),()=>{ce.disconnect()}},[k,y]);var j=F.containerWidth,H=F.containerHeight;gw(!n||n>0,"The aspect(%s) must be greater than zero.",n);var ne=v4(j,H,{width:s,height:o,aspect:n,maxHeight:d}),te=ne.calculatedWidth,pe=ne.calculatedHeight;return gw(j<0||H<0||te!=null&&te>0||pe!=null&&pe>0,`The width(%s) and height(%s) of chart should be greater than 0,
|
||
please check the style of container, or the props width(%s) and height(%s),
|
||
or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
|
||
height and width.`,te,pe,s,o,l,c,n),R.createElement("div",vw({id:x?"".concat(x):void 0,className:er("recharts-responsive-container",S),style:hk(hk({},A),{},{width:s,height:o,minWidth:l,minHeight:c,maxHeight:d}),ref:C},T),R.createElement("div",{style:XY({width:s,height:o})},R.createElement(x4,{width:te,height:pe},f)))}),lZ=R.forwardRef((t,e)=>{var n=VP();if(kl(n.width)&&kl(n.height))return t.children;var r=qY({width:t.width,height:t.height,aspect:t.aspect}),i=r.width,s=r.height,o=v4(void 0,void 0,{width:i,height:s,aspect:t.aspect,maxHeight:t.maxHeight}),a=o.calculatedWidth,l=o.calculatedHeight;return Nt(a)&&Nt(l)?R.createElement(x4,{width:a,height:l},t.children):R.createElement(aZ,vw({},t,{width:i,height:s,ref:e}))});function GP(t){if(t)return{x:t.x,y:t.y,upperWidth:"upperWidth"in t?t.upperWidth:t.width,lowerWidth:"lowerWidth"in t?t.lowerWidth:t.width,width:t.width,height:t.height}}var pS=()=>{var t,e=Qs(),n=zt(jY),r=zt(hS),i=(t=zt(fS))===null||t===void 0?void 0:t.padding;return!e||!r||!i?n:{width:r.width-i.left-i.right,height:r.height-i.top-i.bottom,x:i.left,y:i.top}},cZ={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},b4=()=>{var t;return(t=zt(Gi))!==null&&t!==void 0?t:cZ},_4=()=>zt(tu),w4=()=>zt(nu),fr=t=>t.layout.layoutType,Bg=()=>zt(fr),WP=()=>{var t=Bg();if(t==="horizontal"||t==="vertical")return t},S4=t=>{var e=t.layout.layoutType;if(e==="centric"||e==="radial")return e},uZ=()=>{var t=Bg();return t!==void 0},Xy=t=>{var e=Wr(),n=Qs(),r=t.width,i=t.height,s=VP(),o=r,a=i;return s&&(o=s.width>0?s.width:r,a=s.height>0?s.height:i),R.useEffect(()=>{!n&&kl(o)&&kl(a)&&e(uY({width:o,height:a}))},[e,n,o,a]),null},M4=Symbol.for("immer-nothing"),mk=Symbol.for("immer-draftable"),Eo=Symbol.for("immer-state");function ja(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var fy=Object.getPrototypeOf;function Sg(t){return!!t&&!!t[Eo]}function Ih(t){var e;return t?E4(t)||Array.isArray(t)||!!t[mk]||!!((e=t.constructor)!=null&&e[mk])||qy(t)||gS(t):!1}var dZ=Object.prototype.constructor.toString(),gk=new WeakMap;function E4(t){if(!t||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);if(e===null||e===Object.prototype)return!0;const n=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;if(n===Object)return!0;if(typeof n!="function")return!1;let r=gk.get(n);return r===void 0&&(r=Function.toString.call(n),gk.set(n,r)),r===dZ}function yw(t,e,n=!0){mS(t)===0?(n?Reflect.ownKeys(t):Object.keys(t)).forEach(i=>{e(i,t[i],t)}):t.forEach((r,i)=>e(i,r,t))}function mS(t){const e=t[Eo];return e?e.type_:Array.isArray(t)?1:qy(t)?2:gS(t)?3:0}function cC(t,e){return mS(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function A4(t,e,n){const r=mS(t);r===2?t.set(e,n):r===3?t.add(n):t[e]=n}function fZ(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function qy(t){return t instanceof Map}function gS(t){return t instanceof Set}function Wf(t){return t.copy_||t.base_}function uC(t,e){if(qy(t))return new Map(t);if(gS(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=E4(t);if(e===!0||e==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(t);delete r[Eo];let i=Reflect.ownKeys(r);for(let s=0;s<i.length;s++){const o=i[s],a=r[o];a.writable===!1&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(r[o]={configurable:!0,writable:!0,enumerable:a.enumerable,value:t[o]})}return Object.create(fy(t),r)}else{const r=fy(t);if(r!==null&&n)return{...t};const i=Object.create(r);return Object.assign(i,t)}}function $P(t,e=!1){return vS(t)||Sg(t)||!Ih(t)||(mS(t)>1&&Object.defineProperties(t,{set:Ab,add:Ab,clear:Ab,delete:Ab}),Object.freeze(t),e&&Object.values(t).forEach(n=>$P(n,!0))),t}function hZ(){ja(2)}var Ab={value:hZ};function vS(t){return t===null||typeof t!="object"?!0:Object.isFrozen(t)}var pZ={};function kh(t){const e=pZ[t];return e||ja(0,t),e}var hy;function T4(){return hy}function mZ(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function vk(t,e){e&&(kh("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function dC(t){fC(t),t.drafts_.forEach(gZ),t.drafts_=null}function fC(t){t===hy&&(hy=t.parent_)}function yk(t){return hy=mZ(hy,t)}function gZ(t){const e=t[Eo];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function xk(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return t!==void 0&&t!==n?(n[Eo].modified_&&(dC(e),ja(4)),Ih(t)&&(t=xw(e,t),e.parent_||bw(e,t)),e.patches_&&kh("Patches").generateReplacementPatches_(n[Eo].base_,t,e.patches_,e.inversePatches_)):t=xw(e,n,[]),dC(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==M4?t:void 0}function xw(t,e,n){if(vS(e))return e;const r=t.immer_.shouldUseStrictIteration(),i=e[Eo];if(!i)return yw(e,(s,o)=>bk(t,i,e,s,o,n),r),e;if(i.scope_!==t)return e;if(!i.modified_)return bw(t,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const s=i.copy_;let o=s,a=!1;i.type_===3&&(o=new Set(s),s.clear(),a=!0),yw(o,(l,c)=>bk(t,i,s,l,c,n,a),r),bw(t,s,!1),n&&t.patches_&&kh("Patches").generatePatches_(i,n,t.patches_,t.inversePatches_)}return i.copy_}function bk(t,e,n,r,i,s,o){if(i==null||typeof i!="object"&&!o)return;const a=vS(i);if(!(a&&!o)){if(Sg(i)){const l=s&&e&&e.type_!==3&&!cC(e.assigned_,r)?s.concat(r):void 0,c=xw(t,i,l);if(A4(n,r,c),Sg(c))t.canAutoFreeze_=!1;else return}else o&&n.add(i);if(Ih(i)&&!a){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1||e&&e.base_&&e.base_[r]===i&&a)return;xw(t,i),(!e||!e.scope_.parent_)&&typeof r!="symbol"&&(qy(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&bw(t,i)}}}function bw(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&$P(e,n)}function vZ(t,e){const n=Array.isArray(t),r={type_:n?1:0,scope_:e?e.scope_:T4(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,s=XP;n&&(i=[r],s=py);const{revoke:o,proxy:a}=Proxy.revocable(i,s);return r.draft_=a,r.revoke_=o,a}var XP={get(t,e){if(e===Eo)return t;const n=Wf(t);if(!cC(n,e))return yZ(t,n,e);const r=n[e];return t.finalized_||!Ih(r)?r:r===bE(t.base_,e)?(_E(t),t.copy_[e]=pC(r,t)):r},has(t,e){return e in Wf(t)},ownKeys(t){return Reflect.ownKeys(Wf(t))},set(t,e,n){const r=C4(Wf(t),e);if(r!=null&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const i=bE(Wf(t),e),s=i==null?void 0:i[Eo];if(s&&s.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(fZ(n,i)&&(n!==void 0||cC(t.base_,e)))return!0;_E(t),hC(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_[e]=!0),!0},deleteProperty(t,e){return bE(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,_E(t),hC(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=Wf(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:r.enumerable,value:n[e]}},defineProperty(){ja(11)},getPrototypeOf(t){return fy(t.base_)},setPrototypeOf(){ja(12)}},py={};yw(XP,(t,e)=>{py[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}});py.deleteProperty=function(t,e){return py.set.call(this,t,e,void 0)};py.set=function(t,e,n){return XP.set.call(this,t[0],e,n,t[0])};function bE(t,e){const n=t[Eo];return(n?Wf(n):t)[e]}function yZ(t,e,n){var i;const r=C4(e,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(t.draft_):void 0}function C4(t,e){if(!(e in t))return;let n=fy(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=fy(n)}}function hC(t){t.modified_||(t.modified_=!0,t.parent_&&hC(t.parent_))}function _E(t){t.copy_||(t.copy_=uC(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var xZ=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(e,n,r)=>{if(typeof e=="function"&&typeof n!="function"){const s=n;n=e;const o=this;return function(l=s,...c){return o.produce(l,d=>n.call(this,d,...c))}}typeof n!="function"&&ja(6),r!==void 0&&typeof r!="function"&&ja(7);let i;if(Ih(e)){const s=yk(this),o=pC(e,void 0);let a=!0;try{i=n(o),a=!1}finally{a?dC(s):fC(s)}return vk(s,r),xk(i,s)}else if(!e||typeof e!="object"){if(i=n(e),i===void 0&&(i=e),i===M4&&(i=void 0),this.autoFreeze_&&$P(i,!0),r){const s=[],o=[];kh("Patches").generateReplacementPatches_(e,i,s,o),r(s,o)}return i}else ja(1,e)},this.produceWithPatches=(e,n)=>{if(typeof e=="function")return(o,...a)=>this.produceWithPatches(o,l=>e(l,...a));let r,i;return[this.produce(e,n,(o,a)=>{r=o,i=a}),r,i]},typeof(t==null?void 0:t.autoFreeze)=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof(t==null?void 0:t.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),typeof(t==null?void 0:t.useStrictIteration)=="boolean"&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){Ih(t)||ja(8),Sg(t)&&(t=bZ(t));const e=yk(this),n=pC(t,void 0);return n[Eo].isManual_=!0,fC(e),n}finishDraft(t,e){const n=t&&t[Eo];(!n||!n.isManual_)&&ja(9);const{scope_:r}=n;return vk(r,e),xk(void 0,r)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,e){let n;for(n=e.length-1;n>=0;n--){const i=e[n];if(i.path.length===0&&i.op==="replace"){t=i.value;break}}n>-1&&(e=e.slice(n+1));const r=kh("Patches").applyPatches_;return Sg(t)?r(t,e):this.produce(t,i=>r(i,e))}};function pC(t,e){const n=qy(t)?kh("MapSet").proxyMap_(t,e):gS(t)?kh("MapSet").proxySet_(t,e):vZ(t,e);return(e?e.scope_:T4()).drafts_.push(n),n}function bZ(t){return Sg(t)||ja(10,t),P4(t)}function P4(t){if(!Ih(t)||vS(t))return t;const e=t[Eo];let n,r=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=uC(t,e.scope_.immer_.useStrictShallowCopy_),r=e.scope_.immer_.shouldUseStrictIteration()}else n=uC(t,!0);return yw(n,(i,s)=>{A4(n,i,P4(s))},r),e&&(e.finalized_=!1),n}var _Z=new xZ;_Z.produce;var wZ={settings:{layout:"horizontal",align:"center",verticalAlign:"bottom",itemSorter:"value"},size:{width:0,height:0},payload:[]},R4=cs({name:"legend",initialState:wZ,reducers:{setLegendSize(t,e){t.size.width=e.payload.width,t.size.height=e.payload.height},setLegendSettings(t,e){t.settings.align=e.payload.align,t.settings.layout=e.payload.layout,t.settings.verticalAlign=e.payload.verticalAlign,t.settings.itemSorter=e.payload.itemSorter},addLegendPayload:{reducer(t,e){t.payload.push(e.payload)},prepare:sr()},replaceLegendPayload:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next,s=$o(t).payload.indexOf(r);s>-1&&(t.payload[s]=i)},prepare:sr()},removeLegendPayload:{reducer(t,e){var n=$o(t).payload.indexOf(e.payload);n>-1&&t.payload.splice(n,1)},prepare:sr()}}}),Ky=R4.actions;Ky.setLegendSize;Ky.setLegendSettings;var SZ=Ky.addLegendPayload,MZ=Ky.replaceLegendPayload,EZ=Ky.removeLegendPayload,AZ=R4.reducer,wE={exports:{}},SE={};/**
|
||
* @license React
|
||
* use-sync-external-store-with-selector.production.js
|
||
*
|
||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var _k;function TZ(){if(_k)return SE;_k=1;var t=Wh();function e(l,c){return l===c&&(l!==0||1/l===1/c)||l!==l&&c!==c}var n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,i=t.useRef,s=t.useEffect,o=t.useMemo,a=t.useDebugValue;return SE.useSyncExternalStoreWithSelector=function(l,c,d,f,m){var y=i(null);if(y.current===null){var x={hasValue:!1,value:null};y.current=x}else x=y.current;y=o(function(){function _(O){if(!w){if(w=!0,A=O,O=f(O),m!==void 0&&x.hasValue){var N=x.value;if(m(N,O))return T=N}return T=O}if(N=T,n(A,O))return N;var D=f(O);return m!==void 0&&m(N,D)?(A=O,N):(A=O,T=D)}var w=!1,A,T,C=d===void 0?null:d;return[function(){return _(c())},C===null?void 0:function(){return _(C())}]},[c,d,f,m]);var S=r(l,y[0],y[1]);return s(function(){x.hasValue=!0,x.value=S},[S]),a(S),S},SE}var wk;function CZ(){return wk||(wk=1,wE.exports=TZ()),wE.exports}CZ();function PZ(t){t()}function RZ(){let t=null,e=null;return{clear(){t=null,e=null},notify(){PZ(()=>{let n=t;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=t;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const i=e={callback:n,next:null,prev:e};return i.prev?i.prev.next=i:t=i,function(){!r||t===null||(r=!1,i.next?i.next.prev=i.prev:e=i.prev,i.prev?i.prev.next=i.next:t=i.next)}}}}var Sk={notify(){},get:()=>[]};function NZ(t,e){let n,r=Sk,i=0,s=!1;function o(S){d();const _=r.subscribe(S);let w=!1;return()=>{w||(w=!0,_(),f())}}function a(){r.notify()}function l(){x.onStateChange&&x.onStateChange()}function c(){return s}function d(){i++,n||(n=t.subscribe(l),r=RZ())}function f(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=Sk)}function m(){s||(s=!0,d())}function y(){s&&(s=!1,f())}const x={addNestedSub:o,notifyNestedSubs:a,handleChangeWrapper:l,isSubscribed:c,trySubscribe:m,tryUnsubscribe:y,getListeners:()=>r};return x}var IZ=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",kZ=IZ(),OZ=()=>typeof navigator<"u"&&navigator.product==="ReactNative",LZ=OZ(),DZ=()=>kZ||LZ?R.useLayoutEffect:R.useEffect,UZ=DZ();function Mk(t,e){return t===e?t!==0||e!==0||1/t===1/e:t!==t&&e!==e}function jZ(t,e){if(Mk(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(let i=0;i<n.length;i++)if(!Object.prototype.hasOwnProperty.call(e,n[i])||!Mk(t[n[i]],e[n[i]]))return!1;return!0}var ME=Symbol.for("react-redux-context"),EE=typeof globalThis<"u"?globalThis:{};function FZ(){if(!R.createContext)return{};const t=EE[ME]??(EE[ME]=new Map);let e=t.get(R.createContext);return e||(e=R.createContext(null),t.set(R.createContext,e)),e}var zZ=FZ();function BZ(t){const{children:e,context:n,serverState:r,store:i}=t,s=R.useMemo(()=>{const l=NZ(i);return{store:i,subscription:l,getServerState:r?()=>r:void 0}},[i,r]),o=R.useMemo(()=>i.getState(),[i]);UZ(()=>{const{subscription:l}=s;return l.onStateChange=l.notifyNestedSubs,l.trySubscribe(),o!==i.getState()&&l.notifyNestedSubs(),()=>{l.tryUnsubscribe(),l.onStateChange=void 0}},[s,o]);const a=n||zZ;return R.createElement(a.Provider,{value:s},e)}var HZ=BZ,VZ=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius","throttledEvents"]);function GZ(t,e){return t==null&&e==null?!0:typeof t=="number"&&typeof e=="number"?t===e||t!==t&&e!==e:t===e}function yS(t,e){var n=new Set([...Object.keys(t),...Object.keys(e)]);for(var r of n)if(VZ.has(r)){if(t[r]==null&&e[r]==null)continue;if(!jZ(t[r],e[r]))return!1}else if(!GZ(t[r],e[r]))return!1;return!0}function mC(){return mC=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},mC.apply(null,arguments)}function Ek(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function r0(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Ek(Object(n),!0).forEach(function(r){WZ(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ek(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function WZ(t,e,n){return(e=$Z(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function $Z(t){var e=XZ(t,"string");return typeof e=="symbol"?e:e+""}function XZ(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function qZ(t,e){return QZ(t)||ZZ(t,e)||YZ(t,e)||KZ()}function KZ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function YZ(t,e){if(t){if(typeof t=="string")return Ak(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ak(t,e):void 0}}function Ak(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ZZ(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function QZ(t){if(Array.isArray(t))return t}function JZ(t){return Array.isArray(t)&&Il(t[0])&&Il(t[1])?t.join(" ~ "):t}var om={separator:" : ",contentStyle:{margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},itemStyle:{display:"block",paddingTop:4,paddingBottom:4,color:"#000"},labelStyle:{},accessibilityLayer:!1};function eQ(t,e){return e==null?t:J1(t,e)}var tQ=t=>{var e=t.separator,n=e===void 0?om.separator:e,r=t.contentStyle,i=t.itemStyle,s=t.labelStyle,o=s===void 0?om.labelStyle:s,a=t.payload,l=t.formatter,c=t.itemSorter,d=t.wrapperClassName,f=t.labelClassName,m=t.label,y=t.labelFormatter,x=t.accessibilityLayer,S=x===void 0?om.accessibilityLayer:x,_=()=>{if(a&&a.length){var F={padding:0,margin:0},V=eQ(a,c),k=V.map((j,H)=>{if(!j||j.type==="none")return null;var ne=j.formatter||l||JZ,te=j.value,pe=j.name,oe=te,ce=pe;if(ne){var B=ne(te,pe,j,H,a);if(Array.isArray(B)){var K=qZ(B,2);oe=K[0],ce=K[1]}else if(B!=null)oe=B;else return null}var q=r0(r0({},om.itemStyle),{},{color:j.color||om.itemStyle.color},i);return R.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(H),style:q},Il(ce)?R.createElement("span",{className:"recharts-tooltip-item-name"},ce):null,Il(ce)?R.createElement("span",{className:"recharts-tooltip-item-separator"},n):null,R.createElement("span",{className:"recharts-tooltip-item-value"},oe),R.createElement("span",{className:"recharts-tooltip-item-unit"},j.unit||""))});return R.createElement("ul",{className:"recharts-tooltip-item-list",style:F},k)}return null},w=r0(r0({},om.contentStyle),r),A=r0({margin:0},o),T=!Hi(m),C=T?m:"",O=er("recharts-default-tooltip",d),N=er("recharts-tooltip-label",f);T&&y&&a!==void 0&&a!==null&&(C=y(m,a));var D=S?{role:"status","aria-live":"assertive"}:{};return R.createElement("div",mC({className:O,style:w},D),R.createElement("p",{className:N,style:A},R.isValidElement(C)?C:"".concat(C)),_())},i0="recharts-tooltip-wrapper",nQ={visibility:"hidden"};function rQ(t){var e=t.coordinate,n=t.translateX,r=t.translateY;return er(i0,{["".concat(i0,"-right")]:Nt(n)&&e&&Nt(e.x)&&n>=e.x,["".concat(i0,"-left")]:Nt(n)&&e&&Nt(e.x)&&n<e.x,["".concat(i0,"-bottom")]:Nt(r)&&e&&Nt(e.y)&&r>=e.y,["".concat(i0,"-top")]:Nt(r)&&e&&Nt(e.y)&&r<e.y})}function Tk(t){var e=t.allowEscapeViewBox,n=t.coordinate,r=t.key,i=t.offset,s=t.position,o=t.reverseDirection,a=t.tooltipDimension,l=t.viewBox,c=t.viewBoxDimension;if(s&&Nt(s[r]))return s[r];var d=n[r]-a-(i>0?i:0),f=n[r]+i;if(e[r])return o[r]?d:f;var m=l[r];if(m==null)return 0;if(o[r]){var y=d,x=m;return y<x?Math.max(f,m):Math.max(d,m)}if(c==null)return 0;var S=f+a,_=m+c;return S>_?Math.max(d,m):Math.max(f,m)}function iQ(t){var e=t.translateX,n=t.translateY,r=t.useTranslate3d;return{transform:r?"translate3d(".concat(e,"px, ").concat(n,"px, 0)"):"translate(".concat(e,"px, ").concat(n,"px)")}}function sQ(t){var e=t.allowEscapeViewBox,n=t.coordinate,r=t.offsetTop,i=t.offsetLeft,s=t.position,o=t.reverseDirection,a=t.tooltipBox,l=t.useTranslate3d,c=t.viewBox,d,f,m;return a.height>0&&a.width>0&&n?(f=Tk({allowEscapeViewBox:e,coordinate:n,key:"x",offset:i,position:s,reverseDirection:o,tooltipDimension:a.width,viewBox:c,viewBoxDimension:c.width}),m=Tk({allowEscapeViewBox:e,coordinate:n,key:"y",offset:r,position:s,reverseDirection:o,tooltipDimension:a.height,viewBox:c,viewBoxDimension:c.height}),d=iQ({translateX:f,translateY:m,useTranslate3d:l})):d=nQ,{cssProperties:d,cssClasses:rQ({translateX:f,translateY:m,coordinate:n})}}var oQ=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),Yy={isSsr:oQ()};function aQ(t,e){return dQ(t)||uQ(t,e)||cQ(t,e)||lQ()}function lQ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cQ(t,e){if(t){if(typeof t=="string")return Ck(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ck(t,e):void 0}}function Ck(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function uQ(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function dQ(t){if(Array.isArray(t))return t}function N4(){var t=R.useState(()=>Yy.isSsr||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches),e=aQ(t,2),n=e[0],r=e[1];return R.useEffect(()=>{if(window.matchMedia){var i=window.matchMedia("(prefers-reduced-motion: reduce)"),s=()=>{r(i.matches)};return i.addEventListener("change",s),()=>{i.removeEventListener("change",s)}}},[]),n}function Pk(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function am(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Pk(Object(n),!0).forEach(function(r){fQ(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Pk(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function fQ(t,e,n){return(e=hQ(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function hQ(t){var e=pQ(t,"string");return typeof e=="symbol"?e:e+""}function pQ(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function mQ(t,e){return xQ(t)||yQ(t,e)||vQ(t,e)||gQ()}function gQ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vQ(t,e){if(t){if(typeof t=="string")return Rk(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Rk(t,e):void 0}}function Rk(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function yQ(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function xQ(t){if(Array.isArray(t))return t}function bQ(t){if(!(t.prefersReducedMotion&&t.isAnimationActive==="auto")&&t.isAnimationActive&&t.active){var e=typeof t.animationEasing=="string"?t.animationEasing:"ease";return"transform ".concat(t.animationDuration,"ms ").concat(e)}}function _Q(t){var e,n,r,i,s,o,a=N4(),l=R.useState(()=>({dismissed:!1,dismissedAtCoordinate:{x:0,y:0}})),c=mQ(l,2),d=c[0],f=c[1];R.useEffect(()=>{var w=A=>{if(A.key==="Escape"){var T,C,O,N;f({dismissed:!0,dismissedAtCoordinate:{x:(T=(C=t.coordinate)===null||C===void 0?void 0:C.x)!==null&&T!==void 0?T:0,y:(O=(N=t.coordinate)===null||N===void 0?void 0:N.y)!==null&&O!==void 0?O:0}})}};return document.addEventListener("keydown",w),()=>{document.removeEventListener("keydown",w)}},[(e=t.coordinate)===null||e===void 0?void 0:e.x,(n=t.coordinate)===null||n===void 0?void 0:n.y]),d.dismissed&&(((r=(i=t.coordinate)===null||i===void 0?void 0:i.x)!==null&&r!==void 0?r:0)!==d.dismissedAtCoordinate.x||((s=(o=t.coordinate)===null||o===void 0?void 0:o.y)!==null&&s!==void 0?s:0)!==d.dismissedAtCoordinate.y)&&f(am(am({},d),{},{dismissed:!1}));var m=sQ({allowEscapeViewBox:t.allowEscapeViewBox,coordinate:t.coordinate,offsetLeft:typeof t.offset=="number"?t.offset:t.offset.x,offsetTop:typeof t.offset=="number"?t.offset:t.offset.y,position:t.position,reverseDirection:t.reverseDirection,tooltipBox:{height:t.lastBoundingBox.height,width:t.lastBoundingBox.width},useTranslate3d:t.useTranslate3d,viewBox:t.viewBox}),y=m.cssClasses,x=m.cssProperties,S=t.hasPortalFromProps?{}:am(am({transition:bQ({prefersReducedMotion:a,isAnimationActive:t.isAnimationActive,active:t.active,animationDuration:t.animationDuration,animationEasing:t.animationEasing})},x),{},{pointerEvents:"none",position:"absolute",top:0,left:0}),_=am(am({},S),{},{visibility:!d.dismissed&&t.active&&t.hasPayload?"visible":"hidden"},t.wrapperStyle);return R.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:y,style:_,ref:t.innerRef},t.children)}var wQ=R.memo(_Q),I4=()=>{var t;return(t=zt(e=>e.rootProps.accessibilityLayer))!==null&&t!==void 0?t:!0};function gC(){return gC=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},gC.apply(null,arguments)}function Nk(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ik(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Nk(Object(n),!0).forEach(function(r){SQ(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Nk(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function SQ(t,e,n){return(e=MQ(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function MQ(t){var e=EQ(t,"string");return typeof e=="symbol"?e:e+""}function EQ(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var kk={curveBasisClosed:SX,curveBasisOpen:MX,curveBasis:wX,curveBumpX:bX,curveBumpY:_X,curveLinearClosed:EX,curveLinear:Z1,curveMonotoneX:AX,curveMonotoneY:TX,curveNatural:CX,curveStep:PX,curveStepAfter:NX,curveStepBefore:RX},_w=t=>wn(t.x)&&wn(t.y),Ok=t=>t.base!=null&&_w(t.base)&&_w(t),s0=t=>t.x,o0=t=>t.y,AQ=(t,e)=>{if(typeof t=="function")return t;var n="curve".concat(kP(t));if((n==="curveMonotone"||n==="curveBump")&&e){var r=kk["".concat(n).concat(e==="vertical"?"Y":"X")];if(r)return r}return kk[n]||Z1},Lk={connectNulls:!1,type:"linear"},TQ=t=>{var e=t.type,n=e===void 0?Lk.type:e,r=t.points,i=r===void 0?[]:r,s=t.baseLine,o=t.layout,a=t.connectNulls,l=a===void 0?Lk.connectNulls:a,c=AQ(n,o),d=l?i.filter(_w):i;if(Array.isArray(s)){var f,m=i.map((w,A)=>Ik(Ik({},w),{},{base:s[A]}));o==="vertical"?f=xb().y(o0).x1(s0).x0(w=>w.base.x):f=xb().x(s0).y1(o0).y0(w=>w.base.y);var y=f.defined(Ok).curve(c),x=l?m.filter(Ok):m;return y(x)}var S;o==="vertical"&&Nt(s)?S=xb().y(o0).x1(s0).x0(s):Nt(s)?S=xb().x(s0).y1(o0).y0(s):S=a5().x(s0).y(o0);var _=S.defined(_w).curve(c);return _(d)},H_=t=>{var e=t.className,n=t.points,r=t.path,i=t.pathRef,s=Bg();if((!n||!n.length)&&!r)return null;var o={type:t.type,points:t.points,baseLine:t.baseLine,layout:t.layout||s,connectNulls:t.connectNulls},a=n&&n.length?TQ(o):r;return R.createElement("path",gC({},za(t),OP(t),{className:er("recharts-curve",e),d:a===null?void 0:a,ref:i}))},CQ=["x","y","top","left","width","height","className"];function vC(){return vC=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},vC.apply(null,arguments)}function Dk(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function PQ(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Dk(Object(n),!0).forEach(function(r){RQ(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Dk(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function RQ(t,e,n){return(e=NQ(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function NQ(t){var e=IQ(t,"string");return typeof e=="symbol"?e:e+""}function IQ(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function kQ(t,e){if(t==null)return{};var n,r,i=OQ(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function OQ(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var LQ=(t,e,n,r,i,s)=>"M".concat(t,",").concat(i,"v").concat(r,"M").concat(s,",").concat(e,"h").concat(n),DQ=t=>{var e=t.x,n=e===void 0?0:e,r=t.y,i=r===void 0?0:r,s=t.top,o=s===void 0?0:s,a=t.left,l=a===void 0?0:a,c=t.width,d=c===void 0?0:c,f=t.height,m=f===void 0?0:f,y=t.className,x=kQ(t,CQ),S=PQ({x:n,y:i,top:o,left:l,width:d,height:m},x);return!Nt(n)||!Nt(i)||!Nt(d)||!Nt(m)||!Nt(o)||!Nt(l)?null:R.createElement("path",vC({},Ko(S),{className:er("recharts-cross",y),d:LQ(n,i,d,m,o,l)}))};function UQ(t,e,n,r){var i=r/2;return{stroke:"none",fill:"#ccc",x:t==="horizontal"?e.x-i:n.left+.5,y:t==="horizontal"?n.top+.5:e.y-i,width:t==="horizontal"?r:n.width-1,height:t==="horizontal"?n.height-1:r}}var ww=1e-4,k4=(t,e)=>[0,3*t,3*e-6*t,3*t-3*e+1],O4=(t,e)=>t.map((n,r)=>n*e**r).reduce((n,r)=>n+r),Uk=(t,e)=>n=>{var r=k4(t,e);return O4(r,n)},jQ=(t,e)=>n=>{var r=k4(t,e),i=[...r.map((s,o)=>s*o).slice(1),0];return O4(i,n)},FQ=t=>{var e,n=t.split("(");if(n.length!==2||n[0]!=="cubic-bezier")return null;var r=(e=n[1])===null||e===void 0||(e=e.split(")")[0])===null||e===void 0?void 0:e.split(",");if(r==null||r.length!==4)return null;var i=r.map(s=>parseFloat(s));return[i[0],i[1],i[2],i[3]]},zQ=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];if(n.length===1)switch(n[0]){case"linear":return[0,0,1,1];case"ease":return[.25,.1,.25,1];case"ease-in":return[.42,0,1,1];case"ease-out":return[.42,0,.58,1];case"ease-in-out":return[0,0,.58,1];default:{var i=FQ(n[0]);if(i)return i}}return n.length===4?n:[0,0,1,1]},BQ=(t,e,n,r)=>{var i=Uk(t,n),s=Uk(e,r),o=jQ(t,n),a=c=>c>1?1:c<0?0:c,l=c=>{for(var d=c>1?1:c,f=d,m=0;m<8;++m){var y=i(f)-d,x=o(f);if(Math.abs(y-d)<ww||x<ww)return s(f);f=a(f-y/x)}return s(f)};return l.isStepper=!1,l},jk=function(){return BQ(...zQ(...arguments))},HQ=function(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.stiff,r=n===void 0?100:n,i=e.damping,s=i===void 0?8:i,o=e.dt,a=o===void 0?16.67:o,l=1,c=[0],d=0,f=0,m=1e4,y=0;y<m;){var x=-(d-l)*r,S=f*s;if(f+=(x-S)*a/1e3,d+=f*a/1e3,c.push(d),Math.abs(d-l)<ww&&Math.abs(f)<ww)break;y++}c[c.length-1]=l;var _=c.length-1;return w=>{var A,T,C;if(w<=0)return 0;if(w>=1)return l;var O=w*_,N=Math.floor(O),D=O-N;return((A=c[N])!==null&&A!==void 0?A:0)+(((T=c[N+1])!==null&&T!==void 0?T:0)-((C=c[N])!==null&&C!==void 0?C:0))*D}},VQ=t=>{if(typeof t=="string")switch(t){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return jk(t);case"spring":return HQ();default:if(t.split("(")[0]==="cubic-bezier")return jk(t)}return typeof t=="function"?t:null},GQ=(t,e,n)=>{var r,i=s=>{var o=e.tick(s);if(e.getState()==="active"){if(n(e.getInterpolated()),e.getProgress()===1){e.complete(),r=void 0;return}r=t.setTimeout(i,o);return}r=t.setTimeout(i,o)};return r=t.setTimeout(i,0),()=>{var s;return(s=r)===null||s===void 0?void 0:s()}},L4=R.createContext(GQ);L4.Provider;function WQ(t){var e=R.useContext(L4);return R.useMemo(()=>t??e,[t,e])}function $Q(t,e,n){return(e=XQ(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function XQ(t){var e=qQ(t,"string");return typeof e=="symbol"?e:e+""}function qQ(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Fk="init",zk="pending",Bk="active",KQ="completed";function AE(t){return Math.max(0,t)}class YQ{getAnimationStartedTime(){return this.animationStartedTime}getBeginStartedTime(){return this.beginStartedTime}constructor(e){var n;$Q(this,"state",Fk),this.animationId=e.animationId,this.onAnimationEnd=e.onAnimationEnd,this.animationDuration=AE(e.animationDuration),this.animationBegin=AE(e.animationBegin),this.progress=0,this.from=e.from,this.to=e.to,this.easing=e.easing,(n=e.onAnimationStart)===null||n===void 0||n.call(e)}getState(){return this.state}getEasing(){return this.easing}getAnimationDuration(){return this.animationDuration}tick(e){if(this.getState()===Fk)return this.state=zk,this.beginStartedTime=e,this.animationBegin;if(this.getState()===zk){if(this.beginStartedTime==null)throw new Error;var n=e-this.beginStartedTime;return n>=this.animationBegin?(this.state=Bk,this.animationStartedTime=e,this.nextAnimationUpdate(0)):AE(this.animationBegin-n)}if(this.getState()===Bk){if(this.animationStartedTime==null)throw new Error;var r=e-this.animationStartedTime;return this.setProgress(r/this.animationDuration),this.nextAnimationUpdate(r)}return 0}setProgress(e){this.progress=Math.min(1,Math.max(0,e))}getProgress(){return this.progress}complete(){if(this.progress=1,this.state==="active"){var e;(e=this.onAnimationEnd)===null||e===void 0||e.call(this)}this.state=KQ}getFrom(){return this.from}getTo(){return this.to}getAnimationId(){return this.animationId}getAnimationBegin(){return this.animationBegin}}class ZQ extends YQ{nextAnimationUpdate(){return 0}getInterpolated(){return this.easing(Uc(this.getFrom(),this.getTo(),this.getProgress()))}}class QQ{setTimeout(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=performance.now(),i=null,s=o=>{o-r>=n?e(o):i=requestAnimationFrame(s)};return i=requestAnimationFrame(s),()=>{i!=null&&cancelAnimationFrame(i)}}}function JQ(t,e){return rJ(t)||nJ(t,e)||tJ(t,e)||eJ()}function eJ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tJ(t,e){if(t){if(typeof t=="string")return Hk(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Hk(t,e):void 0}}function Hk(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function nJ(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function rJ(t){if(Array.isArray(t))return t}var iJ={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},Vk=0,TE=1;function D4(t){var e=Jo(t,iJ),n=e.animationId,r=e.isActive,i=e.canBegin,s=e.duration,o=e.easing,a=e.begin,l=e.onAnimationEnd,c=e.onAnimationStart,d=e.children,f=N4(),m=r==="auto"?!Yy.isSsr&&!f:r,y=WQ(e.animationController),x=R.useState(m?Vk:TE),S=JQ(x,2),_=S[0],w=S[1];return R.useEffect(()=>{m||w(TE)},[m]),R.useEffect(()=>{var A=VQ(o);if(!m||!i||A==null)return zg;var T=new QQ,C=new ZQ({animationId:n,easing:A,animationDuration:s,animationBegin:a,onAnimationStart:c,onAnimationEnd:l,from:Vk,to:TE});return y(T,C,w)},[y,n,m,i,s,o,a,c,l]),d(Number(_))}function U4(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",n=R.useRef(ly(e)),r=R.useRef(t);return r.current!==t&&(n.current=ly(e),r.current=t),n.current}var sJ=t=>t.replace(/([A-Z])/g,e=>"-".concat(e.toLowerCase())),oJ=(t,e,n)=>t.map(r=>"".concat(sJ(r)," ").concat(e,"ms ").concat(n)).join(","),aJ=["radius"],lJ=["radius"],Gk,Wk,$k,Xk,qk,Kk,Yk,Zk,Qk,Jk;function eO(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function tO(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?eO(Object(n),!0).forEach(function(r){cJ(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):eO(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function cJ(t,e,n){return(e=uJ(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function uJ(t){var e=dJ(t,"string");return typeof e=="symbol"?e:e+""}function dJ(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Sw(){return Sw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Sw.apply(null,arguments)}function nO(t,e){if(t==null)return{};var n,r,i=fJ(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function fJ(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function hJ(t,e){return vJ(t)||gJ(t,e)||mJ(t,e)||pJ()}function pJ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mJ(t,e){if(t){if(typeof t=="string")return rO(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?rO(t,e):void 0}}function rO(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function gJ(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function vJ(t){if(Array.isArray(t))return t}function fl(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}var iO=(t,e,n,r,i)=>{var s=xd(n),o=xd(r),a=Math.min(Math.abs(s)/2,Math.abs(o)/2),l=o>=0?1:-1,c=s>=0?1:-1,d=o>=0&&s>=0||o<0&&s<0?1:0,f;if(a>0&&Array.isArray(i)){for(var m=[0,0,0,0],y=0,x=4;y<x;y++){var S,_=(S=i[y])!==null&&S!==void 0?S:0;m[y]=_>a?a:_}f=Di(Gk||(Gk=fl(["M",",",""])),t,e+l*m[0]),m[0]>0&&(f+=Di(Wk||(Wk=fl(["A ",",",",0,0,",",",",",""])),m[0],m[0],d,t+c*m[0],e)),f+=Di($k||($k=fl(["L ",",",""])),t+n-c*m[1],e),m[1]>0&&(f+=Di(Xk||(Xk=fl(["A ",",",",0,0,",`,
|
||
`,",",""])),m[1],m[1],d,t+n,e+l*m[1])),f+=Di(qk||(qk=fl(["L ",",",""])),t+n,e+r-l*m[2]),m[2]>0&&(f+=Di(Kk||(Kk=fl(["A ",",",",0,0,",`,
|
||
`,",",""])),m[2],m[2],d,t+n-c*m[2],e+r)),f+=Di(Yk||(Yk=fl(["L ",",",""])),t+c*m[3],e+r),m[3]>0&&(f+=Di(Zk||(Zk=fl(["A ",",",",0,0,",`,
|
||
`,",",""])),m[3],m[3],d,t,e+r-l*m[3])),f+="Z"}else if(a>0&&i===+i&&i>0){var w=Math.min(a,i);f=Di(Qk||(Qk=fl(["M ",",",`
|
||
A `,",",",0,0,",",",",",`
|
||
L `,",",`
|
||
A `,",",",0,0,",",",",",`
|
||
L `,",",`
|
||
A `,",",",0,0,",",",",",`
|
||
L `,",",`
|
||
A `,",",",0,0,",",",","," Z"])),t,e+l*w,w,w,d,t+c*w,e,t+n-c*w,e,w,w,d,t+n,e+l*w,t+n,e+r-l*w,w,w,d,t+n-c*w,e+r,t+c*w,e+r,w,w,d,t,e+r-l*w)}else f=Di(Jk||(Jk=fl(["M ",","," h "," v "," h "," Z"])),t,e,n,r,-n);return f},sO={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},yJ=t=>{var e=Jo(t,sO),n=R.useRef(null),r=R.useState(-1),i=hJ(r,2),s=i[0],o=i[1];R.useEffect(()=>{if(n.current&&n.current.getTotalLength)try{var B=n.current.getTotalLength();B&&o(B)}catch{}},[]);var a=e.x,l=e.y,c=e.width,d=e.height,f=e.radius,m=e.className,y=e.animationEasing,x=e.animationDuration,S=e.animationBegin,_=e.isAnimationActive,w=e.isUpdateAnimationActive,A=R.useRef(c),T=R.useRef(d),C=R.useRef(a),O=R.useRef(l),N=R.useMemo(()=>({x:a,y:l,width:c,height:d,radius:f}),[a,l,c,d,f]),D=U4(N,"rectangle-");if(a!==+a||l!==+l||c!==+c||d!==+d||c===0||d===0)return null;var F=er("recharts-rectangle",m);if(!w){var V=Ko(e);V.radius;var k=nO(V,aJ);return R.createElement("path",Sw({},k,{x:xd(a),y:xd(l),width:xd(c),height:xd(d),radius:typeof f=="number"?f:void 0,className:F,d:iO(a,l,c,d,f)}))}var j=A.current,H=T.current,ne=C.current,te=O.current,pe="0px ".concat(s===-1?1:s,"px"),oe="".concat(s,"px ").concat(s,"px"),ce=oJ(["strokeDasharray"],x,typeof y=="string"?y:sO.animationEasing);return R.createElement(D4,{animationId:D,key:D,canBegin:s>0,duration:x,easing:y,isActive:w,begin:S},B=>{var K=Uc(j,c,B),q=Uc(H,d,B),$=Uc(ne,a,B),Z=Uc(te,l,B);n.current&&(A.current=K,T.current=q,C.current=$,O.current=Z);var ge;_?B>0?ge={transition:ce,strokeDasharray:oe}:ge={strokeDasharray:pe}:ge={strokeDasharray:oe};var ae=Ko(e);ae.radius;var fe=nO(ae,lJ);return R.createElement("path",Sw({},fe,{radius:typeof f=="number"?f:void 0,className:F,d:iO($,Z,K,q,f),ref:n,style:tO(tO({},ge),e.style)}))})};function oO(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function aO(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?oO(Object(n),!0).forEach(function(r){xJ(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):oO(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function xJ(t,e,n){return(e=bJ(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function bJ(t){var e=_J(t,"string");return typeof e=="symbol"?e:e+""}function _J(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Mw=Math.PI/180,wJ=t=>t*180/Math.PI,zi=(t,e,n,r)=>({x:t+Math.cos(-Mw*r)*n,y:e+Math.sin(-Mw*r)*n}),SJ=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(e-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},MJ=(t,e)=>{var n=t.x,r=t.y,i=e.x,s=e.y;return Math.sqrt((n-i)**2+(r-s)**2)},EJ=(t,e)=>{var n=t.x,r=t.y,i=e.cx,s=e.cy,o=MJ({x:n,y:r},{x:i,y:s});if(o<=0)return{radius:o,angle:0};var a=(n-i)/o,l=Math.acos(a);return r>s&&(l=2*Math.PI-l),{radius:o,angle:wJ(l),angleInRadian:l}},AJ=t=>{var e=t.startAngle,n=t.endAngle,r=Math.floor(e/360),i=Math.floor(n/360),s=Math.min(r,i);return{startAngle:e-s*360,endAngle:n-s*360}},TJ=(t,e)=>{var n=e.startAngle,r=e.endAngle,i=Math.floor(n/360),s=Math.floor(r/360),o=Math.min(i,s);return t+o*360},CJ=(t,e)=>{var n=t.relativeX,r=t.relativeY,i=EJ({x:n,y:r},e),s=i.radius,o=i.angle,a=e.innerRadius,l=e.outerRadius;if(s<a||s>l||s===0)return null;var c=AJ(e),d=c.startAngle,f=c.endAngle,m=o,y;if(d<=f){for(;m>f;)m-=360;for(;m<d;)m+=360;y=m>=d&&m<=f}else{for(;m>d;)m-=360;for(;m<f;)m+=360;y=m>=f&&m<=d}return y?aO(aO({},e),{},{radius:s,angle:TJ(m,e)}):null};function j4(t){var e=t.cx,n=t.cy,r=t.radius,i=t.startAngle,s=t.endAngle,o=zi(e,n,r,i),a=zi(e,n,r,s);return{points:[o,a],cx:e,cy:n,radius:r,startAngle:i,endAngle:s}}var lO,cO,uO,dO,fO,hO,pO;function yC(){return yC=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},yC.apply(null,arguments)}function eh(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}var PJ=(t,e)=>{var n=Wo(e-t),r=Math.min(Math.abs(e-t),359.999);return n*r},Tb=t=>{var e=t.cx,n=t.cy,r=t.radius,i=t.angle,s=t.sign,o=t.isExternal,a=t.cornerRadius,l=t.cornerIsExternal,c=a*(o?1:-1)+r,d=Math.asin(a/c)/Mw,f=l?i:i+s*d,m=zi(e,n,c,f),y=zi(e,n,r,f),x=l?i-s*d:i,S=zi(e,n,c*Math.cos(d*Mw),x);return{center:m,circleTangency:y,lineTangency:S,theta:d}},F4=t=>{var e=t.cx,n=t.cy,r=t.innerRadius,i=t.outerRadius,s=t.startAngle,o=t.endAngle,a=PJ(s,o),l=s+a,c=zi(e,n,i,s),d=zi(e,n,i,l),f=Di(lO||(lO=eh(["M ",",",`
|
||
A `,",",`,0,
|
||
`,",",`,
|
||
`,",",`
|
||
`])),c.x,c.y,i,i,+(Math.abs(a)>180),+(s>l),d.x,d.y);if(r>0){var m=zi(e,n,r,s),y=zi(e,n,r,l);f+=Di(cO||(cO=eh(["L ",",",`
|
||
A `,",",`,0,
|
||
`,",",`,
|
||
`,","," Z"])),y.x,y.y,r,r,+(Math.abs(a)>180),+(s<=l),m.x,m.y)}else f+=Di(uO||(uO=eh(["L ",","," Z"])),e,n);return f},RJ=t=>{var e=t.cx,n=t.cy,r=t.innerRadius,i=t.outerRadius,s=t.cornerRadius,o=t.forceCornerRadius,a=t.cornerIsExternal,l=t.startAngle,c=t.endAngle,d=Wo(c-l),f=Tb({cx:e,cy:n,radius:i,angle:l,sign:d,cornerRadius:s,cornerIsExternal:a}),m=f.circleTangency,y=f.lineTangency,x=f.theta,S=Tb({cx:e,cy:n,radius:i,angle:c,sign:-d,cornerRadius:s,cornerIsExternal:a}),_=S.circleTangency,w=S.lineTangency,A=S.theta,T=a?Math.abs(l-c):Math.abs(l-c)-x-A;if(T<0)return o?Di(dO||(dO=eh(["M ",",",`
|
||
a`,",",",0,0,1,",`,0
|
||
a`,",",",0,0,1,",`,0
|
||
`])),y.x,y.y,s,s,s*2,s,s,-s*2):F4({cx:e,cy:n,innerRadius:r,outerRadius:i,startAngle:l,endAngle:c});var C=Di(fO||(fO=eh(["M ",",",`
|
||
A`,",",",0,0,",",",",",`
|
||
A`,",",",0,",",",",",",",`
|
||
A`,",",",0,0,",",",",",`
|
||
`])),y.x,y.y,s,s,+(d<0),m.x,m.y,i,i,+(T>180),+(d<0),_.x,_.y,s,s,+(d<0),w.x,w.y);if(r>0){var O=Tb({cx:e,cy:n,radius:r,angle:l,sign:d,isExternal:!0,cornerRadius:s,cornerIsExternal:a}),N=O.circleTangency,D=O.lineTangency,F=O.theta,V=Tb({cx:e,cy:n,radius:r,angle:c,sign:-d,isExternal:!0,cornerRadius:s,cornerIsExternal:a}),k=V.circleTangency,j=V.lineTangency,H=V.theta,ne=a?Math.abs(l-c):Math.abs(l-c)-F-H;if(ne<0&&s===0)return"".concat(C,"L").concat(e,",").concat(n,"Z");C+=Di(hO||(hO=eh(["L",",",`
|
||
A`,",",",0,0,",",",",",`
|
||
A`,",",",0,",",",",",",",`
|
||
A`,",",",0,0,",",",",","Z"])),j.x,j.y,s,s,+(d<0),k.x,k.y,r,r,+(ne>180),+(d>0),N.x,N.y,s,s,+(d<0),D.x,D.y)}else C+=Di(pO||(pO=eh(["L",",","Z"])),e,n);return C},NJ={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},IJ=t=>{var e=Jo(t,NJ),n=e.cx,r=e.cy,i=e.innerRadius,s=e.outerRadius,o=e.cornerRadius,a=e.forceCornerRadius,l=e.cornerIsExternal,c=e.startAngle,d=e.endAngle,f=e.className;if(s<i||c===d)return null;var m=er("recharts-sector",f),y=s-i,x=Ad(o,y,0,!0),S;return x>0&&Math.abs(c-d)<360?S=RJ({cx:n,cy:r,innerRadius:i,outerRadius:s,cornerRadius:Math.min(x,y/2),forceCornerRadius:a,cornerIsExternal:l,startAngle:c,endAngle:d}):S=F4({cx:n,cy:r,innerRadius:i,outerRadius:s,startAngle:c,endAngle:d}),R.createElement("path",yC({},Ko(e),{className:m,d:S}))};function kJ(t,e,n){if(t==="horizontal")return[{x:e.x,y:n.top},{x:e.x,y:n.top+n.height}];if(t==="vertical")return[{x:n.left,y:e.y},{x:n.left+n.width,y:e.y}];if(b5(e)){if(t==="centric"){var r=e.cx,i=e.cy,s=e.innerRadius,o=e.outerRadius,a=e.angle,l=zi(r,i,s,a),c=zi(r,i,o,a);return[{x:l.x,y:l.y},{x:c.x,y:c.y}]}return j4(e)}}function OJ(t){return O5(t)?NaN:Number(t)}function CE(t){return t?(t=OJ(t),t===1/0||t===-1/0?(t<0?-1:1)*Number.MAX_VALUE:t===t?t:0):t===0?t:0}function z4(t,e,n){n&&typeof n!="number"&&QT(t,e,n)&&(e=n=void 0),t=CE(t),e===void 0?(e=t,t=0):e=CE(e),n=n===void 0?t<e?1:-1:CE(n);const r=Math.max(Math.ceil((e-t)/(n||1)),0),i=new Array(r);for(let s=0;s<r;s++)i[s]=t,t+=n;return i}var $a=t=>t.chartData,qP=Oe([$a],t=>{var e=t.chartData!=null?t.chartData.length-1:0;return{chartData:t.chartData,computedData:t.computedData,dataEndIndex:e,dataStartIndex:0}}),xS=(t,e,n,r)=>r?qP(t):$a(t),LJ=(t,e,n)=>n?qP(t):$a(t),DJ=Oe([xS],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});Oe([qP],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});var UJ=Oe([$a],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});function KP(t,e){return BJ(t)||zJ(t,e)||FJ(t,e)||jJ()}function jJ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function FJ(t,e){if(t){if(typeof t=="string")return mO(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?mO(t,e):void 0}}function mO(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function zJ(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function BJ(t){if(Array.isArray(t))return t}function Al(t){if(Array.isArray(t)&&t.length===2){var e=KP(t,2),n=e[0],r=e[1];if(wn(n)&&wn(r))return!0}return!1}function gO(t,e,n){return n?t:[Math.min(t[0],e[0]),Math.max(t[1],e[1])]}function B4(t,e){if(e&&typeof t!="function"&&Array.isArray(t)&&t.length===2){var n=KP(t,2),r=n[0],i=n[1],s,o;if(wn(r))s=r;else if(typeof r=="function")return;if(wn(i))o=i;else if(typeof i=="function")return;var a=[s,o];if(Al(a))return a}}function HJ(t,e,n){if(!(!n&&e==null)){if(typeof t=="function"&&e!=null)try{var r=t(e,n);if(Al(r))return gO(r,e,n)}catch{}if(Array.isArray(t)&&t.length===2){var i=KP(t,2),s=i[0],o=i[1],a,l;if(s==="auto")e!=null&&(a=Math.min(...e));else if(Nt(s))a=s;else if(typeof s=="function")try{e!=null&&(a=s(e==null?void 0:e[0]))}catch{}else if(typeof s=="string"&&lk.test(s)){var c=lk.exec(s);if(c==null||c[1]==null||e==null)a=void 0;else{var d=+c[1];a=e[0]-d}}else a=e==null?void 0:e[0];if(o==="auto")e!=null&&(l=Math.max(...e));else if(Nt(o))l=o;else if(typeof o=="function")try{e!=null&&(l=o(e==null?void 0:e[1]))}catch{}else if(typeof o=="string"&&ck.test(o)){var f=ck.exec(o);if(f==null||f[1]==null||e==null)l=void 0;else{var m=+f[1];l=e[1]+m}}else l=e==null?void 0:e[1];var y=[a,l];if(Al(y))return e==null?y:gO(y,e,n)}}}var Hg=1e9,VJ={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},ZP,ur=!0,Zo="[DecimalError] ",_h=Zo+"Invalid argument: ",YP=Zo+"Exponent out of range: ",Vg=Math.floor,$f=Math.pow,GJ=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,yo,vi=1e7,or=7,H4=9007199254740991,Ew=Vg(H4/or),At={};At.absoluteValue=At.abs=function(){var t=new this.constructor(this);return t.s&&(t.s=1),t};At.comparedTo=At.cmp=function(t){var e,n,r,i,s=this;if(t=new s.constructor(t),s.s!==t.s)return s.s||-t.s;if(s.e!==t.e)return s.e>t.e^s.s<0?1:-1;for(r=s.d.length,i=t.d.length,e=0,n=r<i?r:i;e<n;++e)if(s.d[e]!==t.d[e])return s.d[e]>t.d[e]^s.s<0?1:-1;return r===i?0:r>i^s.s<0?1:-1};At.decimalPlaces=At.dp=function(){var t=this,e=t.d.length-1,n=(e-t.e)*or;if(e=t.d[e],e)for(;e%10==0;e/=10)n--;return n<0?0:n};At.dividedBy=At.div=function(t){return Vc(this,new this.constructor(t))};At.dividedToIntegerBy=At.idiv=function(t){var e=this,n=e.constructor;return Yn(Vc(e,new n(t),0,1),n.precision)};At.equals=At.eq=function(t){return!this.cmp(t)};At.exponent=function(){return Vr(this)};At.greaterThan=At.gt=function(t){return this.cmp(t)>0};At.greaterThanOrEqualTo=At.gte=function(t){return this.cmp(t)>=0};At.isInteger=At.isint=function(){return this.e>this.d.length-2};At.isNegative=At.isneg=function(){return this.s<0};At.isPositive=At.ispos=function(){return this.s>0};At.isZero=function(){return this.s===0};At.lessThan=At.lt=function(t){return this.cmp(t)<0};At.lessThanOrEqualTo=At.lte=function(t){return this.cmp(t)<1};At.logarithm=At.log=function(t){var e,n=this,r=n.constructor,i=r.precision,s=i+5;if(t===void 0)t=new r(10);else if(t=new r(t),t.s<1||t.eq(yo))throw Error(Zo+"NaN");if(n.s<1)throw Error(Zo+(n.s?"NaN":"-Infinity"));return n.eq(yo)?new r(0):(ur=!1,e=Vc(my(n,s),my(t,s),s),ur=!0,Yn(e,i))};At.minus=At.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?W4(e,t):V4(e,(t.s=-t.s,t))};At.modulo=At.mod=function(t){var e,n=this,r=n.constructor,i=r.precision;if(t=new r(t),!t.s)throw Error(Zo+"NaN");return n.s?(ur=!1,e=Vc(n,t,0,1).times(t),ur=!0,n.minus(e)):Yn(new r(n),i)};At.naturalExponential=At.exp=function(){return G4(this)};At.naturalLogarithm=At.ln=function(){return my(this)};At.negated=At.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};At.plus=At.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?V4(e,t):W4(e,(t.s=-t.s,t))};At.precision=At.sd=function(t){var e,n,r,i=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(_h+t);if(e=Vr(i)+1,r=i.d.length-1,n=r*or+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return t&&e>n?e:n};At.squareRoot=At.sqrt=function(){var t,e,n,r,i,s,o,a=this,l=a.constructor;if(a.s<1){if(!a.s)return new l(0);throw Error(Zo+"NaN")}for(t=Vr(a),ur=!1,i=Math.sqrt(+a),i==0||i==1/0?(e=Sl(a.d),(e.length+t)%2==0&&(e+="0"),i=Math.sqrt(e),t=Vg((t+1)/2)-(t<0||t%2),i==1/0?e="5e"+t:(e=i.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),r=new l(e)):r=new l(i.toString()),n=l.precision,i=o=n+3;;)if(s=r,r=s.plus(Vc(a,s,o+2)).times(.5),Sl(s.d).slice(0,o)===(e=Sl(r.d)).slice(0,o)){if(e=e.slice(o-3,o+1),i==o&&e=="4999"){if(Yn(s,n+1,0),s.times(s).eq(a)){r=s;break}}else if(e!="9999")break;o+=4}return ur=!0,Yn(r,n)};At.times=At.mul=function(t){var e,n,r,i,s,o,a,l,c,d=this,f=d.constructor,m=d.d,y=(t=new f(t)).d;if(!d.s||!t.s)return new f(0);for(t.s*=d.s,n=d.e+t.e,l=m.length,c=y.length,l<c&&(s=m,m=y,y=s,o=l,l=c,c=o),s=[],o=l+c,r=o;r--;)s.push(0);for(r=c;--r>=0;){for(e=0,i=l+r;i>r;)a=s[i]+y[r]*m[i-r-1]+e,s[i--]=a%vi|0,e=a/vi|0;s[i]=(s[i]+e)%vi|0}for(;!s[--o];)s.pop();return e?++n:s.shift(),t.d=s,t.e=n,ur?Yn(t,f.precision):t};At.toDecimalPlaces=At.todp=function(t,e){var n=this,r=n.constructor;return n=new r(n),t===void 0?n:(Ol(t,0,Hg),e===void 0?e=r.rounding:Ol(e,0,8),Yn(n,t+Vr(n)+1,e))};At.toExponential=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=Oh(r,!0):(Ol(t,0,Hg),e===void 0?e=i.rounding:Ol(e,0,8),r=Yn(new i(r),t+1,e),n=Oh(r,!0,t+1)),n};At.toFixed=function(t,e){var n,r,i=this,s=i.constructor;return t===void 0?Oh(i):(Ol(t,0,Hg),e===void 0?e=s.rounding:Ol(e,0,8),r=Yn(new s(i),t+Vr(i)+1,e),n=Oh(r.abs(),!1,t+Vr(r)+1),i.isneg()&&!i.isZero()?"-"+n:n)};At.toInteger=At.toint=function(){var t=this,e=t.constructor;return Yn(new e(t),Vr(t)+1,e.rounding)};At.toNumber=function(){return+this};At.toPower=At.pow=function(t){var e,n,r,i,s,o,a=this,l=a.constructor,c=12,d=+(t=new l(t));if(!t.s)return new l(yo);if(a=new l(a),!a.s){if(t.s<1)throw Error(Zo+"Infinity");return a}if(a.eq(yo))return a;if(r=l.precision,t.eq(yo))return Yn(a,r);if(e=t.e,n=t.d.length-1,o=e>=n,s=a.s,o){if((n=d<0?-d:d)<=H4){for(i=new l(yo),e=Math.ceil(r/or+4),ur=!1;n%2&&(i=i.times(a),yO(i.d,e)),n=Vg(n/2),n!==0;)a=a.times(a),yO(a.d,e);return ur=!0,t.s<0?new l(yo).div(i):Yn(i,r)}}else if(s<0)throw Error(Zo+"NaN");return s=s<0&&t.d[Math.max(e,n)]&1?-1:1,a.s=1,ur=!1,i=t.times(my(a,r+c)),ur=!0,i=G4(i),i.s=s,i};At.toPrecision=function(t,e){var n,r,i=this,s=i.constructor;return t===void 0?(n=Vr(i),r=Oh(i,n<=s.toExpNeg||n>=s.toExpPos)):(Ol(t,1,Hg),e===void 0?e=s.rounding:Ol(e,0,8),i=Yn(new s(i),t,e),n=Vr(i),r=Oh(i,t<=n||n<=s.toExpNeg,t)),r};At.toSignificantDigits=At.tosd=function(t,e){var n=this,r=n.constructor;return t===void 0?(t=r.precision,e=r.rounding):(Ol(t,1,Hg),e===void 0?e=r.rounding:Ol(e,0,8)),Yn(new r(n),t,e)};At.toString=At.valueOf=At.val=At.toJSON=At[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=Vr(t),n=t.constructor;return Oh(t,e<=n.toExpNeg||e>=n.toExpPos)};function V4(t,e){var n,r,i,s,o,a,l,c,d=t.constructor,f=d.precision;if(!t.s||!e.s)return e.s||(e=new d(t)),ur?Yn(e,f):e;if(l=t.d,c=e.d,o=t.e,i=e.e,l=l.slice(),s=o-i,s){for(s<0?(r=l,s=-s,a=c.length):(r=c,i=o,a=l.length),o=Math.ceil(f/or),a=o>a?o+1:a+1,s>a&&(s=a,r.length=1),r.reverse();s--;)r.push(0);r.reverse()}for(a=l.length,s=c.length,a-s<0&&(s=a,r=c,c=l,l=r),n=0;s;)n=(l[--s]=l[s]+c[s]+n)/vi|0,l[s]%=vi;for(n&&(l.unshift(n),++i),a=l.length;l[--a]==0;)l.pop();return e.d=l,e.e=i,ur?Yn(e,f):e}function Ol(t,e,n){if(t!==~~t||t<e||t>n)throw Error(_h+t)}function Sl(t){var e,n,r,i=t.length-1,s="",o=t[0];if(i>0){for(s+=o,e=1;e<i;e++)r=t[e]+"",n=or-r.length,n&&(s+=ad(n)),s+=r;o=t[e],r=o+"",n=or-r.length,n&&(s+=ad(n))}else if(o===0)return"0";for(;o%10===0;)o/=10;return s+o}var Vc=(function(){function t(r,i){var s,o=0,a=r.length;for(r=r.slice();a--;)s=r[a]*i+o,r[a]=s%vi|0,o=s/vi|0;return o&&r.unshift(o),r}function e(r,i,s,o){var a,l;if(s!=o)l=s>o?1:-1;else for(a=l=0;a<s;a++)if(r[a]!=i[a]){l=r[a]>i[a]?1:-1;break}return l}function n(r,i,s){for(var o=0;s--;)r[s]-=o,o=r[s]<i[s]?1:0,r[s]=o*vi+r[s]-i[s];for(;!r[0]&&r.length>1;)r.shift()}return function(r,i,s,o){var a,l,c,d,f,m,y,x,S,_,w,A,T,C,O,N,D,F,V=r.constructor,k=r.s==i.s?1:-1,j=r.d,H=i.d;if(!r.s)return new V(r);if(!i.s)throw Error(Zo+"Division by zero");for(l=r.e-i.e,D=H.length,O=j.length,y=new V(k),x=y.d=[],c=0;H[c]==(j[c]||0);)++c;if(H[c]>(j[c]||0)&&--l,s==null?A=s=V.precision:o?A=s+(Vr(r)-Vr(i))+1:A=s,A<0)return new V(0);if(A=A/or+2|0,c=0,D==1)for(d=0,H=H[0],A++;(c<O||d)&&A--;c++)T=d*vi+(j[c]||0),x[c]=T/H|0,d=T%H|0;else{for(d=vi/(H[0]+1)|0,d>1&&(H=t(H,d),j=t(j,d),D=H.length,O=j.length),C=D,S=j.slice(0,D),_=S.length;_<D;)S[_++]=0;F=H.slice(),F.unshift(0),N=H[0],H[1]>=vi/2&&++N;do d=0,a=e(H,S,D,_),a<0?(w=S[0],D!=_&&(w=w*vi+(S[1]||0)),d=w/N|0,d>1?(d>=vi&&(d=vi-1),f=t(H,d),m=f.length,_=S.length,a=e(f,S,m,_),a==1&&(d--,n(f,D<m?F:H,m))):(d==0&&(a=d=1),f=H.slice()),m=f.length,m<_&&f.unshift(0),n(S,f,_),a==-1&&(_=S.length,a=e(H,S,D,_),a<1&&(d++,n(S,D<_?F:H,_))),_=S.length):a===0&&(d++,S=[0]),x[c++]=d,a&&S[0]?S[_++]=j[C]||0:(S=[j[C]],_=1);while((C++<O||S[0]!==void 0)&&A--)}return x[0]||x.shift(),y.e=l,Yn(y,o?s+Vr(y)+1:s)}})();function G4(t,e){var n,r,i,s,o,a,l=0,c=0,d=t.constructor,f=d.precision;if(Vr(t)>16)throw Error(YP+Vr(t));if(!t.s)return new d(yo);for(ur=!1,a=f,o=new d(.03125);t.abs().gte(.1);)t=t.times(o),c+=5;for(r=Math.log($f(2,c))/Math.LN10*2+5|0,a+=r,n=i=s=new d(yo),d.precision=a;;){if(i=Yn(i.times(t),a),n=n.times(++l),o=s.plus(Vc(i,n,a)),Sl(o.d).slice(0,a)===Sl(s.d).slice(0,a)){for(;c--;)s=Yn(s.times(s),a);return d.precision=f,e==null?(ur=!0,Yn(s,f)):s}s=o}}function Vr(t){for(var e=t.e*or,n=t.d[0];n>=10;n/=10)e++;return e}function PE(t,e,n){if(e>t.LN10.sd())throw ur=!0,n&&(t.precision=n),Error(Zo+"LN10 precision limit exceeded");return Yn(new t(t.LN10),e)}function ad(t){for(var e="";t--;)e+="0";return e}function my(t,e){var n,r,i,s,o,a,l,c,d,f=1,m=10,y=t,x=y.d,S=y.constructor,_=S.precision;if(y.s<1)throw Error(Zo+(y.s?"NaN":"-Infinity"));if(y.eq(yo))return new S(0);if(e==null?(ur=!1,c=_):c=e,y.eq(10))return e==null&&(ur=!0),PE(S,c);if(c+=m,S.precision=c,n=Sl(x),r=n.charAt(0),s=Vr(y),Math.abs(s)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)y=y.times(t),n=Sl(y.d),r=n.charAt(0),f++;s=Vr(y),r>1?(y=new S("0."+n),s++):y=new S(r+"."+n.slice(1))}else return l=PE(S,c+2,_).times(s+""),y=my(new S(r+"."+n.slice(1)),c-m).plus(l),S.precision=_,e==null?(ur=!0,Yn(y,_)):y;for(a=o=y=Vc(y.minus(yo),y.plus(yo),c),d=Yn(y.times(y),c),i=3;;){if(o=Yn(o.times(d),c),l=a.plus(Vc(o,new S(i),c)),Sl(l.d).slice(0,c)===Sl(a.d).slice(0,c))return a=a.times(2),s!==0&&(a=a.plus(PE(S,c+2,_).times(s+""))),a=Vc(a,new S(f),c),S.precision=_,e==null?(ur=!0,Yn(a,_)):a;a=l,i+=2}}function vO(t,e){var n,r,i;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(n<0&&(n=r),n+=+e.slice(r+1),e=e.substring(0,r)):n<0&&(n=e.length),r=0;e.charCodeAt(r)===48;)++r;for(i=e.length;e.charCodeAt(i-1)===48;)--i;if(e=e.slice(r,i),e){if(i-=r,n=n-r-1,t.e=Vg(n/or),t.d=[],r=(n+1)%or,n<0&&(r+=or),r<i){for(r&&t.d.push(+e.slice(0,r)),i-=or;r<i;)t.d.push(+e.slice(r,r+=or));e=e.slice(r),r=or-e.length}else r-=i;for(;r--;)e+="0";if(t.d.push(+e),ur&&(t.e>Ew||t.e<-Ew))throw Error(YP+n)}else t.s=0,t.e=0,t.d=[0];return t}function Yn(t,e,n){var r,i,s,o,a,l,c,d,f=t.d;for(o=1,s=f[0];s>=10;s/=10)o++;if(r=e-o,r<0)r+=or,i=e,c=f[d=0];else{if(d=Math.ceil((r+1)/or),s=f.length,d>=s)return t;for(c=s=f[d],o=1;s>=10;s/=10)o++;r%=or,i=r-or+o}if(n!==void 0&&(s=$f(10,o-i-1),a=c/s%10|0,l=e<0||f[d+1]!==void 0||c%s,l=n<4?(a||l)&&(n==0||n==(t.s<0?3:2)):a>5||a==5&&(n==4||l||n==6&&(r>0?i>0?c/$f(10,o-i):0:f[d-1])%10&1||n==(t.s<0?8:7))),e<1||!f[0])return l?(s=Vr(t),f.length=1,e=e-s-1,f[0]=$f(10,(or-e%or)%or),t.e=Vg(-e/or)||0):(f.length=1,f[0]=t.e=t.s=0),t;if(r==0?(f.length=d,s=1,d--):(f.length=d+1,s=$f(10,or-r),f[d]=i>0?(c/$f(10,o-i)%$f(10,i)|0)*s:0),l)for(;;)if(d==0){(f[0]+=s)==vi&&(f[0]=1,++t.e);break}else{if(f[d]+=s,f[d]!=vi)break;f[d--]=0,s=1}for(r=f.length;f[--r]===0;)f.pop();if(ur&&(t.e>Ew||t.e<-Ew))throw Error(YP+Vr(t));return t}function W4(t,e){var n,r,i,s,o,a,l,c,d,f,m=t.constructor,y=m.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new m(t),ur?Yn(e,y):e;if(l=t.d,f=e.d,r=e.e,c=t.e,l=l.slice(),o=c-r,o){for(d=o<0,d?(n=l,o=-o,a=f.length):(n=f,r=c,a=l.length),i=Math.max(Math.ceil(y/or),a)+2,o>i&&(o=i,n.length=1),n.reverse(),i=o;i--;)n.push(0);n.reverse()}else{for(i=l.length,a=f.length,d=i<a,d&&(a=i),i=0;i<a;i++)if(l[i]!=f[i]){d=l[i]<f[i];break}o=0}for(d&&(n=l,l=f,f=n,e.s=-e.s),a=l.length,i=f.length-a;i>0;--i)l[a++]=0;for(i=f.length;i>o;){if(l[--i]<f[i]){for(s=i;s&&l[--s]===0;)l[s]=vi-1;--l[s],l[i]+=vi}l[i]-=f[i]}for(;l[--a]===0;)l.pop();for(;l[0]===0;l.shift())--r;return l[0]?(e.d=l,e.e=r,ur?Yn(e,y):e):new m(0)}function Oh(t,e,n){var r,i=Vr(t),s=Sl(t.d),o=s.length;return e?(n&&(r=n-o)>0?s=s.charAt(0)+"."+s.slice(1)+ad(r):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(i<0?"e":"e+")+i):i<0?(s="0."+ad(-i-1)+s,n&&(r=n-o)>0&&(s+=ad(r))):i>=o?(s+=ad(i+1-o),n&&(r=n-i-1)>0&&(s=s+"."+ad(r))):((r=i+1)<o&&(s=s.slice(0,r)+"."+s.slice(r)),n&&(r=n-o)>0&&(i+1===o&&(s+="."),s+=ad(r))),t.s<0?"-"+s:s}function yO(t,e){if(t.length>e)return t.length=e,!0}function $4(t){var e,n,r;function i(s){var o=this;if(!(o instanceof i))return new i(s);if(o.constructor=i,s instanceof i){o.s=s.s,o.e=s.e,o.d=(s=s.d)?s.slice():s;return}if(typeof s=="number"){if(s*0!==0)throw Error(_h+s);if(s>0)o.s=1;else if(s<0)s=-s,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(s===~~s&&s<1e7){o.e=0,o.d=[s];return}return vO(o,s.toString())}else if(typeof s!="string")throw Error(_h+s);if(s.charCodeAt(0)===45?(s=s.slice(1),o.s=-1):o.s=1,GJ.test(s))vO(o,s);else throw Error(_h+s)}if(i.prototype=At,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=$4,i.config=i.set=WJ,t===void 0&&(t={}),t)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],e=0;e<r.length;)t.hasOwnProperty(n=r[e++])||(t[n]=this[n]);return i.config(t),i}function WJ(t){if(!t||typeof t!="object")throw Error(Zo+"Object expected");var e,n,r,i=["precision",1,Hg,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(e=0;e<i.length;e+=3)if((r=t[n=i[e]])!==void 0)if(Vg(r)===r&&r>=i[e+1]&&r<=i[e+2])this[n]=r;else throw Error(_h+n+": "+r);if((r=t[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(_h+n+": "+r);return this}var ZP=$4(VJ);yo=new ZP(1);const Tn=ZP;function X4(t){var e;return t===0?e=1:e=Math.floor(new Tn(t).abs().log(10).toNumber())+1,e}function q4(t,e,n){for(var r=new Tn(t),i=0,s=[];r.lt(e)&&i<1e5;)s.push(r.toNumber()),r=r.add(n),i++;return s}function gy(t,e){return KJ(t)||qJ(t,e)||XJ(t,e)||$J()}function $J(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function XJ(t,e){if(t){if(typeof t=="string")return xO(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?xO(t,e):void 0}}function xO(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function qJ(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function KJ(t){if(Array.isArray(t))return t}var K4=t=>{var e=gy(t,2),n=e[0],r=e[1],i=n,s=r;return n>r&&(i=r,s=n),[i,s]},QP=(t,e,n)=>{if(t.lte(0))return new Tn(0);var r=X4(t.toNumber()),i=new Tn(10).pow(r),s=t.div(i),o=r!==1?.05:.1,a=new Tn(Math.ceil(s.div(o).toNumber())).add(n).mul(o),l=a.mul(i);return e?new Tn(l.toNumber()):new Tn(Math.ceil(l.toNumber()))},Y4=(t,e,n)=>{var r;if(t.lte(0))return new Tn(0);var i=[1,2,2.5,5],s=t.toNumber(),o=Math.floor(new Tn(s).abs().log(10).toNumber()),a=new Tn(10).pow(o),l=t.div(a).toNumber(),c=i.findIndex(y=>y>=l-1e-10);if(c===-1&&(a=a.mul(10),c=0),c+=n,c>=i.length){var d=Math.floor(c/i.length);c%=i.length,a=a.mul(new Tn(10).pow(d))}var f=(r=i[c])!==null&&r!==void 0?r:1,m=new Tn(f).mul(a);return e?m:new Tn(Math.ceil(m.toNumber()))},YJ=(t,e,n)=>{var r=new Tn(1),i=new Tn(t);if(!i.isint()&&n){var s=Math.abs(t);s<1?(r=new Tn(10).pow(X4(t)-1),i=new Tn(Math.floor(i.div(r).toNumber())).mul(r)):s>1&&(i=new Tn(Math.floor(t)))}else t===0?i=new Tn(Math.floor((e-1)/2)):n||(i=new Tn(Math.floor(t)));for(var o=Math.floor((e-1)/2),a=[],l=0;l<e;l++)a.push(i.add(new Tn(l-o).mul(r)).toNumber());return a},Z4=function(e,n,r,i){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:QP;if(!Number.isFinite((n-e)/(r-1)))return{step:new Tn(0),tickMin:new Tn(0),tickMax:new Tn(0)};var a=o(new Tn(n).sub(e).div(r-1),i,s),l;e<=0&&n>=0?l=new Tn(0):(l=new Tn(e).add(n).div(2),l=l.sub(new Tn(l).mod(a)));var c=Math.ceil(l.sub(e).div(a).toNumber()),d=Math.ceil(new Tn(n).sub(l).div(a).toNumber()),f=c+d+1;return f>r?Z4(e,n,r,i,s+1,o):(f<r&&(d=n>0?d+(r-f):d,c=n>0?c:c+(r-f)),{step:a,tickMin:l.sub(new Tn(c).mul(a)),tickMax:l.add(new Tn(d).mul(a))})},bO=function(e){var n=gy(e,2),r=n[0],i=n[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",l=Math.max(s,2),c=K4([r,i]),d=gy(c,2),f=d[0],m=d[1];if(f===-1/0||m===1/0){var y=m===1/0?[f,...Array(s-1).fill(1/0)]:[...Array(s-1).fill(-1/0),m];return r>i?y.reverse():y}if(f===m)return YJ(f,s,o);var x=a==="snap125"?Y4:QP,S=Z4(f,m,l,o,0,x),_=S.step,w=S.tickMin,A=S.tickMax,T=q4(w,A.add(new Tn(.1).mul(_)),_);return r>i?T.reverse():T},_O=function(e,n){var r=gy(e,2),i=r[0],s=r[1],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",l=K4([i,s]),c=gy(l,2),d=c[0],f=c[1];if(d===-1/0||f===1/0)return[i,s];if(d===f)return[d];var m=a==="snap125"?Y4:QP,y=Math.max(n,2),x=m(new Tn(f).sub(d).div(y-1),o,0),S=[...q4(new Tn(d),new Tn(f),x),f];return o===!1&&(S=S.map(_=>Math.round(_))),i>s?S.reverse():S},ZJ=t=>t.rootProps.barCategoryGap,bS=t=>t.rootProps.stackOffset,Q4=t=>t.rootProps.reverseStackOrder,JP=t=>t.options.chartName,eR=t=>t.rootProps.syncId,J4=t=>t.rootProps.syncMethod,tR=t=>t.options.eventEmitter,QJ=t=>t.rootProps.baseValue,Ms={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},wf={allowDecimals:!1,allowDataOverflow:!1,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"auto"},hl={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,includeHidden:!1,radiusAxisId:0,reversed:!1,scale:"auto",tick:!0,tickCount:5,type:"auto"},_S=(t,e)=>{if(!(!t||!e))return t!=null&&t.reversed?[e[1],e[0]]:e};function wS(t,e,n){if(n!=="auto")return n;if(t!=null)return Fl(t,e)?"category":"number"}function wO(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Aw(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?wO(Object(n),!0).forEach(function(r){JJ(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):wO(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function JJ(t,e,n){return(e=eee(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function eee(t){var e=tee(t,"string");return typeof e=="symbol"?e:e+""}function tee(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var SO={allowDataOverflow:wf.allowDataOverflow,allowDecimals:wf.allowDecimals,allowDuplicatedCategory:!1,dataKey:void 0,domain:void 0,id:wf.angleAxisId,includeHidden:!1,name:void 0,reversed:wf.reversed,scale:wf.scale,tick:wf.tick,tickCount:void 0,ticks:void 0,type:wf.type,unit:void 0,niceTicks:"auto"},MO={allowDataOverflow:hl.allowDataOverflow,allowDecimals:hl.allowDecimals,allowDuplicatedCategory:hl.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:hl.radiusAxisId,includeHidden:hl.includeHidden,name:void 0,reversed:hl.reversed,scale:hl.scale,tick:hl.tick,tickCount:hl.tickCount,ticks:void 0,type:hl.type,unit:void 0,niceTicks:"auto"},nee=(t,e)=>{if(e!=null)return t.polarAxis.angleAxis[e]},nR=Oe([nee,S4],(t,e)=>{var n;if(t!=null)return t;var r=(n=wS(e,"angleAxis",SO.type))!==null&&n!==void 0?n:"category";return Aw(Aw({},SO),{},{type:r})}),ree=(t,e)=>t.polarAxis.radiusAxis[e],rR=Oe([ree,S4],(t,e)=>{var n;if(t!=null)return t;var r=(n=wS(e,"radiusAxis",MO.type))!==null&&n!==void 0?n:"category";return Aw(Aw({},MO),{},{type:r})}),SS=t=>t.polarOptions,iR=Oe([tu,nu,Gi],SJ),ez=Oe([SS,iR],(t,e)=>{if(t!=null)return Ad(t.innerRadius,e,0)}),tz=Oe([SS,iR],(t,e)=>{if(t!=null)return Ad(t.outerRadius,e,e*.8)}),iee=t=>{if(t==null)return[0,0];var e=t.startAngle,n=t.endAngle;return[e,n]},nz=Oe([SS],iee);Oe([nR,nz],_S);var rz=Oe([iR,ez,tz],(t,e,n)=>{if(!(t==null||e==null||n==null))return[e,n]});Oe([rR,rz],_S);var iz=Oe([fr,SS,ez,tz,tu,nu],(t,e,n,r,i,s)=>{if(!(t!=="centric"&&t!=="radial"||e==null||n==null||r==null)){var o=e.cx,a=e.cy,l=e.startAngle,c=e.endAngle;return{cx:Ad(o,i,i/2),cy:Ad(a,s,s/2),innerRadius:n,outerRadius:r,startAngle:l,endAngle:c,clockWise:!1}}}),bi=(t,e)=>e,MS=(t,e,n)=>n;function sR(t){return t==null?void 0:t.id}function sz(t,e,n){var r=e.chartData,i=r===void 0?[]:r,s=n.allowDuplicatedCategory,o=n.dataKey,a=new Map;return t.forEach(l=>{var c,d=(c=l.data)!==null&&c!==void 0?c:i;if(!(d==null||d.length===0)){var f=sR(l);d.forEach((m,y)=>{var x=o==null||s?y:String(yi(m,o,null)),S=yi(m,l.dataKey,0),_;a.has(x)?_=a.get(x):_={},Object.assign(_,{[f]:S}),a.set(x,_)})}}),Array.from(a.values())}function oR(t){return"stackId"in t&&t.stackId!=null&&t.dataKey!=null}var ES=(t,e)=>t===e?!0:t==null||e==null?!1:t[0]===e[0]&&t[1]===e[1];function AS(t,e){return Array.isArray(t)&&Array.isArray(e)&&t.length===0&&e.length===0?!0:t===e}function see(t,e){if(t.length===e.length){for(var n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}return!1}var _i=t=>{var e=fr(t);return e==="horizontal"?"xAxis":e==="vertical"?"yAxis":e==="centric"?"angleAxis":"radiusAxis"},Gg=t=>t.tooltip.settings.axisId;function aR(t){if(t!=null){var e=t.ticks,n=t.bandwidth,r=t.range(),i=[Math.min(...r),Math.max(...r)];return{domain:()=>t.domain(),range:(function(s){function o(){return s.apply(this,arguments)}return o.toString=function(){return s.toString()},o})(()=>i),rangeMin:()=>i[0],rangeMax:()=>i[1],isInRange(s){var o=i[0],a=i[1];return o<=a?s>=o&&s<=a:s>=a&&s<=o},bandwidth:n?()=>n.call(t):void 0,ticks:e?s=>e.call(t,s):void 0,map:(s,o)=>{var a=t(s);if(a!=null){if(t.bandwidth&&o!==null&&o!==void 0&&o.position){var l=t.bandwidth();switch(o.position){case"middle":a+=l/2;break;case"end":a+=l;break}}return a}}}}}var oee=(t,e)=>{if(e!=null)switch(t){case"linear":{if(!Al(e)){for(var n,r,i=0;i<e.length;i++){var s=e[i];wn(s)&&((n===void 0||s<n)&&(n=s),(r===void 0||s>r)&&(r=s))}return n!==void 0&&r!==void 0?[n,r]:void 0}return e}default:return e}};function wd(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function aee(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function lR(t){let e,n,r;t.length!==2?(e=wd,n=(a,l)=>wd(t(a),l),r=(a,l)=>t(a)-l):(e=t===wd||t===aee?t:lee,n=t,r=t);function i(a,l,c=0,d=a.length){if(c<d){if(e(l,l)!==0)return d;do{const f=c+d>>>1;n(a[f],l)<0?c=f+1:d=f}while(c<d)}return c}function s(a,l,c=0,d=a.length){if(c<d){if(e(l,l)!==0)return d;do{const f=c+d>>>1;n(a[f],l)<=0?c=f+1:d=f}while(c<d)}return c}function o(a,l,c=0,d=a.length){const f=i(a,l,c,d-1);return f>c&&r(a[f-1],l)>-r(a[f],l)?f-1:f}return{left:i,center:o,right:s}}function lee(){return 0}function oz(t){return t===null?NaN:+t}function*cee(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const uee=lR(wd),Zy=uee.right;lR(oz).center;class EO extends Map{constructor(e,n=hee){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(const[r,i]of e)this.set(r,i)}get(e){return super.get(AO(this,e))}has(e){return super.has(AO(this,e))}set(e,n){return super.set(dee(this,e),n)}delete(e){return super.delete(fee(this,e))}}function AO({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function dee({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function fee({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function hee(t){return t!==null&&typeof t=="object"?t.valueOf():t}function pee(t=wd){if(t===wd)return az;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,n)=>{const r=t(e,n);return r||r===0?r:(t(n,n)===0)-(t(e,e)===0)}}function az(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(t<e?-1:t>e?1:0)}const mee=Math.sqrt(50),gee=Math.sqrt(10),vee=Math.sqrt(2);function Tw(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),s=r/Math.pow(10,i),o=s>=mee?10:s>=gee?5:s>=vee?2:1;let a,l,c;return i<0?(c=Math.pow(10,-i)/o,a=Math.round(t*c),l=Math.round(e*c),a/c<t&&++a,l/c>e&&--l,c=-c):(c=Math.pow(10,i)*o,a=Math.round(t/c),l=Math.round(e/c),a*c<t&&++a,l*c>e&&--l),l<a&&.5<=n&&n<2?Tw(t,e,n*2):[a,l,c]}function xC(t,e,n){if(e=+e,t=+t,n=+n,!(n>0))return[];if(t===e)return[t];const r=e<t,[i,s,o]=r?Tw(e,t,n):Tw(t,e,n);if(!(s>=i))return[];const a=s-i+1,l=new Array(a);if(r)if(o<0)for(let c=0;c<a;++c)l[c]=(s-c)/-o;else for(let c=0;c<a;++c)l[c]=(s-c)*o;else if(o<0)for(let c=0;c<a;++c)l[c]=(i+c)/-o;else for(let c=0;c<a;++c)l[c]=(i+c)*o;return l}function bC(t,e,n){return e=+e,t=+t,n=+n,Tw(t,e,n)[2]}function _C(t,e,n){e=+e,t=+t,n=+n;const r=e<t,i=r?bC(e,t,n):bC(t,e,n);return(r?-1:1)*(i<0?1/-i:i)}function TO(t,e){let n;for(const r of t)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);return n}function CO(t,e){let n;for(const r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function lz(t,e,n=0,r=1/0,i){if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(t.length-1,r)),!(n<=e&&e<=r))return t;for(i=i===void 0?az:pee(i);r>n;){if(r-n>600){const l=r-n+1,c=e-n+1,d=Math.log(l),f=.5*Math.exp(2*d/3),m=.5*Math.sqrt(d*f*(l-f)/l)*(c-l/2<0?-1:1),y=Math.max(n,Math.floor(e-c*f/l+m)),x=Math.min(r,Math.floor(e+(l-c)*f/l+m));lz(t,e,y,x,i)}const s=t[e];let o=n,a=r;for(a0(t,n,e),i(t[r],s)>0&&a0(t,n,r);o<a;){for(a0(t,o,a),++o,--a;i(t[o],s)<0;)++o;for(;i(t[a],s)>0;)--a}i(t[n],s)===0?a0(t,n,a):(++a,a0(t,a,r)),a<=e&&(n=a+1),e<=a&&(r=a-1)}return t}function a0(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function yee(t,e,n){if(t=Float64Array.from(cee(t)),!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return CO(t);if(e>=1)return TO(t);var r,i=(r-1)*e,s=Math.floor(i),o=TO(lz(t,s).subarray(0,s+1)),a=CO(t.subarray(s+1));return o+(a-o)*(i-s)}}function xee(t,e,n=oz){if(!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,i=(r-1)*e,s=Math.floor(i),o=+n(t[s],s,t),a=+n(t[s+1],s+1,t);return o+(a-o)*(i-s)}}function bee(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((e-t)/n))|0,s=new Array(i);++r<i;)s[r]=t+r*n;return s}function ea(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function ru(t,e){switch(arguments.length){case 0:break;case 1:{typeof t=="function"?this.interpolator(t):this.range(t);break}default:{this.domain(t),typeof e=="function"?this.interpolator(e):this.range(e);break}}return this}const wC=Symbol("implicit");function cR(){var t=new EO,e=[],n=[],r=wC;function i(s){let o=t.get(s);if(o===void 0){if(r!==wC)return r;t.set(s,o=e.push(s)-1)}return n[o%n.length]}return i.domain=function(s){if(!arguments.length)return e.slice();e=[],t=new EO;for(const o of s)t.has(o)||t.set(o,e.push(o)-1);return i},i.range=function(s){return arguments.length?(n=Array.from(s),i):n.slice()},i.unknown=function(s){return arguments.length?(r=s,i):r},i.copy=function(){return cR(e,n).unknown(r)},ea.apply(i,arguments),i}function uR(){var t=cR().unknown(void 0),e=t.domain,n=t.range,r=0,i=1,s,o,a=!1,l=0,c=0,d=.5;delete t.unknown;function f(){var m=e().length,y=i<r,x=y?i:r,S=y?r:i;s=(S-x)/Math.max(1,m-l+c*2),a&&(s=Math.floor(s)),x+=(S-x-s*(m-l))*d,o=s*(1-l),a&&(x=Math.round(x),o=Math.round(o));var _=bee(m).map(function(w){return x+s*w});return n(y?_.reverse():_)}return t.domain=function(m){return arguments.length?(e(m),f()):e()},t.range=function(m){return arguments.length?([r,i]=m,r=+r,i=+i,f()):[r,i]},t.rangeRound=function(m){return[r,i]=m,r=+r,i=+i,a=!0,f()},t.bandwidth=function(){return o},t.step=function(){return s},t.round=function(m){return arguments.length?(a=!!m,f()):a},t.padding=function(m){return arguments.length?(l=Math.min(1,c=+m),f()):l},t.paddingInner=function(m){return arguments.length?(l=Math.min(1,m),f()):l},t.paddingOuter=function(m){return arguments.length?(c=+m,f()):c},t.align=function(m){return arguments.length?(d=Math.max(0,Math.min(1,m)),f()):d},t.copy=function(){return uR(e(),[r,i]).round(a).paddingInner(l).paddingOuter(c).align(d)},ea.apply(f(),arguments)}function cz(t){var e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return cz(e())},t}function _ee(){return cz(uR.apply(null,arguments).paddingInner(1))}function dR(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function uz(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function Qy(){}var vy=.7,Cw=1/vy,Jm="\\s*([+-]?\\d+)\\s*",yy="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Tl="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",wee=/^#([0-9a-f]{3,8})$/,See=new RegExp(`^rgb\\(${Jm},${Jm},${Jm}\\)$`),Mee=new RegExp(`^rgb\\(${Tl},${Tl},${Tl}\\)$`),Eee=new RegExp(`^rgba\\(${Jm},${Jm},${Jm},${yy}\\)$`),Aee=new RegExp(`^rgba\\(${Tl},${Tl},${Tl},${yy}\\)$`),Tee=new RegExp(`^hsl\\(${yy},${Tl},${Tl}\\)$`),Cee=new RegExp(`^hsla\\(${yy},${Tl},${Tl},${yy}\\)$`),PO={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};dR(Qy,xy,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:RO,formatHex:RO,formatHex8:Pee,formatHsl:Ree,formatRgb:NO,toString:NO});function RO(){return this.rgb().formatHex()}function Pee(){return this.rgb().formatHex8()}function Ree(){return dz(this).formatHsl()}function NO(){return this.rgb().formatRgb()}function xy(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=wee.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?IO(e):n===3?new Ys(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Cb(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Cb(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=See.exec(t))?new Ys(e[1],e[2],e[3],1):(e=Mee.exec(t))?new Ys(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Eee.exec(t))?Cb(e[1],e[2],e[3],e[4]):(e=Aee.exec(t))?Cb(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=Tee.exec(t))?LO(e[1],e[2]/100,e[3]/100,1):(e=Cee.exec(t))?LO(e[1],e[2]/100,e[3]/100,e[4]):PO.hasOwnProperty(t)?IO(PO[t]):t==="transparent"?new Ys(NaN,NaN,NaN,0):null}function IO(t){return new Ys(t>>16&255,t>>8&255,t&255,1)}function Cb(t,e,n,r){return r<=0&&(t=e=n=NaN),new Ys(t,e,n,r)}function Nee(t){return t instanceof Qy||(t=xy(t)),t?(t=t.rgb(),new Ys(t.r,t.g,t.b,t.opacity)):new Ys}function SC(t,e,n,r){return arguments.length===1?Nee(t):new Ys(t,e,n,r??1)}function Ys(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}dR(Ys,SC,uz(Qy,{brighter(t){return t=t==null?Cw:Math.pow(Cw,t),new Ys(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?vy:Math.pow(vy,t),new Ys(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Ys(wh(this.r),wh(this.g),wh(this.b),Pw(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:kO,formatHex:kO,formatHex8:Iee,formatRgb:OO,toString:OO}));function kO(){return`#${th(this.r)}${th(this.g)}${th(this.b)}`}function Iee(){return`#${th(this.r)}${th(this.g)}${th(this.b)}${th((isNaN(this.opacity)?1:this.opacity)*255)}`}function OO(){const t=Pw(this.opacity);return`${t===1?"rgb(":"rgba("}${wh(this.r)}, ${wh(this.g)}, ${wh(this.b)}${t===1?")":`, ${t})`}`}function Pw(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function wh(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function th(t){return t=wh(t),(t<16?"0":"")+t.toString(16)}function LO(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Fa(t,e,n,r)}function dz(t){if(t instanceof Fa)return new Fa(t.h,t.s,t.l,t.opacity);if(t instanceof Qy||(t=xy(t)),!t)return new Fa;if(t instanceof Fa)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),s=Math.max(e,n,r),o=NaN,a=s-i,l=(s+i)/2;return a?(e===s?o=(n-r)/a+(n<r)*6:n===s?o=(r-e)/a+2:o=(e-n)/a+4,a/=l<.5?s+i:2-s-i,o*=60):a=l>0&&l<1?0:o,new Fa(o,a,l,t.opacity)}function kee(t,e,n,r){return arguments.length===1?dz(t):new Fa(t,e,n,r??1)}function Fa(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}dR(Fa,kee,uz(Qy,{brighter(t){return t=t==null?Cw:Math.pow(Cw,t),new Fa(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?vy:Math.pow(vy,t),new Fa(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new Ys(RE(t>=240?t-240:t+120,i,r),RE(t,i,r),RE(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Fa(DO(this.h),Pb(this.s),Pb(this.l),Pw(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Pw(this.opacity);return`${t===1?"hsl(":"hsla("}${DO(this.h)}, ${Pb(this.s)*100}%, ${Pb(this.l)*100}%${t===1?")":`, ${t})`}`}}));function DO(t){return t=(t||0)%360,t<0?t+360:t}function Pb(t){return Math.max(0,Math.min(1,t||0))}function RE(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const fR=t=>()=>t;function Oee(t,e){return function(n){return t+n*e}}function Lee(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function Dee(t){return(t=+t)==1?fz:function(e,n){return n-e?Lee(e,n,t):fR(isNaN(e)?n:e)}}function fz(t,e){var n=e-t;return n?Oee(t,n):fR(isNaN(t)?e:t)}const UO=(function t(e){var n=Dee(e);function r(i,s){var o=n((i=SC(i)).r,(s=SC(s)).r),a=n(i.g,s.g),l=n(i.b,s.b),c=fz(i.opacity,s.opacity);return function(d){return i.r=o(d),i.g=a(d),i.b=l(d),i.opacity=c(d),i+""}}return r.gamma=t,r})(1);function Uee(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),i;return function(s){for(i=0;i<n;++i)r[i]=t[i]*(1-s)+e[i]*s;return r}}function jee(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Fee(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0,i=new Array(r),s=new Array(n),o;for(o=0;o<r;++o)i[o]=Wg(t[o],e[o]);for(;o<n;++o)s[o]=e[o];return function(a){for(o=0;o<r;++o)s[o]=i[o](a);return s}}function zee(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function Rw(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function Bee(t,e){var n={},r={},i;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(i in e)i in t?n[i]=Wg(t[i],e[i]):r[i]=e[i];return function(s){for(i in n)r[i]=n[i](s);return r}}var MC=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,NE=new RegExp(MC.source,"g");function Hee(t){return function(){return t}}function Vee(t){return function(e){return t(e)+""}}function Gee(t,e){var n=MC.lastIndex=NE.lastIndex=0,r,i,s,o=-1,a=[],l=[];for(t=t+"",e=e+"";(r=MC.exec(t))&&(i=NE.exec(e));)(s=i.index)>n&&(s=e.slice(n,s),a[o]?a[o]+=s:a[++o]=s),(r=r[0])===(i=i[0])?a[o]?a[o]+=i:a[++o]=i:(a[++o]=null,l.push({i:o,x:Rw(r,i)})),n=NE.lastIndex;return n<e.length&&(s=e.slice(n),a[o]?a[o]+=s:a[++o]=s),a.length<2?l[0]?Vee(l[0].x):Hee(e):(e=l.length,function(c){for(var d=0,f;d<e;++d)a[(f=l[d]).i]=f.x(c);return a.join("")})}function Wg(t,e){var n=typeof e,r;return e==null||n==="boolean"?fR(e):(n==="number"?Rw:n==="string"?(r=xy(e))?(e=r,UO):Gee:e instanceof xy?UO:e instanceof Date?zee:jee(e)?Uee:Array.isArray(e)?Fee:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?Bee:Rw)(t,e)}function hR(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}function Wee(t,e){e===void 0&&(e=t,t=Wg);for(var n=0,r=e.length-1,i=e[0],s=new Array(r<0?0:r);n<r;)s[n]=t(i,i=e[++n]);return function(o){var a=Math.max(0,Math.min(r-1,Math.floor(o*=r)));return s[a](o-a)}}function $ee(t){return function(){return t}}function Nw(t){return+t}var jO=[0,1];function Es(t){return t}function EC(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:$ee(isNaN(e)?NaN:.5)}function Xee(t,e){var n;return t>e&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function qee(t,e,n){var r=t[0],i=t[1],s=e[0],o=e[1];return i<r?(r=EC(i,r),s=n(o,s)):(r=EC(r,i),s=n(s,o)),function(a){return s(r(a))}}function Kee(t,e,n){var r=Math.min(t.length,e.length)-1,i=new Array(r),s=new Array(r),o=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++o<r;)i[o]=EC(t[o],t[o+1]),s[o]=n(e[o],e[o+1]);return function(a){var l=Zy(t,a,1,r)-1;return s[l](i[l](a))}}function Jy(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function TS(){var t=jO,e=jO,n=Wg,r,i,s,o=Es,a,l,c;function d(){var m=Math.min(t.length,e.length);return o!==Es&&(o=Xee(t[0],t[m-1])),a=m>2?Kee:qee,l=c=null,f}function f(m){return m==null||isNaN(m=+m)?s:(l||(l=a(t.map(r),e,n)))(r(o(m)))}return f.invert=function(m){return o(i((c||(c=a(e,t.map(r),Rw)))(m)))},f.domain=function(m){return arguments.length?(t=Array.from(m,Nw),d()):t.slice()},f.range=function(m){return arguments.length?(e=Array.from(m),d()):e.slice()},f.rangeRound=function(m){return e=Array.from(m),n=hR,d()},f.clamp=function(m){return arguments.length?(o=m?!0:Es,d()):o!==Es},f.interpolate=function(m){return arguments.length?(n=m,d()):n},f.unknown=function(m){return arguments.length?(s=m,f):s},function(m,y){return r=m,i=y,d()}}function pR(){return TS()(Es,Es)}function Yee(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function Iw(t,e){if(!isFinite(t)||t===0)return null;var n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"),r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Mg(t){return t=Iw(Math.abs(t)),t?t[1]:NaN}function Zee(t,e){return function(n,r){for(var i=n.length,s=[],o=0,a=t[0],l=0;i>0&&a>0&&(l+a+1>r&&(a=Math.max(1,r-l)),s.push(n.substring(i-=a,i+a)),!((l+=a+1)>r));)a=t[o=(o+1)%t.length];return s.reverse().join(e)}}function Qee(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var Jee=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function by(t){if(!(e=Jee.exec(t)))throw new Error("invalid format: "+t);var e;return new mR({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}by.prototype=mR.prototype;function mR(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}mR.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function ete(t){e:for(var e=t.length,n=1,r=-1,i;n<e;++n)switch(t[n]){case".":r=i=n;break;case"0":r===0&&(r=n),i=n;break;default:if(!+t[n])break e;r>0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(i+1):t}var kw;function tte(t,e){var n=Iw(t,e);if(!n)return kw=void 0,t.toPrecision(e);var r=n[0],i=n[1],s=i-(kw=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return s===o?r:s>o?r+new Array(s-o+1).join("0"):s>0?r.slice(0,s)+"."+r.slice(s):"0."+new Array(1-s).join("0")+Iw(t,Math.max(0,e+s-1))[0]}function FO(t,e){var n=Iw(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const zO={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:Yee,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>FO(t*100,e),r:FO,s:tte,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function BO(t){return t}var HO=Array.prototype.map,VO=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function nte(t){var e=t.grouping===void 0||t.thousands===void 0?BO:Zee(HO.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",s=t.numerals===void 0?BO:Qee(HO.call(t.numerals,String)),o=t.percent===void 0?"%":t.percent+"",a=t.minus===void 0?"−":t.minus+"",l=t.nan===void 0?"NaN":t.nan+"";function c(f,m){f=by(f);var y=f.fill,x=f.align,S=f.sign,_=f.symbol,w=f.zero,A=f.width,T=f.comma,C=f.precision,O=f.trim,N=f.type;N==="n"?(T=!0,N="g"):zO[N]||(C===void 0&&(C=12),O=!0,N="g"),(w||y==="0"&&x==="=")&&(w=!0,y="0",x="=");var D=(m&&m.prefix!==void 0?m.prefix:"")+(_==="$"?n:_==="#"&&/[boxX]/.test(N)?"0"+N.toLowerCase():""),F=(_==="$"?r:/[%p]/.test(N)?o:"")+(m&&m.suffix!==void 0?m.suffix:""),V=zO[N],k=/[defgprs%]/.test(N);C=C===void 0?6:/[gprs]/.test(N)?Math.max(1,Math.min(21,C)):Math.max(0,Math.min(20,C));function j(H){var ne=D,te=F,pe,oe,ce;if(N==="c")te=V(H)+te,H="";else{H=+H;var B=H<0||1/H<0;if(H=isNaN(H)?l:V(Math.abs(H),C),O&&(H=ete(H)),B&&+H==0&&S!=="+"&&(B=!1),ne=(B?S==="("?S:a:S==="-"||S==="("?"":S)+ne,te=(N==="s"&&!isNaN(H)&&kw!==void 0?VO[8+kw/3]:"")+te+(B&&S==="("?")":""),k){for(pe=-1,oe=H.length;++pe<oe;)if(ce=H.charCodeAt(pe),48>ce||ce>57){te=(ce===46?i+H.slice(pe+1):H.slice(pe))+te,H=H.slice(0,pe);break}}}T&&!w&&(H=e(H,1/0));var K=ne.length+H.length+te.length,q=K<A?new Array(A-K+1).join(y):"";switch(T&&w&&(H=e(q+H,q.length?A-te.length:1/0),q=""),x){case"<":H=ne+H+te+q;break;case"=":H=ne+q+H+te;break;case"^":H=q.slice(0,K=q.length>>1)+ne+H+te+q.slice(K);break;default:H=q+ne+H+te;break}return s(H)}return j.toString=function(){return f+""},j}function d(f,m){var y=Math.max(-8,Math.min(8,Math.floor(Mg(m)/3)))*3,x=Math.pow(10,-y),S=c((f=by(f),f.type="f",f),{suffix:VO[8+y/3]});return function(_){return S(x*_)}}return{format:c,formatPrefix:d}}var Rb,gR,hz;rte({thousands:",",grouping:[3],currency:["$",""]});function rte(t){return Rb=nte(t),gR=Rb.format,hz=Rb.formatPrefix,Rb}function ite(t){return Math.max(0,-Mg(Math.abs(t)))}function ste(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Mg(e)/3)))*3-Mg(Math.abs(t)))}function ote(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Mg(e)-Mg(t))+1}function pz(t,e,n,r){var i=_C(t,e,n),s;switch(r=by(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(s=ste(i,o))&&(r.precision=s),hz(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(s=ote(i,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=s-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(s=ite(i))&&(r.precision=s-(r.type==="%")*2);break}}return gR(r)}function Rd(t){var e=t.domain;return t.ticks=function(n){var r=e();return xC(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var i=e();return pz(i[0],i[i.length-1],n??10,r)},t.nice=function(n){n==null&&(n=10);var r=e(),i=0,s=r.length-1,o=r[i],a=r[s],l,c,d=10;for(a<o&&(c=o,o=a,a=c,c=i,i=s,s=c);d-- >0;){if(c=bC(o,a,n),c===l)return r[i]=o,r[s]=a,e(r);if(c>0)o=Math.floor(o/c)*c,a=Math.ceil(a/c)*c;else if(c<0)o=Math.ceil(o*c)/c,a=Math.floor(a*c)/c;else break;l=c}return t},t}function mz(){var t=pR();return t.copy=function(){return Jy(t,mz())},ea.apply(t,arguments),Rd(t)}function gz(t){var e;function n(r){return r==null||isNaN(r=+r)?e:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(t=Array.from(r,Nw),n):t.slice()},n.unknown=function(r){return arguments.length?(e=r,n):e},n.copy=function(){return gz(t).unknown(e)},t=arguments.length?Array.from(t,Nw):[0,1],Rd(n)}function vz(t,e){t=t.slice();var n=0,r=t.length-1,i=t[n],s=t[r],o;return s<i&&(o=n,n=r,r=o,o=i,i=s,s=o),t[n]=e.floor(i),t[r]=e.ceil(s),t}function GO(t){return Math.log(t)}function WO(t){return Math.exp(t)}function ate(t){return-Math.log(-t)}function lte(t){return-Math.exp(-t)}function cte(t){return isFinite(t)?+("1e"+t):t<0?0:t}function ute(t){return t===10?cte:t===Math.E?Math.exp:e=>Math.pow(t,e)}function dte(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function $O(t){return(e,n)=>-t(-e,n)}function vR(t){const e=t(GO,WO),n=e.domain;let r=10,i,s;function o(){return i=dte(r),s=ute(r),n()[0]<0?(i=$O(i),s=$O(s),t(ate,lte)):t(GO,WO),e}return e.base=function(a){return arguments.length?(r=+a,o()):r},e.domain=function(a){return arguments.length?(n(a),o()):n()},e.ticks=a=>{const l=n();let c=l[0],d=l[l.length-1];const f=d<c;f&&([c,d]=[d,c]);let m=i(c),y=i(d),x,S;const _=a==null?10:+a;let w=[];if(!(r%1)&&y-m<_){if(m=Math.floor(m),y=Math.ceil(y),c>0){for(;m<=y;++m)for(x=1;x<r;++x)if(S=m<0?x/s(-m):x*s(m),!(S<c)){if(S>d)break;w.push(S)}}else for(;m<=y;++m)for(x=r-1;x>=1;--x)if(S=m>0?x/s(-m):x*s(m),!(S<c)){if(S>d)break;w.push(S)}w.length*2<_&&(w=xC(c,d,_))}else w=xC(m,y,Math.min(y-m,_)).map(s);return f?w.reverse():w},e.tickFormat=(a,l)=>{if(a==null&&(a=10),l==null&&(l=r===10?"s":","),typeof l!="function"&&(!(r%1)&&(l=by(l)).precision==null&&(l.trim=!0),l=gR(l)),a===1/0)return l;const c=Math.max(1,r*a/e.ticks().length);return d=>{let f=d/s(Math.round(i(d)));return f*r<r-.5&&(f*=r),f<=c?l(d):""}},e.nice=()=>n(vz(n(),{floor:a=>s(Math.floor(i(a))),ceil:a=>s(Math.ceil(i(a)))})),e}function yz(){const t=vR(TS()).domain([1,10]);return t.copy=()=>Jy(t,yz()).base(t.base()),ea.apply(t,arguments),t}function XO(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function qO(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function yR(t){var e=1,n=t(XO(e),qO(e));return n.constant=function(r){return arguments.length?t(XO(e=+r),qO(e)):e},Rd(n)}function xz(){var t=yR(TS());return t.copy=function(){return Jy(t,xz()).constant(t.constant())},ea.apply(t,arguments)}function KO(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function fte(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function hte(t){return t<0?-t*t:t*t}function xR(t){var e=t(Es,Es),n=1;function r(){return n===1?t(Es,Es):n===.5?t(fte,hte):t(KO(n),KO(1/n))}return e.exponent=function(i){return arguments.length?(n=+i,r()):n},Rd(e)}function bR(){var t=xR(TS());return t.copy=function(){return Jy(t,bR()).exponent(t.exponent())},ea.apply(t,arguments),t}function pte(){return bR.apply(null,arguments).exponent(.5)}function YO(t){return Math.sign(t)*t*t}function mte(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function bz(){var t=pR(),e=[0,1],n=!1,r;function i(s){var o=mte(t(s));return isNaN(o)?r:n?Math.round(o):o}return i.invert=function(s){return t.invert(YO(s))},i.domain=function(s){return arguments.length?(t.domain(s),i):t.domain()},i.range=function(s){return arguments.length?(t.range((e=Array.from(s,Nw)).map(YO)),i):e.slice()},i.rangeRound=function(s){return i.range(s).round(!0)},i.round=function(s){return arguments.length?(n=!!s,i):n},i.clamp=function(s){return arguments.length?(t.clamp(s),i):t.clamp()},i.unknown=function(s){return arguments.length?(r=s,i):r},i.copy=function(){return bz(t.domain(),e).round(n).clamp(t.clamp()).unknown(r)},ea.apply(i,arguments),Rd(i)}function _z(){var t=[],e=[],n=[],r;function i(){var o=0,a=Math.max(1,e.length);for(n=new Array(a-1);++o<a;)n[o-1]=xee(t,o/a);return s}function s(o){return o==null||isNaN(o=+o)?r:e[Zy(n,o)]}return s.invertExtent=function(o){var a=e.indexOf(o);return a<0?[NaN,NaN]:[a>0?n[a-1]:t[0],a<n.length?n[a]:t[t.length-1]]},s.domain=function(o){if(!arguments.length)return t.slice();t=[];for(let a of o)a!=null&&!isNaN(a=+a)&&t.push(a);return t.sort(wd),i()},s.range=function(o){return arguments.length?(e=Array.from(o),i()):e.slice()},s.unknown=function(o){return arguments.length?(r=o,s):r},s.quantiles=function(){return n.slice()},s.copy=function(){return _z().domain(t).range(e).unknown(r)},ea.apply(s,arguments)}function wz(){var t=0,e=1,n=1,r=[.5],i=[0,1],s;function o(l){return l!=null&&l<=l?i[Zy(r,l,0,n)]:s}function a(){var l=-1;for(r=new Array(n);++l<n;)r[l]=((l+1)*e-(l-n)*t)/(n+1);return o}return o.domain=function(l){return arguments.length?([t,e]=l,t=+t,e=+e,a()):[t,e]},o.range=function(l){return arguments.length?(n=(i=Array.from(l)).length-1,a()):i.slice()},o.invertExtent=function(l){var c=i.indexOf(l);return c<0?[NaN,NaN]:c<1?[t,r[0]]:c>=n?[r[n-1],e]:[r[c-1],r[c]]},o.unknown=function(l){return arguments.length&&(s=l),o},o.thresholds=function(){return r.slice()},o.copy=function(){return wz().domain([t,e]).range(i).unknown(s)},ea.apply(Rd(o),arguments)}function Sz(){var t=[.5],e=[0,1],n,r=1;function i(s){return s!=null&&s<=s?e[Zy(t,s,0,r)]:n}return i.domain=function(s){return arguments.length?(t=Array.from(s),r=Math.min(t.length,e.length-1),i):t.slice()},i.range=function(s){return arguments.length?(e=Array.from(s),r=Math.min(t.length,e.length-1),i):e.slice()},i.invertExtent=function(s){var o=e.indexOf(s);return[t[o-1],t[o]]},i.unknown=function(s){return arguments.length?(n=s,i):n},i.copy=function(){return Sz().domain(t).range(e).unknown(n)},ea.apply(i,arguments)}const IE=new Date,kE=new Date;function oi(t,e,n,r){function i(s){return t(s=arguments.length===0?new Date:new Date(+s)),s}return i.floor=s=>(t(s=new Date(+s)),s),i.ceil=s=>(t(s=new Date(s-1)),e(s,1),t(s),s),i.round=s=>{const o=i(s),a=i.ceil(s);return s-o<a-s?o:a},i.offset=(s,o)=>(e(s=new Date(+s),o==null?1:Math.floor(o)),s),i.range=(s,o,a)=>{const l=[];if(s=i.ceil(s),a=a==null?1:Math.floor(a),!(s<o)||!(a>0))return l;let c;do l.push(c=new Date(+s)),e(s,a),t(s);while(c<s&&s<o);return l},i.filter=s=>oi(o=>{if(o>=o)for(;t(o),!s(o);)o.setTime(o-1)},(o,a)=>{if(o>=o)if(a<0)for(;++a<=0;)for(;e(o,-1),!s(o););else for(;--a>=0;)for(;e(o,1),!s(o););}),n&&(i.count=(s,o)=>(IE.setTime(+s),kE.setTime(+o),t(IE),t(kE),Math.floor(n(IE,kE))),i.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?i.filter(r?o=>r(o)%s===0:o=>i.count(0,o)%s===0):i)),i}const Ow=oi(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Ow.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?oi(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):Ow);Ow.range;const jc=1e3,Xo=jc*60,Fc=Xo*60,Yc=Fc*24,_R=Yc*7,ZO=Yc*30,OE=Yc*365,nh=oi(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*jc)},(t,e)=>(e-t)/jc,t=>t.getUTCSeconds());nh.range;const wR=oi(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*jc)},(t,e)=>{t.setTime(+t+e*Xo)},(t,e)=>(e-t)/Xo,t=>t.getMinutes());wR.range;const SR=oi(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*Xo)},(t,e)=>(e-t)/Xo,t=>t.getUTCMinutes());SR.range;const MR=oi(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*jc-t.getMinutes()*Xo)},(t,e)=>{t.setTime(+t+e*Fc)},(t,e)=>(e-t)/Fc,t=>t.getHours());MR.range;const ER=oi(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*Fc)},(t,e)=>(e-t)/Fc,t=>t.getUTCHours());ER.range;const ex=oi(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Xo)/Yc,t=>t.getDate()-1);ex.range;const CS=oi(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Yc,t=>t.getUTCDate()-1);CS.range;const Mz=oi(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Yc,t=>Math.floor(t/Yc));Mz.range;function Yh(t){return oi(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*Xo)/_R)}const PS=Yh(0),Lw=Yh(1),gte=Yh(2),vte=Yh(3),Eg=Yh(4),yte=Yh(5),xte=Yh(6);PS.range;Lw.range;gte.range;vte.range;Eg.range;yte.range;xte.range;function Zh(t){return oi(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/_R)}const RS=Zh(0),Dw=Zh(1),bte=Zh(2),_te=Zh(3),Ag=Zh(4),wte=Zh(5),Ste=Zh(6);RS.range;Dw.range;bte.range;_te.range;Ag.range;wte.range;Ste.range;const AR=oi(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());AR.range;const TR=oi(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());TR.range;const Zc=oi(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());Zc.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:oi(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});Zc.range;const Qc=oi(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());Qc.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:oi(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});Qc.range;function Ez(t,e,n,r,i,s){const o=[[nh,1,jc],[nh,5,5*jc],[nh,15,15*jc],[nh,30,30*jc],[s,1,Xo],[s,5,5*Xo],[s,15,15*Xo],[s,30,30*Xo],[i,1,Fc],[i,3,3*Fc],[i,6,6*Fc],[i,12,12*Fc],[r,1,Yc],[r,2,2*Yc],[n,1,_R],[e,1,ZO],[e,3,3*ZO],[t,1,OE]];function a(c,d,f){const m=d<c;m&&([c,d]=[d,c]);const y=f&&typeof f.range=="function"?f:l(c,d,f),x=y?y.range(c,+d+1):[];return m?x.reverse():x}function l(c,d,f){const m=Math.abs(d-c)/f,y=lR(([,,_])=>_).right(o,m);if(y===o.length)return t.every(_C(c/OE,d/OE,f));if(y===0)return Ow.every(Math.max(_C(c,d,f),1));const[x,S]=o[m/o[y-1][2]<o[y][2]/m?y-1:y];return x.every(S)}return[a,l]}const[Mte,Ete]=Ez(Qc,TR,RS,Mz,ER,SR),[Ate,Tte]=Ez(Zc,AR,PS,ex,MR,wR);function LE(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function DE(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function l0(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function Cte(t){var e=t.dateTime,n=t.date,r=t.time,i=t.periods,s=t.days,o=t.shortDays,a=t.months,l=t.shortMonths,c=c0(i),d=u0(i),f=c0(s),m=u0(s),y=c0(o),x=u0(o),S=c0(a),_=u0(a),w=c0(l),A=u0(l),T={a:ce,A:B,b:K,B:q,c:null,d:rL,e:rL,f:Zte,g:ane,G:cne,H:qte,I:Kte,j:Yte,L:Az,m:Qte,M:Jte,p:$,q:Z,Q:oL,s:aL,S:ene,u:tne,U:nne,V:rne,w:ine,W:sne,x:null,X:null,y:one,Y:lne,Z:une,"%":sL},C={a:ge,A:ae,b:fe,B:_e,c:null,d:iL,e:iL,f:pne,g:Mne,G:Ane,H:dne,I:fne,j:hne,L:Cz,m:mne,M:gne,p:Se,q:$e,Q:oL,s:aL,S:vne,u:yne,U:xne,V:bne,w:_ne,W:wne,x:null,X:null,y:Sne,Y:Ene,Z:Tne,"%":sL},O={a:k,A:j,b:H,B:ne,c:te,d:tL,e:tL,f:Gte,g:eL,G:JO,H:nL,I:nL,j:zte,L:Vte,m:Fte,M:Bte,p:V,q:jte,Q:$te,s:Xte,S:Hte,u:kte,U:Ote,V:Lte,w:Ite,W:Dte,x:pe,X:oe,y:eL,Y:JO,Z:Ute,"%":Wte};T.x=N(n,T),T.X=N(r,T),T.c=N(e,T),C.x=N(n,C),C.X=N(r,C),C.c=N(e,C);function N(Me,He){return function(Xe){var ue=[],Q=-1,Ge=0,Ue=Me.length,We,Qe,xt;for(Xe instanceof Date||(Xe=new Date(+Xe));++Q<Ue;)Me.charCodeAt(Q)===37&&(ue.push(Me.slice(Ge,Q)),(Qe=QO[We=Me.charAt(++Q)])!=null?We=Me.charAt(++Q):Qe=We==="e"?" ":"0",(xt=He[We])&&(We=xt(Xe,Qe)),ue.push(We),Ge=Q+1);return ue.push(Me.slice(Ge,Q)),ue.join("")}}function D(Me,He){return function(Xe){var ue=l0(1900,void 0,1),Q=F(ue,Me,Xe+="",0),Ge,Ue;if(Q!=Xe.length)return null;if("Q"in ue)return new Date(ue.Q);if("s"in ue)return new Date(ue.s*1e3+("L"in ue?ue.L:0));if(He&&!("Z"in ue)&&(ue.Z=0),"p"in ue&&(ue.H=ue.H%12+ue.p*12),ue.m===void 0&&(ue.m="q"in ue?ue.q:0),"V"in ue){if(ue.V<1||ue.V>53)return null;"w"in ue||(ue.w=1),"Z"in ue?(Ge=DE(l0(ue.y,0,1)),Ue=Ge.getUTCDay(),Ge=Ue>4||Ue===0?Dw.ceil(Ge):Dw(Ge),Ge=CS.offset(Ge,(ue.V-1)*7),ue.y=Ge.getUTCFullYear(),ue.m=Ge.getUTCMonth(),ue.d=Ge.getUTCDate()+(ue.w+6)%7):(Ge=LE(l0(ue.y,0,1)),Ue=Ge.getDay(),Ge=Ue>4||Ue===0?Lw.ceil(Ge):Lw(Ge),Ge=ex.offset(Ge,(ue.V-1)*7),ue.y=Ge.getFullYear(),ue.m=Ge.getMonth(),ue.d=Ge.getDate()+(ue.w+6)%7)}else("W"in ue||"U"in ue)&&("w"in ue||(ue.w="u"in ue?ue.u%7:"W"in ue?1:0),Ue="Z"in ue?DE(l0(ue.y,0,1)).getUTCDay():LE(l0(ue.y,0,1)).getDay(),ue.m=0,ue.d="W"in ue?(ue.w+6)%7+ue.W*7-(Ue+5)%7:ue.w+ue.U*7-(Ue+6)%7);return"Z"in ue?(ue.H+=ue.Z/100|0,ue.M+=ue.Z%100,DE(ue)):LE(ue)}}function F(Me,He,Xe,ue){for(var Q=0,Ge=He.length,Ue=Xe.length,We,Qe;Q<Ge;){if(ue>=Ue)return-1;if(We=He.charCodeAt(Q++),We===37){if(We=He.charAt(Q++),Qe=O[We in QO?He.charAt(Q++):We],!Qe||(ue=Qe(Me,Xe,ue))<0)return-1}else if(We!=Xe.charCodeAt(ue++))return-1}return ue}function V(Me,He,Xe){var ue=c.exec(He.slice(Xe));return ue?(Me.p=d.get(ue[0].toLowerCase()),Xe+ue[0].length):-1}function k(Me,He,Xe){var ue=y.exec(He.slice(Xe));return ue?(Me.w=x.get(ue[0].toLowerCase()),Xe+ue[0].length):-1}function j(Me,He,Xe){var ue=f.exec(He.slice(Xe));return ue?(Me.w=m.get(ue[0].toLowerCase()),Xe+ue[0].length):-1}function H(Me,He,Xe){var ue=w.exec(He.slice(Xe));return ue?(Me.m=A.get(ue[0].toLowerCase()),Xe+ue[0].length):-1}function ne(Me,He,Xe){var ue=S.exec(He.slice(Xe));return ue?(Me.m=_.get(ue[0].toLowerCase()),Xe+ue[0].length):-1}function te(Me,He,Xe){return F(Me,e,He,Xe)}function pe(Me,He,Xe){return F(Me,n,He,Xe)}function oe(Me,He,Xe){return F(Me,r,He,Xe)}function ce(Me){return o[Me.getDay()]}function B(Me){return s[Me.getDay()]}function K(Me){return l[Me.getMonth()]}function q(Me){return a[Me.getMonth()]}function $(Me){return i[+(Me.getHours()>=12)]}function Z(Me){return 1+~~(Me.getMonth()/3)}function ge(Me){return o[Me.getUTCDay()]}function ae(Me){return s[Me.getUTCDay()]}function fe(Me){return l[Me.getUTCMonth()]}function _e(Me){return a[Me.getUTCMonth()]}function Se(Me){return i[+(Me.getUTCHours()>=12)]}function $e(Me){return 1+~~(Me.getUTCMonth()/3)}return{format:function(Me){var He=N(Me+="",T);return He.toString=function(){return Me},He},parse:function(Me){var He=D(Me+="",!1);return He.toString=function(){return Me},He},utcFormat:function(Me){var He=N(Me+="",C);return He.toString=function(){return Me},He},utcParse:function(Me){var He=D(Me+="",!0);return He.toString=function(){return Me},He}}}var QO={"-":"",_:" ",0:"0"},wi=/^\s*\d+/,Pte=/^%/,Rte=/[\\^$*+?|[\]().{}]/g;function jn(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",s=i.length;return r+(s<n?new Array(n-s+1).join(e)+i:i)}function Nte(t){return t.replace(Rte,"\\$&")}function c0(t){return new RegExp("^(?:"+t.map(Nte).join("|")+")","i")}function u0(t){return new Map(t.map((e,n)=>[e.toLowerCase(),n]))}function Ite(t,e,n){var r=wi.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function kte(t,e,n){var r=wi.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function Ote(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function Lte(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Dte(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function JO(t,e,n){var r=wi.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function eL(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Ute(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function jte(t,e,n){var r=wi.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function Fte(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function tL(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function zte(t,e,n){var r=wi.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function nL(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function Bte(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function Hte(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Vte(t,e,n){var r=wi.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Gte(t,e,n){var r=wi.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Wte(t,e,n){var r=Pte.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function $te(t,e,n){var r=wi.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Xte(t,e,n){var r=wi.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function rL(t,e){return jn(t.getDate(),e,2)}function qte(t,e){return jn(t.getHours(),e,2)}function Kte(t,e){return jn(t.getHours()%12||12,e,2)}function Yte(t,e){return jn(1+ex.count(Zc(t),t),e,3)}function Az(t,e){return jn(t.getMilliseconds(),e,3)}function Zte(t,e){return Az(t,e)+"000"}function Qte(t,e){return jn(t.getMonth()+1,e,2)}function Jte(t,e){return jn(t.getMinutes(),e,2)}function ene(t,e){return jn(t.getSeconds(),e,2)}function tne(t){var e=t.getDay();return e===0?7:e}function nne(t,e){return jn(PS.count(Zc(t)-1,t),e,2)}function Tz(t){var e=t.getDay();return e>=4||e===0?Eg(t):Eg.ceil(t)}function rne(t,e){return t=Tz(t),jn(Eg.count(Zc(t),t)+(Zc(t).getDay()===4),e,2)}function ine(t){return t.getDay()}function sne(t,e){return jn(Lw.count(Zc(t)-1,t),e,2)}function one(t,e){return jn(t.getFullYear()%100,e,2)}function ane(t,e){return t=Tz(t),jn(t.getFullYear()%100,e,2)}function lne(t,e){return jn(t.getFullYear()%1e4,e,4)}function cne(t,e){var n=t.getDay();return t=n>=4||n===0?Eg(t):Eg.ceil(t),jn(t.getFullYear()%1e4,e,4)}function une(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+jn(e/60|0,"0",2)+jn(e%60,"0",2)}function iL(t,e){return jn(t.getUTCDate(),e,2)}function dne(t,e){return jn(t.getUTCHours(),e,2)}function fne(t,e){return jn(t.getUTCHours()%12||12,e,2)}function hne(t,e){return jn(1+CS.count(Qc(t),t),e,3)}function Cz(t,e){return jn(t.getUTCMilliseconds(),e,3)}function pne(t,e){return Cz(t,e)+"000"}function mne(t,e){return jn(t.getUTCMonth()+1,e,2)}function gne(t,e){return jn(t.getUTCMinutes(),e,2)}function vne(t,e){return jn(t.getUTCSeconds(),e,2)}function yne(t){var e=t.getUTCDay();return e===0?7:e}function xne(t,e){return jn(RS.count(Qc(t)-1,t),e,2)}function Pz(t){var e=t.getUTCDay();return e>=4||e===0?Ag(t):Ag.ceil(t)}function bne(t,e){return t=Pz(t),jn(Ag.count(Qc(t),t)+(Qc(t).getUTCDay()===4),e,2)}function _ne(t){return t.getUTCDay()}function wne(t,e){return jn(Dw.count(Qc(t)-1,t),e,2)}function Sne(t,e){return jn(t.getUTCFullYear()%100,e,2)}function Mne(t,e){return t=Pz(t),jn(t.getUTCFullYear()%100,e,2)}function Ene(t,e){return jn(t.getUTCFullYear()%1e4,e,4)}function Ane(t,e){var n=t.getUTCDay();return t=n>=4||n===0?Ag(t):Ag.ceil(t),jn(t.getUTCFullYear()%1e4,e,4)}function Tne(){return"+0000"}function sL(){return"%"}function oL(t){return+t}function aL(t){return Math.floor(+t/1e3)}var lm,Rz,Nz;Cne({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function Cne(t){return lm=Cte(t),Rz=lm.format,lm.parse,Nz=lm.utcFormat,lm.utcParse,lm}function Pne(t){return new Date(t)}function Rne(t){return t instanceof Date?+t:+new Date(+t)}function CR(t,e,n,r,i,s,o,a,l,c){var d=pR(),f=d.invert,m=d.domain,y=c(".%L"),x=c(":%S"),S=c("%I:%M"),_=c("%I %p"),w=c("%a %d"),A=c("%b %d"),T=c("%B"),C=c("%Y");function O(N){return(l(N)<N?y:a(N)<N?x:o(N)<N?S:s(N)<N?_:r(N)<N?i(N)<N?w:A:n(N)<N?T:C)(N)}return d.invert=function(N){return new Date(f(N))},d.domain=function(N){return arguments.length?m(Array.from(N,Rne)):m().map(Pne)},d.ticks=function(N){var D=m();return t(D[0],D[D.length-1],N??10)},d.tickFormat=function(N,D){return D==null?O:c(D)},d.nice=function(N){var D=m();return(!N||typeof N.range!="function")&&(N=e(D[0],D[D.length-1],N??10)),N?m(vz(D,N)):d},d.copy=function(){return Jy(d,CR(t,e,n,r,i,s,o,a,l,c))},d}function Nne(){return ea.apply(CR(Ate,Tte,Zc,AR,PS,ex,MR,wR,nh,Rz).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Ine(){return ea.apply(CR(Mte,Ete,Qc,TR,RS,CS,ER,SR,nh,Nz).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function NS(){var t=0,e=1,n,r,i,s,o=Es,a=!1,l;function c(f){return f==null||isNaN(f=+f)?l:o(i===0?.5:(f=(s(f)-n)*i,a?Math.max(0,Math.min(1,f)):f))}c.domain=function(f){return arguments.length?([t,e]=f,n=s(t=+t),r=s(e=+e),i=n===r?0:1/(r-n),c):[t,e]},c.clamp=function(f){return arguments.length?(a=!!f,c):a},c.interpolator=function(f){return arguments.length?(o=f,c):o};function d(f){return function(m){var y,x;return arguments.length?([y,x]=m,o=f(y,x),c):[o(0),o(1)]}}return c.range=d(Wg),c.rangeRound=d(hR),c.unknown=function(f){return arguments.length?(l=f,c):l},function(f){return s=f,n=f(t),r=f(e),i=n===r?0:1/(r-n),c}}function Nd(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function Iz(){var t=Rd(NS()(Es));return t.copy=function(){return Nd(t,Iz())},ru.apply(t,arguments)}function kz(){var t=vR(NS()).domain([1,10]);return t.copy=function(){return Nd(t,kz()).base(t.base())},ru.apply(t,arguments)}function Oz(){var t=yR(NS());return t.copy=function(){return Nd(t,Oz()).constant(t.constant())},ru.apply(t,arguments)}function PR(){var t=xR(NS());return t.copy=function(){return Nd(t,PR()).exponent(t.exponent())},ru.apply(t,arguments)}function kne(){return PR.apply(null,arguments).exponent(.5)}function Lz(){var t=[],e=Es;function n(r){if(r!=null&&!isNaN(r=+r))return e((Zy(t,r,1)-1)/(t.length-1))}return n.domain=function(r){if(!arguments.length)return t.slice();t=[];for(let i of r)i!=null&&!isNaN(i=+i)&&t.push(i);return t.sort(wd),n},n.interpolator=function(r){return arguments.length?(e=r,n):e},n.range=function(){return t.map((r,i)=>e(i/(t.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(i,s)=>yee(t,s/r))},n.copy=function(){return Lz(e).domain(t)},ru.apply(n,arguments)}function IS(){var t=0,e=.5,n=1,r=1,i,s,o,a,l,c=Es,d,f=!1,m;function y(S){return isNaN(S=+S)?m:(S=.5+((S=+d(S))-s)*(r*S<r*s?a:l),c(f?Math.max(0,Math.min(1,S)):S))}y.domain=function(S){return arguments.length?([t,e,n]=S,i=d(t=+t),s=d(e=+e),o=d(n=+n),a=i===s?0:.5/(s-i),l=s===o?0:.5/(o-s),r=s<i?-1:1,y):[t,e,n]},y.clamp=function(S){return arguments.length?(f=!!S,y):f},y.interpolator=function(S){return arguments.length?(c=S,y):c};function x(S){return function(_){var w,A,T;return arguments.length?([w,A,T]=_,c=Wee(S,[w,A,T]),y):[c(0),c(.5),c(1)]}}return y.range=x(Wg),y.rangeRound=x(hR),y.unknown=function(S){return arguments.length?(m=S,y):m},function(S){return d=S,i=S(t),s=S(e),o=S(n),a=i===s?0:.5/(s-i),l=s===o?0:.5/(o-s),r=s<i?-1:1,y}}function Dz(){var t=Rd(IS()(Es));return t.copy=function(){return Nd(t,Dz())},ru.apply(t,arguments)}function Uz(){var t=vR(IS()).domain([.1,1,10]);return t.copy=function(){return Nd(t,Uz()).base(t.base())},ru.apply(t,arguments)}function jz(){var t=yR(IS());return t.copy=function(){return Nd(t,jz()).constant(t.constant())},ru.apply(t,arguments)}function RR(){var t=xR(IS());return t.copy=function(){return Nd(t,RR()).exponent(t.exponent())},ru.apply(t,arguments)}function One(){return RR.apply(null,arguments).exponent(.5)}const Fz=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:uR,scaleDiverging:Dz,scaleDivergingLog:Uz,scaleDivergingPow:RR,scaleDivergingSqrt:One,scaleDivergingSymlog:jz,scaleIdentity:gz,scaleImplicit:wC,scaleLinear:mz,scaleLog:yz,scaleOrdinal:cR,scalePoint:_ee,scalePow:bR,scaleQuantile:_z,scaleQuantize:wz,scaleRadial:bz,scaleSequential:Iz,scaleSequentialLog:kz,scaleSequentialPow:PR,scaleSequentialQuantile:Lz,scaleSequentialSqrt:kne,scaleSequentialSymlog:Oz,scaleSqrt:pte,scaleSymlog:xz,scaleThreshold:Sz,scaleTime:Nne,scaleUtc:Ine,tickFormat:pz},Symbol.toStringTag,{value:"Module"}));function Lne(t){var e=Fz;if(t in e&&typeof e[t]=="function")return e[t]();var n="scale".concat(kP(t));if(n in e&&typeof e[n]=="function")return e[n]()}function lL(t,e,n){if(typeof t=="function")return t.copy().domain(e).range(n);if(t!=null){var r=Lne(t);if(r!=null)return r.domain(e).range(n),r}}function NR(t,e,n,r){if(!(n==null||r==null))return typeof t.scale=="function"?lL(t.scale,n,r):lL(e,n,r)}function Dne(t){return"scale".concat(kP(t))}function Une(t){return Dne(t)in Fz}var zz=(t,e,n)=>{if(t!=null){var r=t.scale,i=t.type;if(r==="auto")return i==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!e)?"point":i==="category"?"band":"linear";if(typeof r=="string")return Une(r)?r:"point"}};function jne(t,e){for(var n=0,r=t.length,i=t[0]<t[t.length-1];n<r;){var s=Math.floor((n+r)/2);(i?t[s]<e:t[s]>e)?n=s+1:r=s}return n}function Bz(t,e){if(t){var n=e??t.domain(),r=n.map(s=>{var o;return(o=t(s))!==null&&o!==void 0?o:0}),i=t.range();if(!(n.length===0||i.length<2))return s=>{var o,a,l=jne(r,s);if(l<=0)return n[0];if(l>=n.length)return n[n.length-1];var c=(o=r[l-1])!==null&&o!==void 0?o:0,d=(a=r[l])!==null&&a!==void 0?a:0;return Math.abs(s-c)<=Math.abs(s-d)?n[l-1]:n[l]}}}function Fne(t){if(t!=null)return"invert"in t&&typeof t.invert=="function"?t.invert.bind(t):Bz(t,void 0)}function cL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Uw(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?cL(Object(n),!0).forEach(function(r){zne(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):cL(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function zne(t,e,n){return(e=Bne(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Bne(t){var e=Hne(t,"string");return typeof e=="symbol"?e:e+""}function Hne(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Hz(t,e){return $ne(t)||Wne(t,e)||Gne(t,e)||Vne()}function Vne(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Gne(t,e){if(t){if(typeof t=="string")return uL(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?uL(t,e):void 0}}function uL(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Wne(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function $ne(t){if(Array.isArray(t))return t}var AC=[0,"auto"],ti={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:void 0,height:30,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"bottom",padding:{left:0,right:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"category",unit:void 0,niceTicks:"auto"},Vz=(t,e)=>t.cartesianAxis.xAxis[e],iu=(t,e)=>{var n=Vz(t,e);return n??ti},ni={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:AC,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,niceTicks:"auto",width:$y},Gz=(t,e)=>t.cartesianAxis.yAxis[e],su=(t,e)=>{var n=Gz(t,e);return n??ni},Xne={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},IR=(t,e)=>{var n=t.cartesianAxis.zAxis[e];return n??Xne},Ps=(t,e,n)=>{switch(e){case"xAxis":return iu(t,n);case"yAxis":return su(t,n);case"zAxis":return IR(t,n);case"angleAxis":return nR(t,n);case"radiusAxis":return rR(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},qne=(t,e,n)=>{switch(e){case"xAxis":return iu(t,n);case"yAxis":return su(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},tx=(t,e,n)=>{switch(e){case"xAxis":return iu(t,n);case"yAxis":return su(t,n);case"angleAxis":return nR(t,n);case"radiusAxis":return rR(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},Wz=t=>t.graphicalItems.cartesianItems.some(e=>e.type==="bar")||t.graphicalItems.polarItems.some(e=>e.type==="radialBar");function $z(t,e){return n=>{switch(t){case"xAxis":return"xAxisId"in n&&n.xAxisId===e;case"yAxis":return"yAxisId"in n&&n.yAxisId===e;case"zAxis":return"zAxisId"in n&&n.zAxisId===e;case"angleAxis":return"angleAxisId"in n&&n.angleAxisId===e;case"radiusAxis":return"radiusAxisId"in n&&n.radiusAxisId===e;default:return!1}}}var Xz=t=>t.graphicalItems.cartesianItems,Kne=Oe([bi,MS],$z),qz=(t,e,n)=>t.filter(n).filter(r=>(e==null?void 0:e.includeHidden)===!0?!0:!r.hide),$g=Oe([Xz,Ps,Kne],qz,{memoizeOptions:{resultEqualityCheck:AS}}),Kz=Oe([$g],t=>t.filter(e=>e.type==="area"||e.type==="bar").filter(oR)),Yz=t=>t.filter(e=>!("stackId"in e)||e.stackId===void 0),Yne=Oe([$g],Yz),Zz=t=>t.map(e=>e.data).filter(Boolean).flat(1),Zne=Oe([$g],t=>t.some(e=>!e.data)),Qz=Oe([$g],Zz,{memoizeOptions:{resultEqualityCheck:AS}}),Jz=(t,e)=>{var n=e.chartData,r=n===void 0?[]:n,i=e.dataStartIndex,s=e.dataEndIndex;return t.length>0?t:r.slice(i,s+1)},kR=Oe([Qz,xS],Jz),Qne=(t,e,n)=>(e==null?void 0:e.dataKey)!=null?t.map(r=>({value:yi(r,e.dataKey)})):n.length>0?n.map(r=>r.dataKey).flatMap(r=>t.map(i=>({value:yi(i,r)}))):t.map(r=>({value:r})),eB=(t,e,n,r,i,s)=>{var o=r.chartData,a=o===void 0?[]:o,l=r.dataStartIndex,c=r.dataEndIndex,d=Qne(t,e,n);if(i&&(e==null?void 0:e.dataKey)!=null&&s.length>0){var f=a.slice(l,c+1),m=f.map(y=>({value:yi(y,e.dataKey)})).filter(y=>y.value!=null);return[...m,...d]}return d},nx=Oe([kR,Ps,$g,xS,Zne,Qz],eB);function eg(t){if(Il(t)||t instanceof Date){var e=Number(t);if(wn(e))return e}}function dL(t){if(Array.isArray(t)){var e=[eg(t[0]),eg(t[1])];return Al(e)?e:void 0}var n=eg(t);if(n!=null)return[n,n]}function Ll(t){return t.map(eg).filter(Ks)}function Jne(t,e){var n=eg(t),r=eg(e);return n==null&&r==null?0:n==null?-1:r==null?1:n-r}var ere=Oe([nx],t=>t==null?void 0:t.map(e=>e.value).sort(Jne));function tB(t,e){switch(t){case"xAxis":return e.direction==="x";case"yAxis":return e.direction==="y";default:return!1}}function tre(t,e,n){if(!n)return[];if(!n.length)return[];var r;if(typeof e=="number"&&!Nl(e))r=e;else if(Array.isArray(e)){var i=Ll(e);i.length>0&&(r=Math.max(...i))}return r==null?[]:Ll(n.flatMap(s=>{var o=yi(t,s.dataKey),a,l;if(Array.isArray(o)){var c=Hz(o,2);a=c[0],l=c[1]}else a=l=o;if(!(!wn(a)||!wn(l)))return[r-a,r+l]}))}var ai=t=>{var e=_i(t),n=Gg(t);return tx(t,e,n)},Tg=Oe([ai],t=>t==null?void 0:t.dataKey),nre=Oe([Kz,xS,ai],sz),nB=(t,e,n,r)=>{var i={},s=e.reduce((o,a)=>{if(a.stackId==null)return o;var l=o[a.stackId];return l==null&&(l=[]),l.push(a),o[a.stackId]=l,o},i);return Object.fromEntries(Object.entries(s).map(o=>{var a=Hz(o,2),l=a[0],c=a[1],d=r?[...c].reverse():c,f=d.map(sR);return[l,{stackedData:bY(t,f,n),graphicalItems:d}]}))},rB=Oe([nre,Kz,bS,Q4],nB),iB=(t,e,n,r)=>{var i=e.dataStartIndex,s=e.dataEndIndex;if(r==null&&n!=="zAxis")return MY(t,i,s)},rre=Oe([Ps],t=>t.allowDataOverflow),OR=t=>{var e;if(t==null||!("domain"in t))return AC;if(t.domain!=null)return t.domain;if("ticks"in t&&t.ticks!=null){if(t.type==="number"){var n=Ll(t.ticks);return[Math.min(...n),Math.max(...n)]}if(t.type==="category")return t.ticks.map(String)}return(e=t==null?void 0:t.domain)!==null&&e!==void 0?e:AC},sB=Oe([Ps],OR),oB=Oe([sB,rre],B4),ire=Oe([rB,$a,bi,oB],iB,{memoizeOptions:{resultEqualityCheck:ES}}),LR=t=>t.errorBars,sre=(t,e,n)=>t.flatMap(r=>e[r.id]).filter(Boolean).filter(r=>tB(n,r)),jw=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var i=n.filter(Boolean);if(i.length!==0){var s=i.flat(),o=Math.min(...s),a=Math.max(...s);return[o,a]}},aB=function(e,n,r,i,s){var o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:[],a,l;if(r.length>0&&r.forEach(c=>{var d,f=c.data!=null?[...c.data]:o,m=(d=i[c.id])===null||d===void 0?void 0:d.filter(y=>tB(s,y));f.forEach(y=>{var x,S=yi(y,(x=n.dataKey)!==null&&x!==void 0?x:c.dataKey),_=tre(y,S,m);if(_.length>=2){var w=Math.min(..._),A=Math.max(..._);(a==null||w<a)&&(a=w),(l==null||A>l)&&(l=A)}var T=dL(S);T!=null&&(a=a==null?T[0]:Math.min(a,T[0]),l=l==null?T[1]:Math.max(l,T[1]))})}),(n==null?void 0:n.dataKey)!=null&&r.length===0&&e.forEach(c=>{var d=dL(yi(c,n.dataKey));d!=null&&(a=a==null?d[0]:Math.min(a,d[0]),l=l==null?d[1]:Math.max(l,d[1]))}),wn(a)&&wn(l))return[a,l]},ore=Oe([kR,Ps,Yne,LR,bi,DJ],aB,{memoizeOptions:{resultEqualityCheck:ES}});function are(t){var e=t.value;if(Il(e)||e instanceof Date)return e}var lre=(t,e,n)=>{var r=t.map(are).filter(i=>i!=null);return n&&(e.dataKey==null||e.allowDuplicatedCategory&&y5(r))?z4(0,t.length):e.allowDuplicatedCategory?r:Array.from(new Set(r))},lB=t=>t.referenceElements.dots,Xg=(t,e,n)=>t.filter(r=>r.ifOverflow==="extendDomain").filter(r=>e==="xAxis"?r.xAxisId===n:r.yAxisId===n),cre=Oe([lB,bi,MS],Xg),cB=t=>t.referenceElements.areas,ure=Oe([cB,bi,MS],Xg),uB=t=>t.referenceElements.lines,dre=Oe([uB,bi,MS],Xg),dB=(t,e)=>{if(t!=null){var n=Ll(t.map(r=>e==="xAxis"?r.x:r.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},fre=Oe(cre,bi,dB),fB=(t,e)=>{if(t!=null){var n=Ll(t.flatMap(r=>[e==="xAxis"?r.x1:r.y1,e==="xAxis"?r.x2:r.y2]));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},hre=Oe([ure,bi],fB);function pre(t){var e;if(t.x!=null)return Ll([t.x]);var n=(e=t.segment)===null||e===void 0?void 0:e.map(r=>r.x);return n==null||n.length===0?[]:Ll(n)}function mre(t){var e;if(t.y!=null)return Ll([t.y]);var n=(e=t.segment)===null||e===void 0?void 0:e.map(r=>r.y);return n==null||n.length===0?[]:Ll(n)}var hB=(t,e)=>{if(t!=null){var n=t.flatMap(r=>e==="xAxis"?pre(r):mre(r));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},gre=Oe([dre,bi],hB),vre=Oe(fre,gre,hre,(t,e,n)=>jw(t,n,e)),pB=(t,e,n,r,i,s,o,a)=>{if(n!=null)return n;var l=o==="vertical"&&a==="xAxis"||o==="horizontal"&&a==="yAxis",c=l?jw(r,s,i):jw(s,i);return HJ(e,c,t.allowDataOverflow)},yre=Oe([Ps,sB,oB,ire,ore,vre,fr,bi],pB,{memoizeOptions:{resultEqualityCheck:ES}}),xre=[0,1],mB=(t,e,n,r,i,s,o)=>{if(!((t==null||n==null||n.length===0)&&o===void 0)){var a=t.dataKey,l=t.type,c=Fl(e,s);if(c&&a==null){var d;return z4(0,(d=n==null?void 0:n.length)!==null&&d!==void 0?d:0)}return l==="category"?lre(r,t,c):i==="expand"&&!c?xre:o}},DR=Oe([Ps,fr,kR,nx,bS,bi,yre],mB),qg=Oe([Ps,Wz,JP],zz),gB=(t,e,n)=>{var r=e.niceTicks;if(r!=="none"){var i=OR(e),s=Array.isArray(i)&&(i[0]==="auto"||i[1]==="auto");if((r==="snap125"||r==="adaptive")&&e!=null&&e.tickCount&&Al(t)){if(s)return bO(t,e.tickCount,e.allowDecimals,r);if(e.type==="number")return _O(t,e.tickCount,e.allowDecimals,r)}if(r==="auto"&&n==="linear"&&e!=null&&e.tickCount){if(s&&Al(t))return bO(t,e.tickCount,e.allowDecimals,"adaptive");if(e.type==="number"&&Al(t))return _O(t,e.tickCount,e.allowDecimals,"adaptive")}}},UR=Oe([DR,tx,qg],gB),vB=(t,e,n,r)=>{if(r!=="angleAxis"&&(t==null?void 0:t.type)==="number"&&Al(e)&&Array.isArray(n)&&n.length>0){var i,s,o=e[0],a=(i=n[0])!==null&&i!==void 0?i:0,l=e[1],c=(s=n[n.length-1])!==null&&s!==void 0?s:0;return[Math.min(o,a),Math.max(l,c)]}return e},bre=Oe([Ps,DR,UR,bi],vB),_re=Oe(nx,Ps,(t,e)=>{if(!(!e||e.type!=="number")){var n=1/0,r=Array.from(Ll(t.map(f=>f.value))).sort((f,m)=>f-m),i=r[0],s=r[r.length-1];if(i==null||s==null)return 1/0;var o=s-i;if(o===0)return 1/0;for(var a=0;a<r.length-1;a++){var l=r[a],c=r[a+1];if(!(l==null||c==null)){var d=c-l;n=Math.min(n,d)}}return n/o}}),yB=Oe(_re,fr,ZJ,Gi,(t,e,n,r,i)=>i,(t,e,n,r,i)=>{if(!wn(t))return 0;var s=e==="vertical"?r.height:r.width;if(i==="gap")return t*s/2;if(i==="no-gap"){var o=Ad(n,t*s),a=t*s/2;return a-o-(a-o)/s*o}return 0}),wre=(t,e,n)=>{var r=iu(t,e);return r==null||typeof r.padding!="string"?0:yB(t,"xAxis",e,n,r.padding)},Sre=(t,e,n)=>{var r=su(t,e);return r==null||typeof r.padding!="string"?0:yB(t,"yAxis",e,n,r.padding)},Mre=Oe(iu,wre,(t,e)=>{var n,r;if(t==null)return{left:0,right:0};var i=t.padding;return typeof i=="string"?{left:e,right:e}:{left:((n=i.left)!==null&&n!==void 0?n:0)+e,right:((r=i.right)!==null&&r!==void 0?r:0)+e}}),Ere=Oe(su,Sre,(t,e)=>{var n,r;if(t==null)return{top:0,bottom:0};var i=t.padding;return typeof i=="string"?{top:e,bottom:e}:{top:((n=i.top)!==null&&n!==void 0?n:0)+e,bottom:((r=i.bottom)!==null&&r!==void 0?r:0)+e}}),xB=Oe([Gi,Mre,hS,fS,(t,e,n)=>n],(t,e,n,r,i)=>{var s=r.padding;return i?[s.left,n.width-s.right]:[t.left+e.left,t.left+t.width-e.right]}),bB=Oe([Gi,fr,Ere,hS,fS,(t,e,n)=>n],(t,e,n,r,i,s)=>{var o=i.padding;return s?[r.height-o.bottom,o.top]:e==="horizontal"?[t.top+t.height-n.bottom,t.top+n.top]:[t.top+n.top,t.top+t.height-n.bottom]}),rx=(t,e,n,r)=>{var i;switch(e){case"xAxis":return xB(t,n,r);case"yAxis":return bB(t,n,r);case"zAxis":return(i=IR(t,n))===null||i===void 0?void 0:i.range;case"angleAxis":return nz(t);case"radiusAxis":return rz(t,n);default:return}},_B=Oe([Ps,rx],_S),Are=Oe([qg,bre],oee),jR=Oe([Ps,qg,Are,_B],NR),wB=(t,e,n,r)=>{if(!(n==null||n.dataKey==null)){var i=n.type,s=n.scale,o=Fl(t,r);if(o&&(i==="number"||s!=="auto"))return e.map(a=>a.value)}},FR=Oe([fr,nx,tx,bi],wB),kS=Oe([jR],aR);Oe([jR],Fne);Oe([jR,ere],Bz);Oe([$g,LR,bi],sre);function SB(t,e){return t.id<e.id?-1:t.id>e.id?1:0}var OS=(t,e)=>e,LS=(t,e,n)=>n,Tre=Oe(uS,OS,LS,(t,e,n)=>t.filter(r=>r.orientation===e).filter(r=>r.mirror===n).sort(SB)),Cre=Oe(dS,OS,LS,(t,e,n)=>t.filter(r=>r.orientation===e).filter(r=>r.mirror===n).sort(SB)),MB=(t,e)=>({width:t.width,height:e.height}),Pre=(t,e)=>{var n=typeof e.width=="number"?e.width:$y;return{width:n,height:t.height}},Rre=Oe(Gi,iu,MB),Nre=(t,e,n)=>{switch(e){case"top":return t.top;case"bottom":return n-t.bottom;default:return 0}},Ire=(t,e,n)=>{switch(e){case"left":return t.left;case"right":return n-t.right;default:return 0}},kre=Oe(nu,Gi,Tre,OS,LS,(t,e,n,r,i)=>{var s={},o;return n.forEach(a=>{var l=MB(e,a);o==null&&(o=Nre(e,r,t));var c=r==="top"&&!i||r==="bottom"&&i;s[a.id]=o-Number(c)*l.height,o+=(c?-1:1)*l.height}),s}),Ore=Oe(tu,Gi,Cre,OS,LS,(t,e,n,r,i)=>{var s={},o;return n.forEach(a=>{var l=Pre(e,a);o==null&&(o=Ire(e,r,t));var c=r==="left"&&!i||r==="right"&&i;s[a.id]=o-Number(c)*l.width,o+=(c?-1:1)*l.width}),s}),Lre=(t,e)=>{var n=iu(t,e);if(n!=null)return kre(t,n.orientation,n.mirror)},Dre=Oe([Gi,iu,Lre,(t,e)=>e],(t,e,n,r)=>{if(e!=null){var i=n==null?void 0:n[r];return i==null?{x:t.left,y:0}:{x:t.left,y:i}}}),Ure=(t,e)=>{var n=su(t,e);if(n!=null)return Ore(t,n.orientation,n.mirror)},jre=Oe([Gi,su,Ure,(t,e)=>e],(t,e,n,r)=>{if(e!=null){var i=n==null?void 0:n[r];return i==null?{x:0,y:t.top}:{x:i,y:t.top}}}),Fre=Oe(Gi,su,(t,e)=>{var n=typeof e.width=="number"?e.width:$y;return{width:n,height:t.height}}),EB=(t,e,n,r)=>{if(n!=null){var i=n.allowDuplicatedCategory,s=n.type,o=n.dataKey,a=Fl(t,r),l=e.map(d=>d.value),c=l.filter(d=>d!=null);if(o&&a&&s==="category"&&i&&y5(c))return l}},zR=Oe([fr,nx,Ps,bi],EB),fL=Oe([fr,qne,qg,kS,zR,FR,rx,UR,bi],(t,e,n,r,i,s,o,a,l)=>{if(e!=null){var c=Fl(t,l);return{angle:e.angle,interval:e.interval,minTickGap:e.minTickGap,orientation:e.orientation,tick:e.tick,tickCount:e.tickCount,tickFormatter:e.tickFormatter,ticks:e.ticks,type:e.type,unit:e.unit,axisType:l,categoricalDomain:s,duplicateDomain:i,isCategorical:c,niceTicks:a,range:o,realScaleType:n,scale:r}}}),zre=(t,e,n,r,i,s,o,a,l)=>{if(!(e==null||r==null)){var c=Fl(t,l),d=e.type,f=e.ticks,m=e.tickCount,y=n==="scaleBand"&&typeof r.bandwidth=="function"?r.bandwidth()/2:2,x=d==="category"&&r.bandwidth?r.bandwidth()/y:0;x=l==="angleAxis"&&s!=null&&s.length>=2?Wo(s[0]-s[1])*2*x:x;var S=f||i;return S?S.map((_,w)=>{var A=o?o.indexOf(_):_,T=r.map(A);return wn(T)?{index:w,coordinate:T+x,value:_,offset:x}:null}).filter(Ks):c&&a?a.map((_,w)=>{var A=r.map(_);return wn(A)?{coordinate:A+x,value:_,index:w,offset:x}:null}).filter(Ks):r.ticks?r.ticks(m).map((_,w)=>{var A=r.map(_);return wn(A)?{coordinate:A+x,value:_,index:w,offset:x}:null}).filter(Ks):r.domain().map((_,w)=>{var A=r.map(_);return wn(A)?{coordinate:A+x,value:o?o[_]:_,index:w,offset:x}:null}).filter(Ks)}},AB=Oe([fr,tx,qg,kS,UR,rx,zR,FR,bi],zre),Bre=(t,e,n,r,i,s,o)=>{if(!(e==null||n==null||r==null||r[0]===r[1])){var a=Fl(t,o),l=e.tickCount,c=0;return c=o==="angleAxis"&&(r==null?void 0:r.length)>=2?Wo(r[0]-r[1])*2*c:c,a&&s?s.map((d,f)=>{var m=n.map(d);return wn(m)?{coordinate:m+c,value:d,index:f,offset:c}:null}).filter(Ks):n.ticks?n.ticks(l).map((d,f)=>{var m=n.map(d);return wn(m)?{coordinate:m+c,value:d,index:f,offset:c}:null}).filter(Ks):n.domain().map((d,f)=>{var m=n.map(d);return wn(m)?{coordinate:m+c,value:i?i[d]:d,index:f,offset:c}:null}).filter(Ks)}},TB=Oe([fr,tx,kS,rx,zR,FR,bi],Bre),CB=Oe(Ps,kS,(t,e)=>{if(!(t==null||e==null))return Uw(Uw({},t),{},{scale:e})}),Hre=Oe([Ps,qg,DR,_B],NR),Vre=Oe([Hre],aR);Oe((t,e,n)=>IR(t,n),Vre,(t,e)=>{if(!(t==null||e==null))return Uw(Uw({},t),{},{scale:e})});var Gre=Oe([fr,uS,dS],(t,e,n)=>{switch(t){case"horizontal":return e.some(r=>r.reversed)?"right-to-left":"left-to-right";case"vertical":return n.some(r=>r.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),Wre=(t,e,n)=>{var r;return(r=t.renderedTicks[e])===null||r===void 0?void 0:r[n]};Oe([Wre],t=>{if(!(!t||t.length===0))return e=>{var n,r=1/0,i=t[0];for(var s of t){var o=Math.abs(s.coordinate-e);o<r&&(r=o,i=s)}return(n=i)===null||n===void 0?void 0:n.value}});var PB=t=>t.options.defaultTooltipEventType,RB=t=>t.options.validateTooltipEventTypes;function NB(t,e,n){if(t==null)return e;var r=t?"axis":"item";return n==null?e:n.includes(r)?r:e}function ix(t,e){var n=PB(t),r=RB(t);return NB(e,n,r)}function $re(t){return zt(e=>ix(e,t))}var IB=(t,e)=>{var n,r=Number(e);if(!(Nl(r)||e==null))return r>=0?t==null||(n=t[r])===null||n===void 0?void 0:n.value:void 0},Xre=t=>t.tooltip.settings,cd={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},qre={itemInteraction:{click:cd,hover:cd},axisInteraction:{click:cd,hover:cd},keyboardInteraction:cd,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},kB=cs({name:"tooltip",initialState:qre,reducers:{addTooltipEntrySettings:{reducer(t,e){t.tooltipItemPayloads.push(e.payload)},prepare:sr()},replaceTooltipEntrySettings:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next,s=$o(t).tooltipItemPayloads.indexOf(r);s>-1&&(t.tooltipItemPayloads[s]=i)},prepare:sr()},removeTooltipEntrySettings:{reducer(t,e){var n=$o(t).tooltipItemPayloads.indexOf(e.payload);n>-1&&t.tooltipItemPayloads.splice(n,1)},prepare:sr()},setTooltipSettingsState(t,e){t.settings=e.payload},setActiveMouseOverItemIndex(t,e){t.syncInteraction.active=!1,t.syncInteraction.sourceViewBox=void 0,t.keyboardInteraction.active=!1,t.itemInteraction.hover.active=!0,t.itemInteraction.hover.index=e.payload.activeIndex,t.itemInteraction.hover.dataKey=e.payload.activeDataKey,t.itemInteraction.hover.graphicalItemId=e.payload.activeGraphicalItemId,t.itemInteraction.hover.coordinate=e.payload.activeCoordinate},mouseLeaveChart(t){t.itemInteraction.hover.active=!1,t.axisInteraction.hover.active=!1},mouseLeaveItem(t){t.itemInteraction.hover.active=!1},setActiveClickItemIndex(t,e){t.syncInteraction.active=!1,t.syncInteraction.sourceViewBox=void 0,t.itemInteraction.click.active=!0,t.keyboardInteraction.active=!1,t.itemInteraction.click.index=e.payload.activeIndex,t.itemInteraction.click.dataKey=e.payload.activeDataKey,t.itemInteraction.click.graphicalItemId=e.payload.activeGraphicalItemId,t.itemInteraction.click.coordinate=e.payload.activeCoordinate},setMouseOverAxisIndex(t,e){t.syncInteraction.active=!1,t.syncInteraction.sourceViewBox=void 0,t.axisInteraction.hover.active=!0,t.keyboardInteraction.active=!1,t.axisInteraction.hover.index=e.payload.activeIndex,t.axisInteraction.hover.dataKey=e.payload.activeDataKey,t.axisInteraction.hover.coordinate=e.payload.activeCoordinate},setMouseClickAxisIndex(t,e){t.syncInteraction.active=!1,t.syncInteraction.sourceViewBox=void 0,t.keyboardInteraction.active=!1,t.axisInteraction.click.active=!0,t.axisInteraction.click.index=e.payload.activeIndex,t.axisInteraction.click.dataKey=e.payload.activeDataKey,t.axisInteraction.click.coordinate=e.payload.activeCoordinate},setSyncInteraction(t,e){t.syncInteraction=e.payload},setKeyboardInteraction(t,e){t.keyboardInteraction.active=e.payload.active,t.keyboardInteraction.index=e.payload.activeIndex,t.keyboardInteraction.coordinate=e.payload.activeCoordinate}}}),ta=kB.actions,Kre=ta.addTooltipEntrySettings,Yre=ta.replaceTooltipEntrySettings,Zre=ta.removeTooltipEntrySettings,Qre=ta.setTooltipSettingsState,Jre=ta.setActiveMouseOverItemIndex;ta.mouseLeaveItem;var OB=ta.mouseLeaveChart;ta.setActiveClickItemIndex;var LB=ta.setMouseOverAxisIndex,eie=ta.setMouseClickAxisIndex,D0=ta.setSyncInteraction,Fw=ta.setKeyboardInteraction,tie=kB.reducer;function hL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Nb(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?hL(Object(n),!0).forEach(function(r){nie(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):hL(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function nie(t,e,n){return(e=rie(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function rie(t){var e=iie(t,"string");return typeof e=="symbol"?e:e+""}function iie(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function sie(t,e,n){return e==="axis"?n==="click"?t.axisInteraction.click:t.axisInteraction.hover:n==="click"?t.itemInteraction.click:t.itemInteraction.hover}function oie(t){return t.index!=null}var DB=(t,e,n,r)=>{if(e==null)return cd;var i=sie(t,e,n);if(i==null)return cd;if(i.active)return i;if(t.keyboardInteraction.active)return t.keyboardInteraction;if(t.syncInteraction.active&&t.syncInteraction.index!=null)return t.syncInteraction;var s=t.settings.active===!0;if(oie(i)){if(s)return Nb(Nb({},i),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return Nb(Nb({},cd),{},{coordinate:i.coordinate})};function aie(t){if(typeof t=="number")return Number.isFinite(t)?t:void 0;if(t instanceof Date){var e=t.valueOf();return Number.isFinite(e)?e:void 0}var n=Number(t);return Number.isFinite(n)?n:void 0}function lie(t,e){var n=aie(t),r=e[0],i=e[1];if(n===void 0)return!1;var s=Math.min(r,i),o=Math.max(r,i);return n>=s&&n<=o}function cie(t,e,n){if(n==null||e==null)return!0;var r=yi(t,e);return r==null||!Al(n)?!0:lie(r,n)}var H0=(t,e,n,r)=>{var i=t==null?void 0:t.index;if(i==null)return null;var s=Number(i);if(!wn(s))return i;var o=0,a=1/0;e.length>0&&(a=e.length-1);var l=Math.max(o,Math.min(s,a)),c=e[l];return c==null||cie(c,n,r)?String(l):null},UB=(t,e,n,r,i,s,o)=>{if(s!=null){var a=o[0],l=a==null?void 0:a.getPosition(s);if(l!=null)return l;var c=i==null?void 0:i[Number(s)];if(c)switch(n){case"horizontal":return{x:c.coordinate,y:(r.top+e)/2};default:return{x:(r.left+t)/2,y:c.coordinate}}}},jB=(t,e,n,r)=>{if(e==="axis")return t.tooltipItemPayloads;if(t.tooltipItemPayloads.length===0)return[];var i;if(n==="hover"?i=t.itemInteraction.hover.graphicalItemId:i=t.itemInteraction.click.graphicalItemId,t.syncInteraction.active&&i==null)return t.tooltipItemPayloads;if(i==null&&(r!=null||t.keyboardInteraction.active)){var s=t.tooltipItemPayloads[0];return s!=null?[s]:[]}return t.tooltipItemPayloads.filter(o=>{var a;return((a=o.settings)===null||a===void 0?void 0:a.graphicalItemId)===i})},FB=t=>t.options.tooltipPayloadSearcher,Kg=t=>t.tooltip;function pL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function mL(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?pL(Object(n),!0).forEach(function(r){uie(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):pL(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function uie(t,e,n){return(e=die(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function die(t){var e=fie(t,"string");return typeof e=="symbol"?e:e+""}function fie(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function hie(t){if(typeof t=="string"||typeof t=="number")return t}function pie(t){if(typeof t=="string"||typeof t=="number"||typeof t=="boolean")return t}function mie(t){if(typeof t=="string"||typeof t=="number")return t;if(typeof t=="function")return e=>t(e)}function gL(t){if(typeof t=="string")return t}function gie(t){if(!(t==null||typeof t!="object")){var e="name"in t?hie(t.name):void 0,n="unit"in t?pie(t.unit):void 0,r="dataKey"in t?mie(t.dataKey):void 0,i="payload"in t?t.payload:void 0,s="color"in t?gL(t.color):void 0,o="fill"in t?gL(t.fill):void 0;return{name:e,unit:n,dataKey:r,payload:i,color:s,fill:o}}}function vie(t,e){return t??e}var zB=(t,e,n,r,i,s,o)=>{if(!(e==null||s==null)){var a=n.chartData,l=n.computedData,c=n.dataStartIndex,d=n.dataEndIndex,f=[];return t.reduce((m,y)=>{var x,S=y.dataDefinedOnItem,_=y.settings,w=vie(S,a),A=Array.isArray(w)?d4(w,c,d):w,T=(x=_==null?void 0:_.dataKey)!==null&&x!==void 0?x:r,C=_==null?void 0:_.nameKey,O;if(r&&Array.isArray(A)&&!Array.isArray(A[0])&&o==="axis"?O=x5(A,r,i):O=s(A,e,l,C),Array.isArray(O))O.forEach(D=>{var F,V,k=gie(D),j=k==null?void 0:k.name,H=k==null?void 0:k.dataKey,ne=k==null?void 0:k.payload,te=mL(mL({},_),{},{name:j,unit:k==null?void 0:k.unit,color:(F=k==null?void 0:k.color)!==null&&F!==void 0?F:_==null?void 0:_.color,fill:(V=k==null?void 0:k.fill)!==null&&V!==void 0?V:_==null?void 0:_.fill});m.push(uk({tooltipEntrySettings:te,dataKey:H,payload:ne,value:yi(ne,H),name:j==null?void 0:String(j)}))});else{var N;m.push(uk({tooltipEntrySettings:_,dataKey:T,payload:O,value:yi(O,T),name:(N=yi(O,C))!==null&&N!==void 0?N:_==null?void 0:_.name}))}return m},f)}},BR=Oe([ai,Wz,JP],zz),yie=Oe([t=>t.graphicalItems.cartesianItems,t=>t.graphicalItems.polarItems],(t,e)=>[...t,...e]),xie=Oe([_i,Gg],$z),Qh=Oe([yie,ai,xie],qz,{memoizeOptions:{resultEqualityCheck:AS}}),bie=Oe([Qh],t=>t.filter(oR)),BB=Oe([Qh],Zz,{memoizeOptions:{resultEqualityCheck:AS}}),_ie=Oe([Qh],t=>t.some(e=>!e.data)),Lh=Oe([BB,$a],Jz),wie=Oe([bie,$a,ai],sz),HR=Oe([Lh,ai,Qh,$a,_ie,BB],eB),HB=Oe([ai],OR),Sie=Oe([ai],t=>t.allowDataOverflow),VB=Oe([HB,Sie],B4),Mie=Oe([Qh],t=>t.filter(oR)),Eie=Oe([wie,Mie,bS,Q4],nB),Aie=Oe([Eie,$a,_i,VB],iB),Tie=Oe([Qh],Yz),Cie=Oe([Lh,ai,Tie,LR,_i,UJ],aB,{memoizeOptions:{resultEqualityCheck:ES}}),Pie=Oe([lB,_i,Gg],Xg),Rie=Oe([Pie,_i],dB),Nie=Oe([cB,_i,Gg],Xg),Iie=Oe([Nie,_i],fB),kie=Oe([uB,_i,Gg],Xg),Oie=Oe([kie,_i],hB),Lie=Oe([Rie,Oie,Iie],jw),Die=Oe([ai,HB,VB,Aie,Cie,Lie,fr,_i],pB),Cg=Oe([ai,fr,Lh,HR,bS,_i,Die],mB),Uie=Oe([Cg,ai,BR],gB),jie=Oe([ai,Cg,Uie,_i],vB),GB=t=>{var e=_i(t),n=Gg(t),r=!1;return rx(t,e,n,r)},WB=Oe([ai,GB],_S),Fie=Oe([ai,BR,jie,WB],NR),$B=Oe([Fie],aR),zie=Oe([fr,HR,ai,_i],EB),Bie=Oe([fr,HR,ai,_i],wB),Hie=(t,e,n,r,i,s,o,a)=>{if(e){var l=e.type,c=Fl(t,a);if(r){var d=n==="scaleBand"&&r.bandwidth?r.bandwidth()/2:2,f=l==="category"&&r.bandwidth?r.bandwidth()/d:0;return f=a==="angleAxis"&&i!=null&&(i==null?void 0:i.length)>=2?Wo(i[0]-i[1])*2*f:f,c&&o?o.map((m,y)=>{var x=r.map(m);return wn(x)?{coordinate:x+f,value:m,index:y,offset:f}:null}).filter(Ks):r.domain().map((m,y)=>{var x=r.map(m);return wn(x)?{coordinate:x+f,value:s?s[m]:m,index:y,offset:f}:null}).filter(Ks)}}},ou=Oe([fr,ai,BR,$B,GB,zie,Bie,_i],Hie),VR=Oe([PB,RB,Xre],(t,e,n)=>NB(n.shared,t,e)),XB=t=>t.tooltip.settings.trigger,GR=t=>t.tooltip.settings.defaultIndex,sx=Oe([Kg,VR,XB,GR],DB),_y=Oe([sx,Lh,Tg,Cg],H0),qB=Oe([ou,_y],IB),Vie=Oe([sx],t=>{if(t)return t.dataKey}),Gie=Oe([sx],t=>{if(t)return t.graphicalItemId}),KB=Oe([Kg,VR,XB,GR],jB),Wie=Oe([tu,nu,fr,Gi,ou,GR,KB],UB),$ie=Oe([sx,Wie],(t,e)=>t!=null&&t.coordinate?t.coordinate:e),Xie=Oe([sx],t=>{var e;return(e=t==null?void 0:t.active)!==null&&e!==void 0?e:!1}),qie=Oe([KB,_y,$a,Tg,qB,FB,VR],zB),Kie=Oe([qie],t=>{if(t!=null){var e=t.map(n=>n.payload).filter(n=>n!=null);return Array.from(new Set(e))}});function vL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function yL(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?vL(Object(n),!0).forEach(function(r){Yie(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):vL(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Yie(t,e,n){return(e=Zie(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Zie(t){var e=Qie(t,"string");return typeof e=="symbol"?e:e+""}function Qie(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Jie=()=>zt(ai),ese=()=>{var t=Jie(),e=zt(ou),n=zt($B);return mw(!t||!n?void 0:yL(yL({},t),{},{scale:n}),e)};function xL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function cm(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?xL(Object(n),!0).forEach(function(r){tse(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):xL(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function tse(t,e,n){return(e=nse(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function nse(t){var e=rse(t,"string");return typeof e=="symbol"?e:e+""}function rse(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var ise=(t,e,n,r)=>{var i=e.find(s=>s&&s.index===n);if(i){if(t==="horizontal")return{x:i.coordinate,y:r.relativeY};if(t==="vertical")return{x:r.relativeX,y:i.coordinate}}return{x:0,y:0}},sse=(t,e,n,r)=>{var i=e.find(c=>c&&c.index===n);if(i){if(t==="centric"){var s=i.coordinate,o=r.radius;return cm(cm(cm({},r),zi(r.cx,r.cy,o,s)),{},{angle:s,radius:o})}var a=i.coordinate,l=r.angle;return cm(cm(cm({},r),zi(r.cx,r.cy,a,l)),{},{angle:l,radius:a})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function ose(t,e){var n=t.relativeX,r=t.relativeY;return n>=e.left&&n<=e.left+e.width&&r>=e.top&&r<=e.top+e.height}var YB=(t,e,n,r,i)=>{var s,o=(s=e==null?void 0:e.length)!==null&&s!==void 0?s:0;if(o<=1||t==null)return 0;if(r==="angleAxis"&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var a=0;a<o;a++){var l,c,d,f,m,y=a>0?(l=n[a-1])===null||l===void 0?void 0:l.coordinate:(c=n[o-1])===null||c===void 0?void 0:c.coordinate,x=(d=n[a])===null||d===void 0?void 0:d.coordinate,S=a>=o-1?(f=n[0])===null||f===void 0?void 0:f.coordinate:(m=n[a+1])===null||m===void 0?void 0:m.coordinate,_=void 0;if(!(y==null||x==null||S==null))if(Wo(x-y)!==Wo(S-x)){var w=[];if(Wo(S-x)===Wo(i[1]-i[0])){_=S;var A=x+i[1]-i[0];w[0]=Math.min(A,(A+y)/2),w[1]=Math.max(A,(A+y)/2)}else{_=y;var T=S+i[1]-i[0];w[0]=Math.min(x,(T+x)/2),w[1]=Math.max(x,(T+x)/2)}var C=[Math.min(x,(_+x)/2),Math.max(x,(_+x)/2)];if(t>C[0]&&t<=C[1]||t>=w[0]&&t<=w[1]){var O;return(O=n[a])===null||O===void 0?void 0:O.index}}else{var N=Math.min(y,S),D=Math.max(y,S);if(t>(N+x)/2&&t<=(D+x)/2){var F;return(F=n[a])===null||F===void 0?void 0:F.index}}}else if(e)for(var V=0;V<o;V++){var k=e[V];if(k!=null){var j=e[V+1],H=e[V-1];if(V===0&&j!=null&&t<=(k.coordinate+j.coordinate)/2||V===o-1&&H!=null&&t>(k.coordinate+H.coordinate)/2||V>0&&V<o-1&&H!=null&&j!=null&&t>(k.coordinate+H.coordinate)/2&&t<=(k.coordinate+j.coordinate)/2)return k.index}}return-1},ZB=()=>zt(JP),WR=(t,e)=>e,QB=(t,e,n)=>n,$R=(t,e,n,r)=>r,ase=Oe(ou,t=>J1(t,e=>e.coordinate)),XR=Oe([Kg,WR,QB,$R],DB),qR=Oe([XR,Lh,Tg,Cg],H0),lse=(t,e,n)=>{if(e!=null){var r=Kg(t);return e==="axis"?n==="hover"?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n==="hover"?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},JB=Oe([Kg,WR,QB,$R],jB),zw=Oe([tu,nu,fr,Gi,ou,$R,JB],UB),cse=Oe([XR,zw],(t,e)=>{var n;return(n=t.coordinate)!==null&&n!==void 0?n:e}),eH=Oe([ou,qR],IB),use=Oe([JB,qR,$a,Tg,eH,FB,WR],zB),dse=Oe([XR,qR],(t,e)=>({isActive:t.active&&e!=null,activeIndex:e})),fse=(t,e,n,r,i,s,o)=>{if(!(!t||!n||!r||!i)&&ose(t,o)){var a=EY(t,e),l=YB(a,s,i,n,r),c=ise(e,i,l,t);return{activeIndex:String(l),activeCoordinate:c}}},hse=(t,e,n,r,i,s,o)=>{if(!(!t||!r||!i||!s||!n)){var a=CJ(t,n);if(a){var l=AY(a,e),c=YB(l,o,s,r,i),d=sse(e,s,c,a);return{activeIndex:String(c),activeCoordinate:d}}}},pse=(t,e,n,r,i,s,o,a)=>{if(!(!t||!e||!r||!i||!s))return e==="horizontal"||e==="vertical"?fse(t,e,r,i,s,o,a):hse(t,e,n,r,i,s,o)},mse=Oe(t=>t.zIndex.zIndexMap,(t,e)=>e,(t,e,n)=>n,(t,e,n)=>{if(e!=null){var r=t[e];if(r!=null)return n?r.panoramaElement:r.element}}),gse=Oe(t=>t.zIndex.zIndexMap,t=>{var e=Object.keys(t).map(r=>parseInt(r,10)).concat(Object.values(Ms)),n=Array.from(new Set(e));return n.sort((r,i)=>r-i)},{memoizeOptions:{resultEqualityCheck:see}});function bL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function _L(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?bL(Object(n),!0).forEach(function(r){vse(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):bL(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function vse(t,e,n){return(e=yse(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function yse(t){var e=xse(t,"string");return typeof e=="symbol"?e:e+""}function xse(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var bse={},_se={zIndexMap:Object.values(Ms).reduce((t,e)=>_L(_L({},t),{},{[e]:{element:void 0,panoramaElement:void 0,consumers:0}}),bse)},wse=new Set(Object.values(Ms));function Sse(t){return wse.has(t)}var tH=cs({name:"zIndex",initialState:_se,reducers:{registerZIndexPortal:{reducer:(t,e)=>{var n=e.payload.zIndex;t.zIndexMap[n]?t.zIndexMap[n].consumers+=1:t.zIndexMap[n]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:sr()},unregisterZIndexPortal:{reducer:(t,e)=>{var n=e.payload.zIndex;t.zIndexMap[n]&&(t.zIndexMap[n].consumers-=1,t.zIndexMap[n].consumers<=0&&!Sse(n)&&delete t.zIndexMap[n])},prepare:sr()},registerZIndexPortalElement:{reducer:(t,e)=>{var n=e.payload,r=n.zIndex,i=n.element,s=n.isPanorama;t.zIndexMap[r]?s?t.zIndexMap[r].panoramaElement=i:t.zIndexMap[r].element=i:t.zIndexMap[r]={consumers:0,element:s?void 0:i,panoramaElement:s?i:void 0}},prepare:sr()},unregisterZIndexPortalElement:{reducer:(t,e)=>{var n=e.payload.zIndex;t.zIndexMap[n]&&(e.payload.isPanorama?t.zIndexMap[n].panoramaElement=void 0:t.zIndexMap[n].element=void 0)},prepare:sr()}}}),DS=tH.actions,Mse=DS.registerZIndexPortal,UE=DS.unregisterZIndexPortal,Ese=DS.registerZIndexPortalElement,Ase=DS.unregisterZIndexPortalElement,Tse=tH.reducer;function au(t){var e=t.zIndex,n=t.children,r=uZ(),i=r&&e!==void 0&&e!==0,s=Qs(),o=R.useRef(void 0),a=R.useRef(new Set),l=Wr(),c=zt(f=>mse(f,e,s));if(R.useLayoutEffect(()=>{if(!i){var f=a.current;f.forEach(y=>{l(UE({zIndex:y}))}),f.clear(),o.current=void 0;return}if(a.current.has(e)||(l(Mse({zIndex:e})),a.current.add(e)),c){o.current=c;var m=a.current;m.forEach(y=>{y!==e&&(l(UE({zIndex:y})),m.delete(y))})}},[l,e,i,c]),R.useLayoutEffect(()=>{var f=a.current;return()=>{f.forEach(m=>{l(UE({zIndex:m}))}),f.clear()}},[l]),!i)return n;var d=c??o.current;return d?G1.createPortal(n,d):null}function TC(){return TC=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},TC.apply(null,arguments)}function wL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ib(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?wL(Object(n),!0).forEach(function(r){Cse(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):wL(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Cse(t,e,n){return(e=Pse(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Pse(t){var e=Rse(t,"string");return typeof e=="symbol"?e:e+""}function Rse(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Nse(t){var e=t.cursor,n=t.cursorComp,r=t.cursorProps;return R.isValidElement(e)?R.cloneElement(e,r):R.createElement(n,r)}function Ise(t){var e,n=t.coordinate,r=t.payload,i=t.index,s=t.offset,o=t.tooltipAxisBandSize,a=t.layout,l=t.cursor,c=t.tooltipEventType,d=t.chartName,f=n,m=r,y=i;if(!l||!f||d!=="ScatterChart"&&c!=="axis")return null;var x,S,_;if(d==="ScatterChart")x=f,S=DQ,_=Ms.cursorLine;else if(d==="BarChart")x=UQ(a,f,s,o),S=yJ,_=Ms.cursorRectangle;else if(a==="radial"&&b5(f)){var w=j4(f),A=w.cx,T=w.cy,C=w.radius,O=w.startAngle,N=w.endAngle;x={cx:A,cy:T,startAngle:O,endAngle:N,innerRadius:C,outerRadius:C},S=IJ,_=Ms.cursorLine}else x={points:kJ(a,f,s)},S=H_,_=Ms.cursorLine;var D=typeof l=="object"&&"className"in l?l.className:void 0,F=Ib(Ib(Ib(Ib({stroke:"#ccc",pointerEvents:"none"},s),x),Y1(l)),{},{payload:m,payloadIndex:y,className:er("recharts-tooltip-cursor",D)});return R.createElement(au,{zIndex:(e=t.zIndex)!==null&&e!==void 0?e:_},R.createElement(Nse,{cursor:l,cursorComp:S,cursorProps:F}))}function kse(t){var e=ese(),n=b4(),r=Bg(),i=ZB();return e==null||n==null||r==null||i==null?null:R.createElement(Ise,TC({},t,{offset:n,layout:r,tooltipAxisBandSize:e,chartName:i}))}var nH=R.createContext(null),Ose=()=>R.useContext(nH),jE={exports:{}},SL;function Lse(){return SL||(SL=1,(function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(l,c,d){this.fn=l,this.context=c,this.once=d||!1}function s(l,c,d,f,m){if(typeof d!="function")throw new TypeError("The listener must be a function");var y=new i(d,f||l,m),x=n?n+c:c;return l._events[x]?l._events[x].fn?l._events[x]=[l._events[x],y]:l._events[x].push(y):(l._events[x]=y,l._eventsCount++),l}function o(l,c){--l._eventsCount===0?l._events=new r:delete l._events[c]}function a(){this._events=new r,this._eventsCount=0}a.prototype.eventNames=function(){var c=[],d,f;if(this._eventsCount===0)return c;for(f in d=this._events)e.call(d,f)&&c.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(d)):c},a.prototype.listeners=function(c){var d=n?n+c:c,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var m=0,y=f.length,x=new Array(y);m<y;m++)x[m]=f[m].fn;return x},a.prototype.listenerCount=function(c){var d=n?n+c:c,f=this._events[d];return f?f.fn?1:f.length:0},a.prototype.emit=function(c,d,f,m,y,x){var S=n?n+c:c;if(!this._events[S])return!1;var _=this._events[S],w=arguments.length,A,T;if(_.fn){switch(_.once&&this.removeListener(c,_.fn,void 0,!0),w){case 1:return _.fn.call(_.context),!0;case 2:return _.fn.call(_.context,d),!0;case 3:return _.fn.call(_.context,d,f),!0;case 4:return _.fn.call(_.context,d,f,m),!0;case 5:return _.fn.call(_.context,d,f,m,y),!0;case 6:return _.fn.call(_.context,d,f,m,y,x),!0}for(T=1,A=new Array(w-1);T<w;T++)A[T-1]=arguments[T];_.fn.apply(_.context,A)}else{var C=_.length,O;for(T=0;T<C;T++)switch(_[T].once&&this.removeListener(c,_[T].fn,void 0,!0),w){case 1:_[T].fn.call(_[T].context);break;case 2:_[T].fn.call(_[T].context,d);break;case 3:_[T].fn.call(_[T].context,d,f);break;case 4:_[T].fn.call(_[T].context,d,f,m);break;default:if(!A)for(O=1,A=new Array(w-1);O<w;O++)A[O-1]=arguments[O];_[T].fn.apply(_[T].context,A)}}return!0},a.prototype.on=function(c,d,f){return s(this,c,d,f,!1)},a.prototype.once=function(c,d,f){return s(this,c,d,f,!0)},a.prototype.removeListener=function(c,d,f,m){var y=n?n+c:c;if(!this._events[y])return this;if(!d)return o(this,y),this;var x=this._events[y];if(x.fn)x.fn===d&&(!m||x.once)&&(!f||x.context===f)&&o(this,y);else{for(var S=0,_=[],w=x.length;S<w;S++)(x[S].fn!==d||m&&!x[S].once||f&&x[S].context!==f)&&_.push(x[S]);_.length?this._events[y]=_.length===1?_[0]:_:o(this,y)}return this},a.prototype.removeAllListeners=function(c){var d;return c?(d=n?n+c:c,this._events[d]&&o(this,d)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,t.exports=a})(jE)),jE.exports}var Dse=Lse();const Use=z1(Dse);var wy=new Use,CC="recharts.syncEvent.tooltip",ML="recharts.syncEvent.brush",jse=(t,e)=>{if(e&&Array.isArray(t)){var n=Number.parseInt(e,10);if(!Nl(n))return t[n]}},Fse={chartName:"",tooltipPayloadSearcher:()=>{},eventEmitter:void 0,defaultTooltipEventType:"axis"},rH=cs({name:"options",initialState:Fse,reducers:{createEventEmitter:t=>{t.eventEmitter==null&&(t.eventEmitter=Symbol("rechartsEventEmitter"))}}}),zse=rH.reducer,Bse=rH.actions.createEventEmitter;function Hse(t){return t.tooltip.syncInteraction}var Vse={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},iH=cs({name:"chartData",initialState:Vse,reducers:{setChartData(t,e){if(t.chartData=e.payload,e.payload==null){t.dataStartIndex=0,t.dataEndIndex=0;return}e.payload.length>0&&t.dataEndIndex!==e.payload.length-1&&(t.dataEndIndex=e.payload.length-1)},setComputedData(t,e){t.computedData=e.payload},setDataStartEndIndexes(t,e){var n=e.payload,r=n.startIndex,i=n.endIndex;r!=null&&(t.dataStartIndex=r),i!=null&&(t.dataEndIndex=i)}}}),KR=iH.actions,EL=KR.setChartData,Gse=KR.setDataStartEndIndexes;KR.setComputedData;var Wse=iH.reducer,$se=["x","y"];function AL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function um(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?AL(Object(n),!0).forEach(function(r){Xse(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):AL(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Xse(t,e,n){return(e=qse(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function qse(t){var e=Kse(t,"string");return typeof e=="symbol"?e:e+""}function Kse(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Yse(t,e){if(t==null)return{};var n,r,i=Zse(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Zse(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function Qse(){var t=zt(eR),e=zt(tR),n=Wr(),r=zt(J4),i=zt(ou),s=Bg(),o=pS(),a=zt(l=>l.rootProps.className);R.useEffect(()=>{if(t==null)return zg;var l=(c,d,f)=>{if(e!==f&&t===c){if(d.payload.active===!1){n(D0({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(r==="index"){var m;if(o&&d!==null&&d!==void 0&&(m=d.payload)!==null&&m!==void 0&&m.coordinate&&d.payload.sourceViewBox){var y=d.payload.coordinate,x=y.x,S=y.y,_=Yse(y,$se),w=d.payload.sourceViewBox,A=w.x,T=w.y,C=w.width,O=w.height,N=um(um({},_),{},{x:o.x+(C?(x-A)/C:0)*o.width,y:o.y+(O?(S-T)/O:0)*o.height});n(um(um({},d),{},{payload:um(um({},d.payload),{},{coordinate:N})}))}else n(d);return}if(i!=null){var D;if(typeof r=="function"){var F={activeTooltipIndex:d.payload.index==null?void 0:Number(d.payload.index),isTooltipActive:d.payload.active,activeIndex:d.payload.index==null?void 0:Number(d.payload.index),activeLabel:d.payload.label,activeDataKey:d.payload.dataKey,activeCoordinate:d.payload.coordinate},V=r(i,F);D=i[V]}else r==="value"&&(D=i.find(ce=>String(ce.value)===d.payload.label));var k=d.payload.coordinate;if(k==null||o==null){n(D0({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(D==null){n(D0({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:void 0}));return}var j=k.x,H=k.y,ne=Math.min(j,o.x+o.width),te=Math.min(H,o.y+o.height),pe={x:s==="horizontal"?D.coordinate:ne,y:s==="horizontal"?te:D.coordinate},oe=D0({active:d.payload.active,coordinate:pe,dataKey:d.payload.dataKey,index:String(D.index),label:d.payload.label,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:d.payload.graphicalItemId});n(oe)}}};return wy.on(CC,l),()=>{wy.off(CC,l)}},[a,n,e,t,r,i,s,o])}function Jse(){var t=zt(eR),e=zt(tR),n=Wr();R.useEffect(()=>{if(t==null)return zg;var r=(i,s,o)=>{e!==o&&t===i&&n(Gse(s))};return wy.on(ML,r),()=>{wy.off(ML,r)}},[n,e,t])}function eoe(){var t=Wr();R.useEffect(()=>{t(Bse())},[t]),Qse(),Jse()}function toe(t,e,n,r,i,s){var o=zt(x=>lse(x,t,e)),a=zt(Gie),l=zt(tR),c=zt(eR),d=zt(J4),f=zt(Hse),m=(f==null?void 0:f.sourceViewBox)!=null,y=pS();R.useEffect(()=>{if(!m&&c!=null&&l!=null){var x=D0({active:s,coordinate:n,dataKey:o,index:i,label:typeof r=="number"?String(r):r,sourceViewBox:y,graphicalItemId:a});wy.emit(CC,c,x,l)}},[m,n,o,a,i,r,l,c,d,s,y])}function TL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function CL(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?TL(Object(n),!0).forEach(function(r){noe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):TL(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function noe(t,e,n){return(e=roe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function roe(t){var e=ioe(t,"string");return typeof e=="symbol"?e:e+""}function ioe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function soe(t,e){return coe(t)||loe(t,e)||aoe(t,e)||ooe()}function ooe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function aoe(t,e){if(t){if(typeof t=="string")return PL(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?PL(t,e):void 0}}function PL(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function loe(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function coe(t){if(Array.isArray(t))return t}function uoe(t){return t.dataKey}function doe(t,e){return R.isValidElement(t)?R.cloneElement(t,e):typeof t=="function"?R.createElement(t,e):R.createElement(tQ,e)}var RL=[],foe={allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",axisId:0,contentStyle:{},cursor:!0,filterNull:!0,includeHidden:!1,isAnimationActive:"auto",itemSorter:"name",itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,wrapperStyle:{}};function hoe(t){var e,n,r=Jo(t,foe),i=r.active,s=r.allowEscapeViewBox,o=r.animationDuration,a=r.animationEasing,l=r.content,c=r.filterNull,d=r.isAnimationActive,f=r.offset,m=r.payloadUniqBy,y=r.position,x=r.reverseDirection,S=r.useTranslate3d,_=r.wrapperStyle,w=r.cursor,A=r.shared,T=r.trigger,C=r.defaultIndex,O=r.portal,N=r.axisId,D=Wr(),F=typeof C=="number"?String(C):C;R.useEffect(()=>{D(Qre({shared:A,trigger:T,axisId:N,active:i,defaultIndex:F}))},[D,A,T,N,i,F]);var V=pS(),k=I4(),j=$re(A),H=(e=zt(Xe=>dse(Xe,j,T,F)))!==null&&e!==void 0?e:{},ne=H.activeIndex,te=H.isActive,pe=zt(Xe=>use(Xe,j,T,F)),oe=zt(Xe=>eH(Xe,j,T,F)),ce=zt(Xe=>cse(Xe,j,T,F)),B=pe,K=Ose(),q=(n=i??te)!==null&&n!==void 0?n:!1,$=dK([B,q]),Z=soe($,2),ge=Z[0],ae=Z[1],fe=j==="axis"?oe:void 0;toe(j,T,ce,fe,ne,q);var _e=O??K;if(_e==null||V==null||j==null)return null;var Se=B??RL;q||(Se=RL),c&&Se.length&&(Se=Oq(Se.filter(Xe=>Xe.value!=null&&(Xe.hide!==!0||r.includeHidden)),m,uoe));var $e=Se.length>0,Me=CL(CL({},r),{},{payload:Se,label:fe,active:q,activeIndex:ne,coordinate:ce,accessibilityLayer:k}),He=R.createElement(wQ,{allowEscapeViewBox:s,animationDuration:o,animationEasing:a,isAnimationActive:d,active:q,coordinate:ce,hasPayload:$e,offset:f,position:y,reverseDirection:x,useTranslate3d:S,viewBox:V,wrapperStyle:_,lastBoundingBox:ge,innerRef:ae,hasPortalFromProps:!!O},doe(l,Me));return R.createElement(R.Fragment,null,G1.createPortal(He,_e),q&&R.createElement(kse,{cursor:w,tooltipEventType:j,coordinate:ce,payload:Se,index:ne}))}function poe(t,e,n){return(e=moe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function moe(t){var e=goe(t,"string");return typeof e=="symbol"?e:e+""}function goe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class voe{constructor(e){poe(this,"cache",new Map),this.maxSize=e}get(e){var n=this.cache.get(e);return n!==void 0&&(this.cache.delete(e),this.cache.set(e,n)),n}set(e,n){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){var r=this.cache.keys().next().value;r!=null&&this.cache.delete(r)}this.cache.set(e,n)}clear(){this.cache.clear()}size(){return this.cache.size}}function NL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function yoe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?NL(Object(n),!0).forEach(function(r){xoe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):NL(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function xoe(t,e,n){return(e=boe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function boe(t){var e=_oe(t,"string");return typeof e=="symbol"?e:e+""}function _oe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var woe={cacheSize:2e3,enableCache:!0},sH=yoe({},woe),IL=new voe(sH.cacheSize),Soe={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},kL="recharts_measurement_span";function Moe(t,e){var n=e.fontSize||"",r=e.fontFamily||"",i=e.fontWeight||"",s=e.fontStyle||"",o=e.letterSpacing||"",a=e.textTransform||"";return"".concat(t,"|").concat(n,"|").concat(r,"|").concat(i,"|").concat(s,"|").concat(o,"|").concat(a)}var OL=(t,e)=>{try{var n=document.getElementById(kL);n||(n=document.createElement("span"),n.setAttribute("id",kL),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,Soe,e),n.textContent="".concat(t);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},V0=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||Yy.isSsr)return{width:0,height:0};if(!sH.enableCache)return OL(e,n);var r=Moe(e,n),i=IL.get(r);if(i)return i;var s=OL(e,n);return IL.set(r,s),s},oH;function Bw(t,e){return Coe(t)||Toe(t,e)||Aoe(t,e)||Eoe()}function Eoe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Aoe(t,e){if(t){if(typeof t=="string")return LL(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?LL(t,e):void 0}}function LL(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Toe(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function Coe(t){if(Array.isArray(t))return t}function Poe(t,e,n){return(e=Roe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Roe(t){var e=Noe(t,"string");return typeof e=="symbol"?e:e+""}function Noe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var DL=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,UL=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Ioe=/^(px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q)$/,koe=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,Ooe={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},Loe=["cm","mm","pt","pc","in","Q","px"];function Doe(t){return Loe.includes(t)}var Wm="NaN";function Uoe(t,e){return t*Ooe[e]}class Ui{static parse(e){var n,r=(n=koe.exec(e))!==null&&n!==void 0?n:[],i=Bw(r,3),s=i[1],o=i[2];return s==null?Ui.NaN:new Ui(parseFloat(s),o??"")}constructor(e,n){this.num=e,this.unit=n,this.num=e,this.unit=n,Nl(e)&&(this.unit=""),n!==""&&!Ioe.test(n)&&(this.num=NaN,this.unit=""),Doe(n)&&(this.num=Uoe(e,n),this.unit="px")}add(e){return this.unit!==e.unit?new Ui(NaN,""):new Ui(this.num+e.num,this.unit)}subtract(e){return this.unit!==e.unit?new Ui(NaN,""):new Ui(this.num-e.num,this.unit)}multiply(e){return this.unit!==""&&e.unit!==""&&this.unit!==e.unit?new Ui(NaN,""):new Ui(this.num*e.num,this.unit||e.unit)}divide(e){return this.unit!==""&&e.unit!==""&&this.unit!==e.unit?new Ui(NaN,""):new Ui(this.num/e.num,this.unit||e.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return Nl(this.num)}}oH=Ui;Poe(Ui,"NaN",new oH(NaN,""));function aH(t){if(t==null||t.includes(Wm))return Wm;for(var e=t;e.includes("*")||e.includes("/");){var n,r=(n=DL.exec(e))!==null&&n!==void 0?n:[],i=Bw(r,4),s=i[1],o=i[2],a=i[3],l=Ui.parse(s??""),c=Ui.parse(a??""),d=o==="*"?l.multiply(c):l.divide(c);if(d.isNaN())return Wm;e=e.replace(DL,d.toString())}for(;e.includes("+")||/.-\d+(?:\.\d+)?/.test(e);){var f,m=(f=UL.exec(e))!==null&&f!==void 0?f:[],y=Bw(m,4),x=y[1],S=y[2],_=y[3],w=Ui.parse(x??""),A=Ui.parse(_??""),T=S==="+"?w.add(A):w.subtract(A);if(T.isNaN())return Wm;e=e.replace(UL,T.toString())}return e}var jL=/\(([^()]*)\)/;function joe(t){for(var e=t,n;(n=jL.exec(e))!=null;){var r=n,i=Bw(r,2),s=i[1];e=e.replace(jL,aH(s))}return e}function Foe(t){var e=t.replace(/\s+/g,"");return e=joe(e),e=aH(e),e}function zoe(t){try{return Foe(t)}catch{return Wm}}function FE(t){var e=zoe(t.slice(5,-1));return e===Wm?"":e}var Boe=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],Hoe=["dx","dy","angle","className","breakAll"];function PC(){return PC=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},PC.apply(null,arguments)}function FL(t,e){if(t==null)return{};var n,r,i=Voe(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Voe(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function zL(t,e){return Xoe(t)||$oe(t,e)||Woe(t,e)||Goe()}function Goe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Woe(t,e){if(t){if(typeof t=="string")return BL(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?BL(t,e):void 0}}function BL(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function $oe(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function Xoe(t){if(Array.isArray(t))return t}var lH=/[ \f\n\r\t\v\u2028\u2029]+/,cH=t=>{var e=t.children,n=t.breakAll,r=t.style;try{var i=[];Hi(e)||(n?i=e.toString().split(""):i=e.toString().split(lH));var s=i.map(a=>({word:a,width:V0(a,r).width})),o=n?0:V0(" ",r).width;return{wordsWithComputedWidth:s,spaceWidth:o}}catch{return null}};function uH(t){return t==="start"||t==="middle"||t==="end"||t==="inherit"}function qoe(t){return Hi(t)||typeof t=="string"||typeof t=="number"||typeof t=="boolean"}var dH=(t,e,n,r)=>t.reduce((i,s)=>{var o=s.word,a=s.width,l=i[i.length-1];if(l&&a!=null&&(e==null||r||l.width+a+n<Number(e)))l.words.push(o),l.width+=a+n;else{var c={words:[o],width:a};i.push(c)}return i},[]),fH=t=>t.reduce((e,n)=>e.width>n.width?e:n),Koe="…",HL=(t,e,n,r,i,s,o,a)=>{var l=t.slice(0,e),c=cH({breakAll:n,style:r,children:l+Koe});if(!c)return[!1,[]];var d=dH(c.wordsWithComputedWidth,s,o,a),f=d.length>i||fH(d).width>Number(s);return[f,d]},Yoe=(t,e,n,r,i)=>{var s=t.maxLines,o=t.children,a=t.style,l=t.breakAll,c=Nt(s),d=String(o),f=dH(e,r,n,i);if(!c||i)return f;var m=f.length>s||fH(f).width>Number(r);if(!m)return f;for(var y=0,x=d.length-1,S=0,_;y<=x&&S<=d.length-1;){var w=Math.floor((y+x)/2),A=w-1,T=HL(d,A,l,a,s,r,n,i),C=zL(T,2),O=C[0],N=C[1],D=HL(d,w,l,a,s,r,n,i),F=zL(D,1),V=F[0];if(!O&&!V&&(y=w+1),O&&V&&(x=w-1),!O&&V){_=N;break}S++}return _||f},VL=t=>{var e=Hi(t)?[]:t.toString().split(lH);return[{words:e,width:void 0}]},Zoe=t=>{var e=t.width,n=t.scaleToFit,r=t.children,i=t.style,s=t.breakAll,o=t.maxLines;if((e||n)&&!Yy.isSsr){var a,l,c=cH({breakAll:s,children:r,style:i});if(c){var d=c.wordsWithComputedWidth,f=c.spaceWidth;a=d,l=f}else return VL(r);return Yoe({breakAll:s,children:r,maxLines:o,style:i},a,l,e,!!n)}return VL(r)},hH="#808080",Qoe={angle:0,breakAll:!1,capHeight:"0.71em",fill:hH,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},YR=R.forwardRef((t,e)=>{var n=Jo(t,Qoe),r=n.x,i=n.y,s=n.lineHeight,o=n.capHeight,a=n.fill,l=n.scaleToFit,c=n.textAnchor,d=n.verticalAnchor,f=FL(n,Boe),m=R.useMemo(()=>Zoe({breakAll:f.breakAll,children:f.children,maxLines:f.maxLines,scaleToFit:l,style:f.style,width:f.width}),[f.breakAll,f.children,f.maxLines,l,f.style,f.width]),y=f.dx,x=f.dy,S=f.angle,_=f.className,w=f.breakAll,A=FL(f,Hoe);if(!Il(r)||!Il(i)||m.length===0)return null;var T=Number(r)+(Nt(y)?y:0),C=Number(i)+(Nt(x)?x:0);if(!wn(T)||!wn(C))return null;var O;switch(d){case"start":O=FE("calc(".concat(o,")"));break;case"middle":O=FE("calc(".concat((m.length-1)/2," * -").concat(s," + (").concat(o," / 2))"));break;default:O=FE("calc(".concat(m.length-1," * -").concat(s,")"));break}var N=[],D=m[0];if(l&&D!=null){var F=D.width,V=f.width;N.push("scale(".concat(Nt(V)&&Nt(F)?V/F:1,")"))}return S&&N.push("rotate(".concat(S,", ").concat(T,", ").concat(C,")")),N.length&&(A.transform=N.join(" ")),R.createElement("text",PC({},Ko(A),{ref:e,x:T,y:C,className:er("recharts-text",_),textAnchor:c,fill:a.includes("url")?hH:a}),m.map((k,j)=>{var H=k.words.join(w?"":" ");return R.createElement("tspan",{x:T,dy:j===0?O:s,key:"".concat(H,"-").concat(j)},H)}))});YR.displayName="Text";function GL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function pl(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?GL(Object(n),!0).forEach(function(r){Joe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):GL(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Joe(t,e,n){return(e=eae(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function eae(t){var e=tae(t,"string");return typeof e=="symbol"?e:e+""}function tae(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var nae=t=>{var e=t.viewBox,n=t.position,r=t.offset,i=r===void 0?0:r,s=t.parentViewBox,o=GP(e),a=o.x,l=o.y,c=o.height,d=o.upperWidth,f=o.lowerWidth,m=a,y=a+(d-f)/2,x=(m+y)/2,S=(d+f)/2,_=m+d/2,w=c>=0?1:-1,A=w*i,T=w>0?"end":"start",C=w>0?"start":"end",O=d>=0?1:-1,N=O*i,D=O>0?"end":"start",F=O>0?"start":"end",V=s;if(n==="top"){var k={x:m+d/2,y:l-A,horizontalAnchor:"middle",verticalAnchor:T};return V&&(k.height=Math.max(l-V.y,0),k.width=d),k}if(n==="bottom"){var j={x:y+f/2,y:l+c+A,horizontalAnchor:"middle",verticalAnchor:C};return V&&(j.height=Math.max(V.y+V.height-(l+c),0),j.width=f),j}if(n==="left"){var H={x:x-N,y:l+c/2,horizontalAnchor:D,verticalAnchor:"middle"};return V&&(H.width=Math.max(H.x-V.x,0),H.height=c),H}if(n==="right"){var ne={x:x+S+N,y:l+c/2,horizontalAnchor:F,verticalAnchor:"middle"};return V&&(ne.width=Math.max(V.x+V.width-ne.x,0),ne.height=c),ne}var te=V?{width:S,height:c}:{};return n==="insideLeft"?pl({x:x+N,y:l+c/2,horizontalAnchor:F,verticalAnchor:"middle"},te):n==="insideRight"?pl({x:x+S-N,y:l+c/2,horizontalAnchor:D,verticalAnchor:"middle"},te):n==="insideTop"?pl({x:m+d/2,y:l+A,horizontalAnchor:"middle",verticalAnchor:C},te):n==="insideBottom"?pl({x:y+f/2,y:l+c-A,horizontalAnchor:"middle",verticalAnchor:T},te):n==="insideTopLeft"?pl({x:m+N,y:l+A,horizontalAnchor:F,verticalAnchor:C},te):n==="insideTopRight"?pl({x:m+d-N,y:l+A,horizontalAnchor:D,verticalAnchor:C},te):n==="insideBottomLeft"?pl({x:y+N,y:l+c-A,horizontalAnchor:F,verticalAnchor:T},te):n==="insideBottomRight"?pl({x:y+f-N,y:l+c-A,horizontalAnchor:D,verticalAnchor:T},te):n&&typeof n=="object"&&(Nt(n.x)||Rh(n.x))&&(Nt(n.y)||Rh(n.y))?pl({x:a+Ad(n.x,S),y:l+Ad(n.y,c),horizontalAnchor:"end",verticalAnchor:"end"},te):pl({x:_,y:l+c/2,horizontalAnchor:"middle",verticalAnchor:"middle"},te)},rae=["labelRef"],iae=["content"];function WL(t,e){if(t==null)return{};var n,r,i=sae(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function sae(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function $L(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function U0(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?$L(Object(n),!0).forEach(function(r){oae(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):$L(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function oae(t,e,n){return(e=aae(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function aae(t){var e=lae(t,"string");return typeof e=="symbol"?e:e+""}function lae(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Oc(){return Oc=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Oc.apply(null,arguments)}var pH=R.createContext(null),cae=t=>{var e=t.x,n=t.y,r=t.upperWidth,i=t.lowerWidth,s=t.width,o=t.height,a=t.children,l=R.useMemo(()=>({x:e,y:n,upperWidth:r,lowerWidth:i,width:s,height:o}),[e,n,r,i,s,o]);return R.createElement(pH.Provider,{value:l},a)},mH=()=>{var t=R.useContext(pH),e=pS();return t||(e?GP(e):void 0)},uae=R.createContext(null),dae=()=>{var t=R.useContext(uae),e=zt(iz);return t||e},fae=t=>{var e=t.value,n=t.formatter,r=Hi(t.children)?e:t.children;return typeof n=="function"?n(r):r},ZR=t=>t!=null&&typeof t=="function",hae=(t,e)=>{var n=Wo(e-t),r=Math.min(Math.abs(e-t),360);return n*r},pae=(t,e,n,r,i)=>{var s=t.offset,o=t.className,a=i.cx,l=i.cy,c=i.innerRadius,d=i.outerRadius,f=i.startAngle,m=i.endAngle,y=i.clockWise,x=(c+d)/2,S=hae(f,m),_=S>=0?1:-1,w,A;switch(e){case"insideStart":w=f+_*s,A=y;break;case"insideEnd":w=m-_*s,A=!y;break;case"end":w=m+_*s,A=y;break;default:throw new Error("Unsupported position ".concat(e))}A=S<=0?A:!A;var T=zi(a,l,x,w),C=zi(a,l,x,w+(A?1:-1)*359),O="M".concat(T.x,",").concat(T.y,`
|
||
A`).concat(x,",").concat(x,",0,1,").concat(A?0:1,`,
|
||
`).concat(C.x,",").concat(C.y),N=Hi(t.id)?ly("recharts-radial-line-"):t.id;return R.createElement("text",Oc({},r,{dominantBaseline:"central",className:er("recharts-radial-bar-label",o)}),R.createElement("defs",null,R.createElement("path",{id:N,d:O})),R.createElement("textPath",{xlinkHref:"#".concat(N)},n))},mae=(t,e,n)=>{var r=t.cx,i=t.cy,s=t.innerRadius,o=t.outerRadius,a=t.startAngle,l=t.endAngle,c=(a+l)/2;if(n==="outside"){var d=zi(r,i,o+e,c),f=d.x,m=d.y;return{x:f,y:m,textAnchor:f>=r?"start":"end",verticalAnchor:"middle"}}if(n==="center")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"middle"};if(n==="centerTop")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"start"};if(n==="centerBottom")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"end"};var y=(s+o)/2,x=zi(r,i,y,c),S=x.x,_=x.y;return{x:S,y:_,textAnchor:"middle",verticalAnchor:"middle"}},V_=t=>t!=null&&"cx"in t&&Nt(t.cx),gae={angle:0,offset:5,zIndex:Ms.label,position:"middle",textBreakAll:!1};function vae(t){if(!V_(t))return t;var e=t.cx,n=t.cy,r=t.outerRadius,i=r*2;return{x:e-r,y:n-r,width:i,upperWidth:i,lowerWidth:i,height:i}}function ld(t){var e=Jo(t,gae),n=e.viewBox,r=e.parentViewBox,i=e.position,s=e.value,o=e.children,a=e.content,l=e.className,c=l===void 0?"":l,d=e.textBreakAll,f=e.labelRef,m=dae(),y=mH(),x=i==="center"?y:m??y,S,_,w;n==null?S=x:V_(n)?S=n:S=GP(n);var A=vae(S);if(!S||Hi(s)&&Hi(o)&&!R.isValidElement(a)&&typeof a!="function")return null;var T=U0(U0({},e),{},{viewBox:S});if(R.isValidElement(a)){T.labelRef;var C=WL(T,rae);return R.cloneElement(a,C)}if(typeof a=="function"){T.content;var O=WL(T,iae);if(_=R.createElement(a,O),R.isValidElement(_))return _}else _=fae(e);var N=Ko(e);if(V_(S)){if(i==="insideStart"||i==="insideEnd"||i==="end")return pae(e,i,_,N,S);w=mae(S,e.offset,e.position)}else{if(!A)return null;var D=nae({viewBox:A,position:i,offset:e.offset,parentViewBox:V_(r)?void 0:r});w=U0(U0({x:D.x,y:D.y,textAnchor:D.horizontalAnchor,verticalAnchor:D.verticalAnchor},D.width!==void 0?{width:D.width}:{}),D.height!==void 0?{height:D.height}:{})}return R.createElement(au,{zIndex:e.zIndex},R.createElement(YR,Oc({ref:f,className:er("recharts-label",c)},N,w,{textAnchor:uH(N.textAnchor)?N.textAnchor:w.textAnchor,breakAll:d}),_))}ld.displayName="Label";var yae=(t,e,n)=>{if(!t)return null;var r={viewBox:e,labelRef:n};return t===!0?R.createElement(ld,Oc({key:"label-implicit"},r)):Il(t)?R.createElement(ld,Oc({key:"label-implicit",value:t},r)):R.isValidElement(t)?t.type===ld?R.cloneElement(t,U0({key:"label-implicit"},r)):R.createElement(ld,Oc({key:"label-implicit",content:t},r)):ZR(t)?R.createElement(ld,Oc({key:"label-implicit",content:t},r)):t&&typeof t=="object"?R.createElement(ld,Oc({},t,{key:"label-implicit"},r)):null};function xae(t){var e=t.label,n=t.labelRef,r=mH();return yae(e,r,n)||null}var bae=["valueAccessor"],_ae=["dataKey","clockWise","id","textBreakAll","zIndex"];function Hw(){return Hw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Hw.apply(null,arguments)}function XL(t,e){if(t==null)return{};var n,r,i=wae(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function wae(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var Sae=t=>{var e=Array.isArray(t.value)?t.value[t.value.length-1]:t.value;if(qoe(e))return e},gH=R.createContext(void 0),Mae=gH.Provider,vH=R.createContext(void 0);vH.Provider;function Eae(){return R.useContext(gH)}function Aae(){return R.useContext(vH)}function G_(t){var e=t.valueAccessor,n=e===void 0?Sae:e,r=XL(t,bae),i=r.dataKey;r.clockWise;var s=r.id,o=r.textBreakAll,a=r.zIndex,l=XL(r,_ae),c=Eae(),d=Aae(),f=c||d;return!f||!f.length?null:R.createElement(au,{zIndex:a??Ms.label},R.createElement(Yo,{className:"recharts-label-list"},f.map((m,y)=>{var x,S=Hi(i)?n(m,y):yi(m.payload,i),_=Hi(s)?{}:{id:"".concat(s,"-").concat(y)};return R.createElement(ld,Hw({key:"label-".concat(y)},Ko(m),l,_,{fill:(x=r.fill)!==null&&x!==void 0?x:m.fill,parentViewBox:m.parentViewBox,value:S,textBreakAll:o,viewBox:m.viewBox,index:y,zIndex:0}))})))}G_.displayName="LabelList";function Tae(t){var e=t.label;return e?e===!0?R.createElement(G_,{key:"labelList-implicit"}):R.isValidElement(e)||ZR(e)?R.createElement(G_,{key:"labelList-implicit",content:e}):typeof e=="object"?R.createElement(G_,Hw({key:"labelList-implicit"},e,{type:String(e.type)})):null:null}function RC(){return RC=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},RC.apply(null,arguments)}var yH=t=>{var e=t.cx,n=t.cy,r=t.r,i=t.className,s=er("recharts-dot",i);return Nt(e)&&Nt(n)&&Nt(r)?R.createElement("circle",RC({},za(t),OP(t),{className:s,cx:e,cy:n,r})):null},Cae={radiusAxis:{},angleAxis:{}},xH=cs({name:"polarAxis",initialState:Cae,reducers:{addRadiusAxis(t,e){t.radiusAxis[e.payload.id]=e.payload},removeRadiusAxis(t,e){delete t.radiusAxis[e.payload.id]},addAngleAxis(t,e){t.angleAxis[e.payload.id]=e.payload},removeAngleAxis(t,e){delete t.angleAxis[e.payload.id]}}}),US=xH.actions;US.addRadiusAxis;US.removeRadiusAxis;US.addAngleAxis;US.removeAngleAxis;var Pae=xH.reducer;function Rae(t){return t&&typeof t=="object"&&"className"in t&&typeof t.className=="string"?t.className:""}var bH=t=>t&&typeof t=="object"&&"clipDot"in t?!!t.clipDot:!0;function qL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function KL(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?qL(Object(n),!0).forEach(function(r){Nae(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):qL(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Nae(t,e,n){return(e=Iae(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Iae(t){var e=kae(t,"string");return typeof e=="symbol"?e:e+""}function kae(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function _H(t,e){return KL(KL({},e),t)}function Oae(t){return R.isValidElement(t)?t.props:t}function Lae(t,e){return R.cloneElement(t,_H(Oae(t),e))}function Dae(t){if("index"in t){var e=t.index;return typeof e=="number"||typeof e=="string"?e:void 0}}function Uae(t){return"isActive"in t&&t.isActive===!0}function jae(t){var e=t.option,n=t.DefaultShape,r=t.shapeProps,i=t.activeClassName,s=i===void 0?"recharts-active-shape":i,o=t.inActiveClassName,a=o===void 0?"recharts-shape":o,l=Dae(r),c;return R.isValidElement(e)?c=Lae(e,r):e===n?c=R.createElement(n,r):typeof e=="function"?c=e(r,l):typeof e=="object"?c=R.createElement(n,_H(e,r)):c=R.createElement(n,r),Uae(r)?R.createElement(Yo,{className:s},c):R.createElement(Yo,{className:a},c)}function Fae(t){var e=t.tooltipEntrySettings,n=Wr(),r=Qs(),i=R.useRef(null);return R.useLayoutEffect(()=>{r||(i.current===null?n(Kre(e)):i.current!==e&&n(Yre({prev:i.current,next:e})),i.current=e)},[e,n,r]),R.useLayoutEffect(()=>()=>{i.current&&(n(Zre(i.current)),i.current=null)},[n]),null}function zae(t){var e=t.legendPayload,n=Wr(),r=Qs(),i=R.useRef(null);return R.useLayoutEffect(()=>{r||(i.current===null?n(SZ(e)):i.current!==e&&n(MZ({prev:i.current,next:e})),i.current=e)},[n,r,e]),R.useLayoutEffect(()=>()=>{i.current&&(n(EZ(i.current)),i.current=null)},[n]),null}function Bae(t,e){return Wae(t)||Gae(t,e)||Vae(t,e)||Hae()}function Hae(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Vae(t,e){if(t){if(typeof t=="string")return YL(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?YL(t,e):void 0}}function YL(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Gae(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function Wae(t){if(Array.isArray(t))return t}var QR="index",$ae="append";function JR(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],r=[];for(var i of n)r.push({status:"removed",prev:i});for(var s=0;s<e.length;s++){var o=t[s],a=e[s];o!=null?r.push({status:"matched",prev:o,next:a}):r.push({status:"added",next:a})}return r}function Xae(t,e){var n=t.length/e.length,r=e.map((i,s)=>t[Math.floor(s*n)]);return JR(r,e)}function qae(t,e){var n=e.map((r,i)=>t[i]);return JR(n,e)}function Kae(t,e){for(var n=new Map,r=0;r<t.length;r++){var i=t[r];if(i!=null){var s=e(i,r);s!=null&&!n.has(s)&&n.set(s,i)}}return n}function Yae(t,e,n){var r=Kae(t,n),i=new Set,s=e.map((f,m)=>{var y=n(f,m);if(y!=null){var x=r.get(y);if(x!==void 0)return i.add(y),x}}),o=[];for(var a of r){var l=Bae(a,2),c=l[0],d=l[1];i.has(c)||o.push(d)}return JR(s,e,o)}function NC(t,e,n){return e==null?null:t==null?e.map(r=>({status:"added",next:r})):n===QR?Xae(t,e):n===$ae?qae(t,e):Yae(t,e,n)}function wH(t,e){var n=R.useRef(t),r=R.useRef(e.current),i=R.useRef(!0);n.current!==t&&(n.current=t,r.current=e.current,i.current=!1);var s=R.useCallback(function(o,a){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(a===0){i.current=!0;return}a===1&&(r.current=o),a>0&&i.current&&l&&(e.current=o)},[e]);return{startValue:r.current,syncStepValue:s}}function Zae(t,e){return tle(t)||ele(t,e)||Jae(t,e)||Qae()}function Qae(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Jae(t,e){if(t){if(typeof t=="string")return ZL(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ZL(t,e):void 0}}function ZL(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ele(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function tle(t){if(Array.isArray(t))return t}function nle(t,e){var n=R.useState(!1),r=Zae(n,2),i=r[0],s=r[1],o=R.useCallback(()=>{typeof t=="function"&&t(),s(!0)},[t]),a=R.useCallback(()=>{typeof e=="function"&&e(),s(!1)},[e]);return{isAnimating:i,handleAnimationStart:o,handleAnimationEnd:a}}function rle(t){var e,n=t.animationInput,r=t.animationIdPrefix,i=t.items,s=t.previousItemsRef,o=t.isAnimationActive,a=t.animationBegin,l=t.animationDuration,c=t.animationEasing,d=t.onAnimationStart,f=t.onAnimationEnd,m=t.animationInterpolateFn,y=t.animationMatchBy,x=t.shouldUpdatePreviousRef,S=t.children,_=t.layout,w=U4(n,r),A=wH(w,s),T=(e=A.startValue)!==null&&e!==void 0?e:null,C=NC(T,i,y??QR);return R.createElement(D4,{animationId:w,begin:a,duration:l,isActive:o,easing:c,onAnimationEnd:f,onAnimationStart:d,key:w},O=>{var N=T==null,D=i==null?i:m(C,O,_),F=x?x(O):O>0;return A.syncStepValue(D,O,F),D==null?null:S(D,O,N)})}var zE;function ile(t,e){return lle(t)||ale(t,e)||ole(t,e)||sle()}function sle(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ole(t,e){if(t){if(typeof t=="string")return QL(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?QL(t,e):void 0}}function QL(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ale(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function lle(t){if(Array.isArray(t))return t}var cle=()=>{var t=R.useState(()=>ly("uid-")),e=ile(t,1),n=e[0];return n},SH=(zE=B1.useId)!==null&&zE!==void 0?zE:cle;function ule(t,e){var n=SH();return e||(t?"".concat(t,"-").concat(n):n)}var dle=R.createContext(void 0),fle=t=>{var e=t.id,n=t.type,r=t.children,i=ule("recharts-".concat(n),e);return R.createElement(dle.Provider,{value:i},r(i))},hle={cartesianItems:[],polarItems:[]},MH=cs({name:"graphicalItems",initialState:hle,reducers:{addCartesianGraphicalItem:{reducer(t,e){t.cartesianItems.push(e.payload)},prepare:sr()},replaceCartesianGraphicalItem:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next,s=$o(t).cartesianItems.indexOf(r);s>-1&&(t.cartesianItems[s]=i)},prepare:sr()},removeCartesianGraphicalItem:{reducer(t,e){var n=$o(t).cartesianItems.indexOf(e.payload);n>-1&&t.cartesianItems.splice(n,1)},prepare:sr()},addPolarGraphicalItem:{reducer(t,e){t.polarItems.push(e.payload)},prepare:sr()},removePolarGraphicalItem:{reducer(t,e){var n=$o(t).polarItems.indexOf(e.payload);n>-1&&t.polarItems.splice(n,1)},prepare:sr()},replacePolarGraphicalItem:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next,s=$o(t).polarItems.indexOf(r);s>-1&&(t.polarItems[s]=i)},prepare:sr()}}}),Yg=MH.actions,ple=Yg.addCartesianGraphicalItem,mle=Yg.replaceCartesianGraphicalItem,gle=Yg.removeCartesianGraphicalItem;Yg.addPolarGraphicalItem;Yg.removePolarGraphicalItem;Yg.replacePolarGraphicalItem;var vle=MH.reducer,yle=t=>{var e=Wr(),n=R.useRef(null);return R.useLayoutEffect(()=>{n.current===null?e(ple(t)):n.current!==t&&e(mle({prev:n.current,next:t})),n.current=t},[e,t]),R.useLayoutEffect(()=>()=>{n.current&&(e(gle(n.current)),n.current=null)},[e]),null},xle=R.memo(yle),ble=["points"];function JL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function BE(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?JL(Object(n),!0).forEach(function(r){_le(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):JL(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function _le(t,e,n){return(e=wle(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function wle(t){var e=Sle(t,"string");return typeof e=="symbol"?e:e+""}function Sle(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Vw(){return Vw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Vw.apply(null,arguments)}function Mle(t,e){if(t==null)return{};var n,r,i=Ele(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Ele(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function Ale(t){var e=t.option,n=t.dotProps,r=t.className;if(R.isValidElement(e))return R.cloneElement(e,n);if(typeof e=="function")return e(n);var i=er(r,typeof e!="boolean"?e.className:""),s=n??{};s.points;var o=Mle(s,ble);return R.createElement(yH,Vw({},o,{className:i}))}function Tle(t,e){return t==null?!1:e?!0:t.length===1}function Cle(t){var e=t.points,n=t.dot,r=t.className,i=t.dotClassName,s=t.dataKey,o=t.baseProps,a=t.needClip,l=t.clipPathId,c=t.zIndex,d=c===void 0?Ms.scatter:c;if(!Tle(e,n))return null;var f=bH(n),m=cX(n),y=e.map((S,_)=>{var w,A,T=BE(BE(BE({r:3},o),m),{},{index:_,cx:(w=S.x)!==null&&w!==void 0?w:void 0,cy:(A=S.y)!==null&&A!==void 0?A:void 0,dataKey:s,value:S.value,payload:S.payload,points:e});return R.createElement(Ale,{key:"dot-".concat(_),option:n,dotProps:T,className:i})}),x={};return a&&l!=null&&(x.clipPath="url(#clipPath-".concat(f?"":"dots-").concat(l,")")),R.createElement(au,{zIndex:d},R.createElement(Yo,Vw({className:r},x),y))}function e3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function t3(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?e3(Object(n),!0).forEach(function(r){Ple(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):e3(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Ple(t,e,n){return(e=Rle(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Rle(t){var e=Nle(t,"string");return typeof e=="symbol"?e:e+""}function Nle(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var EH=0,Ile={xAxis:{},yAxis:{},zAxis:{}},AH=cs({name:"cartesianAxis",initialState:Ile,reducers:{addXAxis:{reducer(t,e){t.xAxis[e.payload.id]=e.payload},prepare:sr()},replaceXAxis:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next;t.xAxis[r.id]!==void 0&&(r.id!==i.id&&delete t.xAxis[r.id],t.xAxis[i.id]=i)},prepare:sr()},removeXAxis:{reducer(t,e){delete t.xAxis[e.payload.id]},prepare:sr()},addYAxis:{reducer(t,e){t.yAxis[e.payload.id]=e.payload},prepare:sr()},replaceYAxis:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next;t.yAxis[r.id]!==void 0&&(r.id!==i.id&&delete t.yAxis[r.id],t.yAxis[i.id]=i)},prepare:sr()},removeYAxis:{reducer(t,e){delete t.yAxis[e.payload.id]},prepare:sr()},addZAxis:{reducer(t,e){t.zAxis[e.payload.id]=e.payload},prepare:sr()},replaceZAxis:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next;t.zAxis[r.id]!==void 0&&(r.id!==i.id&&delete t.zAxis[r.id],t.zAxis[i.id]=i)},prepare:sr()},removeZAxis:{reducer(t,e){delete t.zAxis[e.payload.id]},prepare:sr()},updateYAxisWidth(t,e){var n=e.payload,r=n.id,i=n.width,s=t.yAxis[r];if(s){var o,a=s.widthHistory||[];if(a.length===3&&a[0]===a[2]&&i===a[1]&&i!==s.width&&Math.abs(i-((o=a[0])!==null&&o!==void 0?o:0))<=1)return;var l=[...a,i].slice(-3);t.yAxis[r]=t3(t3({},s),{},{width:i,widthHistory:l})}}}}),zl=AH.actions,kle=zl.addXAxis,Ole=zl.replaceXAxis,Lle=zl.removeXAxis,Dle=zl.addYAxis,Ule=zl.replaceYAxis,jle=zl.removeYAxis;zl.addZAxis;zl.replaceZAxis;zl.removeZAxis;var Fle=zl.updateYAxisWidth,zle=AH.reducer,Ble=Oe([Gi],t=>({top:t.top,bottom:t.bottom,left:t.left,right:t.right})),Hle=Oe([Ble,tu,nu],(t,e,n)=>{if(!(!t||e==null||n==null))return{x:t.left,y:t.top,width:Math.max(0,e-t.left-t.right),height:Math.max(0,n-t.top-t.bottom)}}),e2=()=>zt(Hle),Vle=()=>zt(Kie);function n3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function HE(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?n3(Object(n),!0).forEach(function(r){Gle(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):n3(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Gle(t,e,n){return(e=Wle(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Wle(t){var e=$le(t,"string");return typeof e=="symbol"?e:e+""}function $le(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Xle=t=>{var e=t.point,n=t.childIndex,r=t.mainColor,i=t.activeDot,s=t.dataKey,o=t.clipPath;if(i===!1||e.x==null||e.y==null)return null;var a={index:n,dataKey:s,cx:e.x,cy:e.y,r:4,fill:r??"none",strokeWidth:2,stroke:"#fff",payload:e.payload,value:e.value},l=HE(HE(HE({},a),Y1(i)),OP(i)),c;return R.isValidElement(i)?c=R.cloneElement(i,l):typeof i=="function"?c=i(l):c=R.createElement(yH,l),R.createElement(Yo,{className:"recharts-active-dot",clipPath:o},c)};function r3(t){var e=t.points,n=t.mainColor,r=t.activeDot,i=t.itemDataKey,s=t.clipPath,o=t.zIndex,a=o===void 0?Ms.activeDot:o,l=zt(_y),c=Vle();if(e==null||c==null)return null;var d=e.find(f=>c.includes(f.payload));return Hi(d)?null:R.createElement(au,{zIndex:a},R.createElement(Xle,{point:d,childIndex:Number(l),mainColor:n,dataKey:i,activeDot:r,clipPath:s}))}var qle=t=>{var e=t.chartData,n=Wr(),r=Qs();return R.useEffect(()=>r?()=>{}:(n(EL(e)),()=>{n(EL(void 0))}),[e,n,r]),null},i3={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},TH=cs({name:"brush",initialState:i3,reducers:{setBrushSettings(t,e){return e.payload==null?i3:e.payload}}});TH.actions.setBrushSettings;var Kle=TH.reducer;function Yle(t){return(t%180+180)%180}var Zle=function(e){var n=e.width,r=e.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=Yle(i),o=s*Math.PI/180,a=Math.atan(r/n),l=o>a&&o<Math.PI-a?r/Math.sin(o):n/Math.cos(o);return Math.abs(l)},Qle={dots:[],areas:[],lines:[]},CH=cs({name:"referenceElements",initialState:Qle,reducers:{addDot:(t,e)=>{t.dots.push(e.payload)},removeDot:(t,e)=>{var n=$o(t).dots.findIndex(r=>r===e.payload);n!==-1&&t.dots.splice(n,1)},addArea:(t,e)=>{t.areas.push(e.payload)},removeArea:(t,e)=>{var n=$o(t).areas.findIndex(r=>r===e.payload);n!==-1&&t.areas.splice(n,1)},addLine:(t,e)=>{t.lines.push(e.payload)},removeLine:(t,e)=>{var n=$o(t).lines.findIndex(r=>r===e.payload);n!==-1&&t.lines.splice(n,1)}}}),Zg=CH.actions;Zg.addDot;Zg.removeDot;Zg.addArea;Zg.removeArea;Zg.addLine;Zg.removeLine;var Jle=CH.reducer;function ece(t,e){return ice(t)||rce(t,e)||nce(t,e)||tce()}function tce(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function nce(t,e){if(t){if(typeof t=="string")return s3(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s3(t,e):void 0}}function s3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function rce(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function ice(t){if(Array.isArray(t))return t}var sce=R.createContext(void 0),oce=t=>{var e=t.children,n=R.useState("".concat(ly("recharts"),"-clip")),r=ece(n,1),i=r[0],s=e2();if(s==null)return null;var o=s.x,a=s.y,l=s.width,c=s.height;return R.createElement(sce.Provider,{value:i},R.createElement("defs",null,R.createElement("clipPath",{id:i},R.createElement("rect",{x:o,y:a,height:c,width:l}))),e)};function PH(t,e){if(e<1)return[];if(e===1)return t;for(var n=[],r=0;r<t.length;r+=e){var i=t[r];i!==void 0&&n.push(i)}return n}function ace(t,e,n){var r={width:t.width+e.width,height:t.height+e.height};return Zle(r,n)}function lce(t,e,n){var r=n==="width",i=t.x,s=t.y,o=t.width,a=t.height;return e===1?{start:r?i:s,end:r?i+o:s+a}:{start:r?i+o:s+a,end:r?i:s}}function Sy(t,e,n,r,i){if(t*e<t*r||t*e>t*i)return!1;var s=n();return t*(e-t*s/2-r)>=0&&t*(e+t*s/2-i)<=0}function cce(t,e){return PH(t,e+1)}function uce(t,e,n,r,i){for(var s=(r||[]).slice(),o=e.start,a=e.end,l=0,c=1,d=o,f=function(){var x=r==null?void 0:r[l];if(x===void 0)return{v:PH(r,c)};var S=l,_,w=()=>(_===void 0&&(_=n(x,S)),_),A=x.coordinate,T=l===0||Sy(t,A,w,d,a);T||(l=0,d=o,c+=1),T&&(d=A+t*(w()/2+i),l+=c)},m;c<=s.length;)if(m=f(),m)return m.v;return[]}function dce(t,e,n,r,i){var s=(r||[]).slice(),o=s.length;if(o===0)return[];for(var a=e.start,l=e.end,c=1;c<=o;c++){for(var d=(o-1)%c,f=a,m=!0,y=function(){var C=r[S];if(C==null)return 0;var O=S,N,D=()=>(N===void 0&&(N=n(C,O)),N),F=C.coordinate,V=S===d||Sy(t,F,D,f,l);if(!V)return m=!1,1;V&&(f=F+t*(D()/2+i))},x,S=d;S<o&&(x=y(),!(x!==0&&x===1));S+=c);if(m){for(var _=[],w=d;w<o;w+=c){var A=r[w];A!=null&&_.push(A)}return _}}return[]}function o3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ns(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?o3(Object(n),!0).forEach(function(r){fce(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):o3(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function fce(t,e,n){return(e=hce(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function hce(t){var e=pce(t,"string");return typeof e=="symbol"?e:e+""}function pce(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function mce(t,e,n,r,i){for(var s=(r||[]).slice(),o=s.length,a=e.start,l=e.end,c=function(m){var y=s[m];if(y==null)return 1;var x=y,S,_=()=>(S===void 0&&(S=n(y,m)),S);if(m===o-1){var w=t*(x.coordinate+t*_()/2-l);s[m]=x=ns(ns({},x),{},{tickCoord:w>0?x.coordinate-w*t:x.coordinate})}else s[m]=x=ns(ns({},x),{},{tickCoord:x.coordinate});if(x.tickCoord!=null){var A=Sy(t,x.tickCoord,_,a,l);A&&(l=x.tickCoord-t*(_()/2+i),s[m]=ns(ns({},x),{},{isShow:!0}))}},d=o-1;d>=0;d--)c(d);return s}function gce(t,e,n,r,i,s){var o=(r||[]).slice(),a=o.length,l=e.start,c=e.end;if(s){var d=r[a-1];if(d!=null){var f=n(d,a-1),m=t*(d.coordinate+t*f/2-c);if(o[a-1]=d=ns(ns({},d),{},{tickCoord:m>0?d.coordinate-m*t:d.coordinate}),d.tickCoord!=null){var y=Sy(t,d.tickCoord,()=>f,l,c);y&&(c=d.tickCoord-t*(f/2+i),o[a-1]=ns(ns({},d),{},{isShow:!0}))}}}for(var x=s?a-1:a,S=function(A){var T=o[A];if(T==null)return 1;var C=T,O,N=()=>(O===void 0&&(O=n(T,A)),O);if(A===0){var D=t*(C.coordinate-t*N()/2-l);o[A]=C=ns(ns({},C),{},{tickCoord:D<0?C.coordinate-D*t:C.coordinate})}else o[A]=C=ns(ns({},C),{},{tickCoord:C.coordinate});if(C.tickCoord!=null){var F=Sy(t,C.tickCoord,N,l,c);F&&(l=C.tickCoord+t*(N()/2+i),o[A]=ns(ns({},C),{},{isShow:!0}))}},_=0;_<x;_++)S(_);return o}function t2(t,e,n){var r=t.tick,i=t.ticks,s=t.viewBox,o=t.minTickGap,a=t.orientation,l=t.interval,c=t.tickFormatter,d=t.unit,f=t.angle;if(!i||!i.length||!r)return[];if(Nt(l)||Yy.isSsr){var m;return(m=cce(i,Nt(l)?l:0))!==null&&m!==void 0?m:[]}var y=[],x=a==="top"||a==="bottom"?"width":"height",S=d&&x==="width"?V0(d,{fontSize:e,letterSpacing:n}):{width:0,height:0},_=(O,N)=>{var D=typeof c=="function"?c(O.value,N):O.value;return x==="width"?ace(V0(D,{fontSize:e,letterSpacing:n}),S,f):V0(D,{fontSize:e,letterSpacing:n})[x]},w=i[0],A=i[1],T=i.length>=2&&w!=null&&A!=null?Wo(A.coordinate-w.coordinate):1,C=lce(s,T,x);return l==="equidistantPreserveStart"?uce(T,C,_,i,o):l==="equidistantPreserveEnd"?dce(T,C,_,i,o):(l==="preserveStart"||l==="preserveStartEnd"?y=gce(T,C,_,i,o,l==="preserveStartEnd"):y=mce(T,C,_,i,o),y.filter(O=>O.isShow))}var vce=t=>{var e=t.ticks,n=t.label,r=t.labelGapWithTick,i=r,s=t.tickSize,o=s===void 0?0:s,a=t.tickMargin,l=a===void 0?0:a,c=0;if(e){Array.from(e).forEach(y=>{if(y){var x=y.getBoundingClientRect();x.width>c&&(c=x.width)}});var d=n?n.getBoundingClientRect().width:0,f=o+l,m=c+f+d+(n?i:0);return Math.round(m)}return 0},yce={xAxis:{},yAxis:{}},RH=cs({name:"renderedTicks",initialState:yce,reducers:{setRenderedTicks:(t,e)=>{var n=e.payload,r=n.axisType,i=n.axisId,s=n.ticks;t[r][i]=s},removeRenderedTicks:(t,e)=>{var n=e.payload,r=n.axisType,i=n.axisId;delete t[r][i]}}}),NH=RH.actions,xce=NH.setRenderedTicks,bce=NH.removeRenderedTicks,_ce=RH.reducer,wce=["axisLine","width","height","className","hide","ticks","axisType","axisId"];function a3(t,e){return Ace(t)||Ece(t,e)||Mce(t,e)||Sce()}function Sce(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mce(t,e){if(t){if(typeof t=="string")return l3(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l3(t,e):void 0}}function l3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ece(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function Ace(t){if(Array.isArray(t))return t}function Tce(t,e){if(t==null)return{};var n,r,i=Cce(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Cce(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function Dh(){return Dh=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Dh.apply(null,arguments)}function c3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Er(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?c3(Object(n),!0).forEach(function(r){Pce(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):c3(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Pce(t,e,n){return(e=Rce(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Rce(t){var e=Nce(t,"string");return typeof e=="symbol"?e:e+""}function Nce(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Gc={x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd",zIndex:Ms.axis};function Ice(t){var e=t.x,n=t.y,r=t.width,i=t.height,s=t.orientation,o=t.mirror,a=t.axisLine,l=t.otherSvgProps;if(!a)return null;var c=Er(Er(Er({},l),za(a)),{},{fill:"none"});if(s==="top"||s==="bottom"){var d=+(s==="top"&&!o||s==="bottom"&&o);c=Er(Er({},c),{},{x1:e,y1:n+d*i,x2:e+r,y2:n+d*i})}else{var f=+(s==="left"&&!o||s==="right"&&o);c=Er(Er({},c),{},{x1:e+f*r,y1:n,x2:e+f*r,y2:n+i})}return R.createElement("line",Dh({},c,{className:er("recharts-cartesian-axis-line",Kh(a,"className"))}))}function kce(t,e,n,r,i,s,o,a,l){var c,d,f,m,y,x,S=a?-1:1,_=t.tickSize||o,w=Nt(t.tickCoord)?t.tickCoord:t.coordinate;switch(s){case"top":c=d=t.coordinate,m=n+ +!a*i,f=m-S*_,x=f-S*l,y=w;break;case"left":f=m=t.coordinate,d=e+ +!a*r,c=d-S*_,y=c-S*l,x=w;break;case"right":f=m=t.coordinate,d=e+ +a*r,c=d+S*_,y=c+S*l,x=w;break;default:c=d=t.coordinate,m=n+ +a*i,f=m+S*_,x=f+S*l,y=w;break}return{line:{x1:c,y1:f,x2:d,y2:m},tick:{x:y,y:x}}}function Oce(t,e){switch(t){case"left":return e?"start":"end";case"right":return e?"end":"start";default:return"middle"}}function Lce(t,e){switch(t){case"left":case"right":return"middle";case"top":return e?"start":"end";default:return e?"end":"start"}}function Dce(t){var e=t.option,n=t.tickProps,r=t.value,i,s=er(n.className,"recharts-cartesian-axis-tick-value");if(R.isValidElement(e))i=R.cloneElement(e,Er(Er({},n),{},{className:s}));else if(typeof e=="function")i=e(Er(Er({},n),{},{className:s}));else{var o="recharts-cartesian-axis-tick-value";typeof e!="boolean"&&(o=er(o,Rae(e))),i=R.createElement(YR,Dh({},n,{className:o}),r)}return i}function Uce(t){var e=t.ticks,n=t.axisType,r=t.axisId,i=Wr();return R.useEffect(()=>{if(r==null||n==null)return zg;var s=e.map(o=>({value:o.value,coordinate:o.coordinate,offset:o.offset,index:o.index}));return i(xce({ticks:s,axisId:r,axisType:n})),()=>{i(bce({axisId:r,axisType:n}))}},[i,e,r,n]),null}var jce=R.forwardRef((t,e)=>{var n=t.ticks,r=n===void 0?[]:n,i=t.tick,s=t.tickLine,o=t.stroke,a=t.tickFormatter,l=t.unit,c=t.padding,d=t.tickTextProps,f=t.orientation,m=t.mirror,y=t.x,x=t.y,S=t.width,_=t.height,w=t.tickSize,A=t.tickMargin,T=t.fontSize,C=t.letterSpacing,O=t.getTicksConfig,N=t.events,D=t.axisType,F=t.axisId,V=t2(Er(Er({},O),{},{ticks:r}),T,C),k=za(O),j=Y1(i),H=uH(k.textAnchor)?k.textAnchor:Oce(f,m),ne=Lce(f,m),te={};typeof s=="object"&&(te=s);var pe=Er(Er({},k),{},{fill:"none"},te),oe=V.map(K=>Er({entry:K},kce(K,y,x,S,_,f,w,m,A))),ce=oe.map(K=>{var q=K.entry,$=K.line;return R.createElement(Yo,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(q.value,"-").concat(q.coordinate,"-").concat(q.tickCoord)},s&&R.createElement("line",Dh({},pe,$,{className:er("recharts-cartesian-axis-tick-line",Kh(s,"className"))})))}),B=oe.map((K,q)=>{var $,Z,ge=K.entry,ae=K.tick,fe=Er(Er(Er(Er({verticalAnchor:ne},k),{},{textAnchor:H,stroke:"none",fill:o},ae),{},{index:q,payload:ge,visibleTicksCount:V.length,tickFormatter:a,padding:c},d),{},{angle:($=(Z=d==null?void 0:d.angle)!==null&&Z!==void 0?Z:k.angle)!==null&&$!==void 0?$:0}),_e=Er(Er({},fe),j);return R.createElement(Yo,Dh({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(ge.value,"-").concat(ge.coordinate,"-").concat(ge.tickCoord)},HX(N,ge,q)),i&&R.createElement(Dce,{option:i,tickProps:_e,value:"".concat(typeof a=="function"?a(ge.value,q):ge.value).concat(l||"")}))});return R.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(D,"-ticks")},R.createElement(Uce,{ticks:V,axisId:F,axisType:D}),B.length>0&&R.createElement(au,{zIndex:Ms.label},R.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(D,"-tick-labels"),ref:e},B)),ce.length>0&&R.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(D,"-tick-lines")},ce))}),Fce=R.forwardRef((t,e)=>{var n=t.axisLine,r=t.width,i=t.height,s=t.className,o=t.hide,a=t.ticks,l=t.axisType,c=t.axisId,d=Tce(t,wce),f=R.useState(""),m=a3(f,2),y=m[0],x=m[1],S=R.useState(""),_=a3(S,2),w=_[0],A=_[1],T=R.useRef(null);R.useImperativeHandle(e,()=>({getCalculatedWidth:()=>{var O;return vce({ticks:T.current,label:(O=t.labelRef)===null||O===void 0?void 0:O.current,labelGapWithTick:5,tickSize:t.tickSize,tickMargin:t.tickMargin})}}));var C=R.useCallback(O=>{if(O){var N=O.getElementsByClassName("recharts-cartesian-axis-tick-value");T.current=N;var D=N[0];if(D){var F=window.getComputedStyle(D),V=F.fontSize,k=F.letterSpacing;(V!==y||k!==w)&&(x(V),A(k))}}},[y,w]);return o||r!=null&&r<=0||i!=null&&i<=0?null:R.createElement(au,{zIndex:t.zIndex},R.createElement(Yo,{className:er("recharts-cartesian-axis",s)},R.createElement(Ice,{x:t.x,y:t.y,width:r,height:i,orientation:t.orientation,mirror:t.mirror,axisLine:n,otherSvgProps:za(t)}),R.createElement(jce,{ref:C,axisType:l,events:d,fontSize:y,getTicksConfig:t,height:t.height,letterSpacing:w,mirror:t.mirror,orientation:t.orientation,padding:t.padding,stroke:t.stroke,tick:t.tick,tickFormatter:t.tickFormatter,tickLine:t.tickLine,tickMargin:t.tickMargin,tickSize:t.tickSize,tickTextProps:t.tickTextProps,ticks:a,unit:t.unit,width:t.width,x:t.x,y:t.y,axisId:c}),R.createElement(cae,{x:t.x,y:t.y,width:t.width,height:t.height,lowerWidth:t.width,upperWidth:t.width},R.createElement(xae,{label:t.label,labelRef:t.labelRef}),t.children)))}),n2=R.forwardRef((t,e)=>{var n=Jo(t,Gc);return R.createElement(Fce,Dh({},n,{ref:e}))});n2.displayName="CartesianAxis";var zce=["x1","y1","x2","y2","key"],Bce=["offset"],Hce=["xAxisId","yAxisId"],Vce=["xAxisId","yAxisId"];function u3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function rs(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?u3(Object(n),!0).forEach(function(r){Gce(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):u3(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Gce(t,e,n){return(e=Wce(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Wce(t){var e=$ce(t,"string");return typeof e=="symbol"?e:e+""}function $ce(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function rh(){return rh=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},rh.apply(null,arguments)}function Gw(t,e){if(t==null)return{};var n,r,i=Xce(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Xce(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var qce=t=>{var e=t.fill;if(!e||e==="none")return null;var n=t.fillOpacity,r=t.x,i=t.y,s=t.width,o=t.height,a=t.ry;return R.createElement("rect",{x:r,y:i,ry:a,width:s,height:o,stroke:"none",fill:e,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function IH(t){var e=t.option,n=t.lineItemProps,r;if(R.isValidElement(e))r=R.cloneElement(e,n);else if(typeof e=="function")r=e(n);else{var i,s=n.x1,o=n.y1,a=n.x2,l=n.y2,c=n.key,d=Gw(n,zce),f=(i=za(d))!==null&&i!==void 0?i:{};f.offset;var m=Gw(f,Bce);r=R.createElement("line",rh({},m,{x1:s,y1:o,x2:a,y2:l,fill:"none",key:c}))}return r}function Kce(t){var e=t.x,n=t.width,r=t.horizontal,i=r===void 0?!0:r,s=t.horizontalPoints;if(!i||!s||!s.length)return null;t.xAxisId,t.yAxisId;var o=Gw(t,Hce),a=s.map((l,c)=>{var d=rs(rs({},o),{},{x1:e,y1:l,x2:e+n,y2:l,key:"line-".concat(c),index:c});return R.createElement(IH,{key:"line-".concat(c),option:i,lineItemProps:d})});return R.createElement("g",{className:"recharts-cartesian-grid-horizontal"},a)}function Yce(t){var e=t.y,n=t.height,r=t.vertical,i=r===void 0?!0:r,s=t.verticalPoints;if(!i||!s||!s.length)return null;t.xAxisId,t.yAxisId;var o=Gw(t,Vce),a=s.map((l,c)=>{var d=rs(rs({},o),{},{x1:l,y1:e,x2:l,y2:e+n,key:"line-".concat(c),index:c});return R.createElement(IH,{option:i,lineItemProps:d,key:"line-".concat(c)})});return R.createElement("g",{className:"recharts-cartesian-grid-vertical"},a)}function Zce(t){var e=t.horizontalFill,n=t.fillOpacity,r=t.x,i=t.y,s=t.width,o=t.height,a=t.horizontalPoints,l=t.horizontal,c=l===void 0?!0:l;if(!c||!e||!e.length||a==null)return null;var d=a.map(m=>Math.round(m+i-i)).sort((m,y)=>m-y);i!==d[0]&&d.unshift(0);var f=d.map((m,y)=>{var x=d[y+1],S=x==null,_=S?i+o-m:x-m;if(_<=0)return null;var w=y%e.length;return R.createElement("rect",{key:"react-".concat(y),y:m,x:r,height:_,width:s,stroke:"none",fill:e[w],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return R.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function Qce(t){var e=t.vertical,n=e===void 0?!0:e,r=t.verticalFill,i=t.fillOpacity,s=t.x,o=t.y,a=t.width,l=t.height,c=t.verticalPoints;if(!n||!r||!r.length)return null;var d=c.map(m=>Math.round(m+s-s)).sort((m,y)=>m-y);s!==d[0]&&d.unshift(0);var f=d.map((m,y)=>{var x=d[y+1],S=x==null,_=S?s+a-m:x-m;if(_<=0)return null;var w=y%r.length;return R.createElement("rect",{key:"react-".concat(y),x:m,y:o,width:_,height:l,stroke:"none",fill:r[w],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return R.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var Jce=(t,e)=>{var n=t.xAxis,r=t.width,i=t.height,s=t.offset;return f4(t2(rs(rs(rs({},Gc),n),{},{ticks:h4(n),viewBox:{x:0,y:0,width:r,height:i}})),s.left,s.left+s.width,e)},eue=(t,e)=>{var n=t.yAxis,r=t.width,i=t.height,s=t.offset;return f4(t2(rs(rs(rs({},Gc),n),{},{ticks:h4(n),viewBox:{x:0,y:0,width:r,height:i}})),s.top,s.top+s.height,e)},tue={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:Ms.grid};function kH(t){var e=_4(),n=w4(),r=b4(),i=rs(rs({},Jo(t,tue)),{},{x:Nt(t.x)?t.x:r.left,y:Nt(t.y)?t.y:r.top,width:Nt(t.width)?t.width:r.width,height:Nt(t.height)?t.height:r.height}),s=i.xAxisId,o=i.yAxisId,a=i.x,l=i.y,c=i.width,d=i.height,f=i.syncWithTicks,m=i.horizontalValues,y=i.verticalValues,x=Qs(),S=zt(V=>fL(V,"xAxis",s,x)),_=zt(V=>fL(V,"yAxis",o,x));if(!kl(c)||!kl(d)||!Nt(a)||!Nt(l))return null;var w=i.verticalCoordinatesGenerator||Jce,A=i.horizontalCoordinatesGenerator||eue,T=i.horizontalPoints,C=i.verticalPoints;if((!T||!T.length)&&typeof A=="function"){var O=m&&m.length,N=A({yAxis:_?rs(rs({},_),{},{ticks:O?m:_.ticks}):void 0,width:e??c,height:n??d,offset:r},O?!0:f);gw(Array.isArray(N),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof N,"]")),Array.isArray(N)&&(T=N)}if((!C||!C.length)&&typeof w=="function"){var D=y&&y.length,F=w({xAxis:S?rs(rs({},S),{},{ticks:D?y:S.ticks}):void 0,width:e??c,height:n??d,offset:r},D?!0:f);gw(Array.isArray(F),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof F,"]")),Array.isArray(F)&&(C=F)}return R.createElement(au,{zIndex:i.zIndex},R.createElement("g",{className:"recharts-cartesian-grid"},R.createElement(qce,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),R.createElement(Zce,rh({},i,{horizontalPoints:T})),R.createElement(Qce,rh({},i,{verticalPoints:C})),R.createElement(Kce,rh({},i,{offset:r,horizontalPoints:T,xAxis:S,yAxis:_})),R.createElement(Yce,rh({},i,{offset:r,verticalPoints:C,xAxis:S,yAxis:_}))))}kH.displayName="CartesianGrid";var nue={},OH=cs({name:"errorBars",initialState:nue,reducers:{addErrorBar:(t,e)=>{var n=e.payload,r=n.itemId,i=n.errorBar;t[r]||(t[r]=[]),t[r].push(i)},replaceErrorBar:(t,e)=>{var n=e.payload,r=n.itemId,i=n.prev,s=n.next;t[r]&&(t[r]=t[r].map(o=>o.dataKey===i.dataKey&&o.direction===i.direction?s:o))},removeErrorBar:(t,e)=>{var n=e.payload,r=n.itemId,i=n.errorBar;t[r]&&(t[r]=t[r].filter(s=>s.dataKey!==i.dataKey||s.direction!==i.direction))}}}),r2=OH.actions;r2.addErrorBar;r2.replaceErrorBar;r2.removeErrorBar;var rue=OH.reducer;function LH(t,e){var n,r,i=zt(c=>iu(c,t)),s=zt(c=>su(c,e)),o=(n=i==null?void 0:i.allowDataOverflow)!==null&&n!==void 0?n:ti.allowDataOverflow,a=(r=s==null?void 0:s.allowDataOverflow)!==null&&r!==void 0?r:ni.allowDataOverflow,l=o||a;return{needClip:l,needClipX:o,needClipY:a}}function iue(t){var e=t.xAxisId,n=t.yAxisId,r=t.clipPathId,i=e2(),s=LH(e,n),o=s.needClipX,a=s.needClipY,l=s.needClip,c=zt(T=>xB(T,e,!1)),d=zt(T=>bB(T,n,!1));if(!l||!i)return null;var f=i.x,m=i.y,y=i.width,x=i.height,S=o&&c?Math.min(c[0],c[1]):f-y/2,_=a&&d?Math.min(d[0],d[1]):m-x/2,w=o&&c?Math.abs(c[1]-c[0]):y*2,A=a&&d?Math.abs(d[1]-d[0]):x*2;return R.createElement("clipPath",{id:"clipPath-".concat(r)},R.createElement("rect",{x:S,y:_,width:w,height:A}))}function sue(t){var e=Y1(t),n=3,r=2;if(e!=null){var i=e.r,s=e.strokeWidth,o=Number(i),a=Number(s);return(Number.isNaN(o)||o<0)&&(o=n),(Number.isNaN(a)||a<0)&&(a=r),{r:o,strokeWidth:a}}return{r:n,strokeWidth:r}}function i2(t,e){var n,r;return(n=(r=t.graphicalItems.cartesianItems.find(i=>i.id===e))===null||r===void 0?void 0:r.xAxisId)!==null&&n!==void 0?n:EH}function s2(t,e){var n,r;return(n=(r=t.graphicalItems.cartesianItems.find(i=>i.id===e))===null||r===void 0?void 0:r.yAxisId)!==null&&n!==void 0?n:EH}var DH=(t,e,n)=>CB(t,"xAxis",i2(t,e),n),UH=(t,e,n)=>TB(t,"xAxis",i2(t,e),n),jH=(t,e,n)=>CB(t,"yAxis",s2(t,e),n),FH=(t,e,n)=>TB(t,"yAxis",s2(t,e),n),oue=Oe([fr,DH,jH,UH,FH],(t,e,n,r,i)=>Fl(t,"xAxis")?mw(e,r,!1):mw(n,i,!1)),aue=(t,e)=>e,zH=Oe([Xz,aue],(t,e)=>t.filter(n=>n.type==="area").find(n=>n.id===e)),BH=t=>{var e=fr(t),n=Fl(e,"xAxis");return n?"yAxis":"xAxis"},lue=(t,e)=>{var n=BH(t);return n==="yAxis"?s2(t,e):i2(t,e)},cue=(t,e,n)=>rB(t,BH(t),lue(t,e),n),uue=Oe([zH,cue],(t,e)=>{var n;if(!(t==null||e==null)){var r=t.stackId,i=sR(t);if(!(r==null||i==null)){var s=(n=e[r])===null||n===void 0?void 0:n.stackedData,o=s==null?void 0:s.find(a=>a.key===i);if(o!=null)return o.map(a=>[a[0],a[1]])}}}),due=Oe([fr,DH,jH,UH,FH,uue,LJ,oue,zH,QJ],(t,e,n,r,i,s,o,a,l,c)=>{var d=o.chartData,f=o.dataStartIndex,m=o.dataEndIndex;if(!(l==null||t!=="horizontal"&&t!=="vertical"||e==null||n==null||r==null||i==null||r.length===0||i.length===0||a==null)){var y=l.data,x;if(y&&y.length>0?x=y:x=d==null?void 0:d.slice(f,m+1),x!=null)return Uue({layout:t,xAxis:e,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:f,areaSettings:l,stackedData:s,displayedData:x,chartBaseValue:c,bandSize:a})}}),fue=["animationElapsedTime","isAnimating","isEntrance","layout","isRange","stroke","connectNulls"],hue=["id","baseLine"];function G0(){return G0=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},G0.apply(null,arguments)}function d3(t,e){if(t==null)return{};var n,r,i=pue(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function pue(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function mue(t){var e,n,r=t.alpha,i=t.baseLine,s=t.points,o=t.strokeWidth,a=(e=s[0])===null||e===void 0?void 0:e.x,l=(n=s[s.length-1])===null||n===void 0?void 0:n.x;if(!wn(a)||!wn(l))return null;var c=r*Math.abs(a-l),d=Math.max(...s.map(f=>f.y||0));return Nt(i)?d=Math.max(i,d):i&&Array.isArray(i)&&i.length&&(d=Math.max(...i.map(f=>f.y||0),d)),Nt(d)?R.createElement("rect",{x:a<l?a:a-c,y:0,width:c,height:Math.floor(d+(o?parseInt("".concat(o),10):1))}):null}function gue(t){var e,n,r=t.alpha,i=t.baseLine,s=t.points,o=t.strokeWidth,a=(e=s[0])===null||e===void 0?void 0:e.y,l=(n=s[s.length-1])===null||n===void 0?void 0:n.y;if(!wn(a)||!wn(l))return null;var c=r*Math.abs(a-l),d=Math.max(...s.map(f=>f.x||0));return Nt(i)?d=Math.max(i,d):i&&Array.isArray(i)&&i.length&&(d=Math.max(...i.map(f=>f.x||0),d)),Nt(d)?R.createElement("rect",{x:0,y:a<l?a:a-c,width:d+(o?parseInt("".concat(o),10):1),height:Math.floor(c)}):null}function vue(t){var e=t.alpha,n=t.layout,r=t.points,i=t.baseLine,s=t.strokeWidth;return n==="vertical"?R.createElement(gue,{alpha:e,points:r,baseLine:i,strokeWidth:s}):R.createElement(mue,{alpha:e,points:r,baseLine:i,strokeWidth:s})}function yue(t){var e=t.animationElapsedTime,n=e===void 0?1:e,r=t.isAnimating,i=r===void 0?!1:r,s=t.isEntrance,o=s===void 0?!1:s,a=t.layout,l=t.isRange,c=t.stroke,d=t.connectNulls,f=d3(t,fue),m=a==="vertical"?"vertical":"horizontal",y=d??!1,x=SH(),S=f.id,_=f.baseLine,w=d3(f,hue),A=za(w),T=R.createElement(H_,G0({},f,{id:S,baseLine:_,connectNulls:y,stroke:"none",className:"recharts-area-area",layout:m})),C=c!=="none"&&R.createElement(H_,G0({},A,{className:"recharts-area-curve",layout:m,type:f.type,connectNulls:y,fill:"none",stroke:c,points:f.points})),O=c!=="none"&&l&&Array.isArray(_)&&R.createElement(H_,G0({},A,{className:"recharts-area-curve",layout:m,type:f.type,connectNulls:y,fill:"none",stroke:c,points:_}));if(o&&(i||n<1)){var N;return R.createElement(Yo,null,R.createElement("defs",null,R.createElement("clipPath",{id:x},R.createElement(vue,{alpha:n,points:(N=f.points)!==null&&N!==void 0?N:[],baseLine:_,layout:m,strokeWidth:f.strokeWidth}))),R.createElement(Yo,{clipPath:"url(#".concat(x,")")},T,C,O))}return R.createElement(R.Fragment,null,T,C,O)}var xue=["id"],bue=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function Ww(){return Ww=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Ww.apply(null,arguments)}function HH(t,e){if(t==null)return{};var n,r,i=_ue(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function _ue(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function f3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Pg(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?f3(Object(n),!0).forEach(function(r){wue(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):f3(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function wue(t,e,n){return(e=Sue(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Sue(t){var e=Mue(t,"string");return typeof e=="symbol"?e:e+""}function Mue(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Eue=(t,e)=>t==null?[]:e===1?t.flatMap(n=>n.status==="removed"?[]:[n.next]):t.flatMap(n=>n.status==="matched"?[Pg(Pg({},n.next),{},{x:Uc(n.prev.x,n.next.x,e),y:Uc(n.prev.y,n.next.y,e)})]:n.status==="added"?[n.next]:[]),VH={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",animationMatchBy:QR,animationInterpolateFn:Eue,connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,shape:yue,xAxisId:0,yAxisId:0,zIndex:Ms.area};function $w(t,e){return t&&t!=="none"?t:e}var Aue=t=>{var e=t.dataKey,n=t.name,r=t.stroke,i=t.fill,s=t.legendType,o=t.hide;return[{inactive:o,dataKey:e,type:s,color:$w(r,i),value:p4(n,e),payload:t}]},Tue=R.memo(t=>{var e=t.dataKey,n=t.data,r=t.stroke,i=t.strokeWidth,s=t.fill,o=t.name,a=t.hide,l=t.unit,c=t.tooltipType,d=t.id,f={dataDefinedOnItem:n,getPosition:zg,settings:{stroke:r,strokeWidth:i,fill:s,dataKey:e,nameKey:void 0,name:p4(o,e),hide:a,type:c,color:$w(r,s),unit:l,graphicalItemId:d}};return R.createElement(Fae,{tooltipEntrySettings:f})});function Cue(t){var e=t.clipPathId,n=t.points,r=t.props,i=r.needClip,s=r.dot,o=r.dataKey,a=za(r);return R.createElement(Cle,{points:n,dot:s,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:o,baseProps:a,needClip:i,clipPathId:e})}function Pue(t){var e=t.showLabels,n=t.children,r=t.points,i=r.map(s=>{var o,a,l={x:(o=s.x)!==null&&o!==void 0?o:0,y:(a=s.y)!==null&&a!==void 0?a:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Pg(Pg({},l),{},{value:s.value,payload:s.payload,parentViewBox:void 0,viewBox:l,fill:void 0})});return R.createElement(Mae,{value:e?i:void 0},n)}function Rue(t){var e=t.points,n=t.baseLine,r=t.needClip,i=t.clipPathId,s=t.props,o=t.animationElapsedTime,a=t.isAnimating,l=t.isEntrance,c=s.layout,d=s.type,f=s.stroke,m=s.connectNulls,y=s.isRange,x=s.shape,S=s.id,_=HH(s,xue),w=Ko(_),A=Pg(Pg({},w),{},{id:S,points:e,connectNulls:m,type:d,baseLine:n,layout:c,stroke:f,isRange:y,animationElapsedTime:o,isAnimating:a,isEntrance:l});return R.createElement(R.Fragment,null,(e==null?void 0:e.length)>1&&R.createElement(Yo,{clipPath:r?"url(#clipPath-".concat(i,")"):void 0},R.createElement(jae,{option:x,DefaultShape:VH.shape,shapeProps:A})),R.createElement(Cue,{points:e,props:_,clipPathId:i}))}function Nue(t,e,n){if(Nt(t)){var r=Nt(e)?e:void 0;return Uc(r,t,n)}if(Hi(t)||Nl(t)){var i=Nt(e)?e:void 0;return Uc(i,0,n)}return t}function Iue(t){var e=t.needClip,n=t.clipPathId,r=t.props,i=t.previousPointsRef,s=t.previousBaselineRef,o=r.points,a=r.baseLine,l=r.isAnimationActive,c=r.animationBegin,d=r.animationDuration,f=r.animationEasing,m=r.animationMatchBy,y=r.animationInterpolateFn,x=R.useMemo(()=>({points:o,baseLine:a}),[o,a]),S=wH(x,s),_=WP(),w=nle(r.onAnimationStart,r.onAnimationEnd),A=w.isAnimating,T=w.handleAnimationStart,C=w.handleAnimationEnd,O=S.startValue;if(_==null)return null;var N;return Array.isArray(a)&&Array.isArray(O)?N=NC(O,a,m):Array.isArray(a)?N=NC(null,a,m):N=null,R.createElement(rle,{animationInput:x,animationIdPrefix:"recharts-area-",items:o,previousItemsRef:i,isAnimationActive:l,animationBegin:c,animationDuration:d,animationEasing:f,onAnimationStart:T,onAnimationEnd:C,animationInterpolateFn:y,animationMatchBy:m,layout:_},(D,F,V)=>{var k;return F===1?k=a:Array.isArray(a)?k=y(N,F,_):k=V?a:Nue(a,O,F),S.syncStepValue(k,F),R.createElement(Pue,{showLabels:!A,points:o},r.children,R.createElement(Rue,{points:D,baseLine:k,needClip:e,clipPathId:n,props:r,animationElapsedTime:F,isAnimating:A||F<1,isEntrance:V}),R.createElement(Tae,{label:r.label}))})}function kue(t){var e=t.needClip,n=t.clipPathId,r=t.props,i=R.useRef(null),s=R.useRef();return R.createElement(Iue,{needClip:e,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:s})}class Oue extends R.PureComponent{render(){var e=this.props,n=e.hide,r=e.dot,i=e.points,s=e.className,o=e.top,a=e.left,l=e.needClip,c=e.xAxisId,d=e.yAxisId,f=e.width,m=e.height,y=e.id,x=e.baseLine,S=e.zIndex;if(n)return null;var _=er("recharts-area",s),w=y,A=sue(r),T=A.r,C=A.strokeWidth,O=bH(r),N=T*2+C,D=l?"url(#clipPath-".concat(O?"":"dots-").concat(w,")"):void 0;return R.createElement(au,{zIndex:S},R.createElement(Yo,{className:_},l&&R.createElement("defs",null,R.createElement(iue,{clipPathId:w,xAxisId:c,yAxisId:d}),!O&&R.createElement("clipPath",{id:"clipPath-dots-".concat(w)},R.createElement("rect",{x:a-N/2,y:o-N/2,width:f+N,height:m+N}))),R.createElement(kue,{needClip:l,clipPathId:w,props:this.props})),R.createElement(r3,{points:i,mainColor:$w(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:D}),this.props.isRange&&Array.isArray(x)&&R.createElement(r3,{points:x,mainColor:$w(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:D}))}}function Lue(t){var e,n=t.activeDot,r=t.animationBegin,i=t.animationDuration,s=t.animationEasing,o=t.connectNulls,a=t.dot,l=t.fill,c=t.fillOpacity,d=t.hide,f=t.isAnimationActive,m=t.legendType,y=t.stroke,x=t.xAxisId,S=t.yAxisId,_=HH(t,bue),w=Bg(),A=ZB(),T=LH(x,S),C=T.needClip,O=Qs(),N=(e=zt(pe=>due(pe,t.id,O)))!==null&&e!==void 0?e:{},D=N.points,F=N.isRange,V=N.baseLine,k=e2();if(w!=="horizontal"&&w!=="vertical"||k==null||A!=="AreaChart"&&A!=="ComposedChart")return null;var j=k.height,H=k.width,ne=k.x,te=k.y;return!D||!D.length?null:R.createElement(Oue,Ww({},_,{activeDot:n,animationBegin:r,animationDuration:i,animationEasing:s,baseLine:V,connectNulls:o,dot:a,fill:l,fillOpacity:c,height:j,hide:d,layout:w,isAnimationActive:f,isRange:F,legendType:m,needClip:C,points:D,stroke:y,width:H,left:ne,top:te,xAxisId:x,yAxisId:S}))}var Due=(t,e,n,r,i)=>{var s=n??e;if(Nt(s))return s;var o=t==="horizontal"?i:r,a=o.scale.domain();if(o.type==="number"){var l=Math.max(a[0],a[1]),c=Math.min(a[0],a[1]);return s==="dataMin"?c:s==="dataMax"||l<0?l:Math.max(Math.min(a[0],a[1]),0)}return s==="dataMin"?a[0]:s==="dataMax"?a[1]:a[0]};function Uue(t){var e=t.areaSettings,n=e.connectNulls,r=e.baseValue,i=e.dataKey,s=t.stackedData,o=t.layout,a=t.chartBaseValue,l=t.xAxis,c=t.yAxis,d=t.displayedData,f=t.dataStartIndex,m=t.xAxisTicks,y=t.yAxisTicks,x=t.bandSize,S=s&&s.length,_=Due(o,a,r,l,c),w=o==="horizontal",A=!1,T=d.map((O,N)=>{var D,F,V,k;if(S)k=s[f+N];else{var j=yi(O,i);Array.isArray(j)?(k=j,A=!0):k=[_,j]}var H=(D=(F=k)===null||F===void 0?void 0:F[1])!==null&&D!==void 0?D:null,ne=H==null||S&&!n&&yi(O,i)==null;if(w){var te;return{x:ak({axis:l,ticks:m,bandSize:x,entry:O,index:N}),y:ne?null:(te=c.scale.map(H))!==null&&te!==void 0?te:null,value:k,payload:O}}return{x:ne?null:(V=l.scale.map(H))!==null&&V!==void 0?V:null,y:ak({axis:c,ticks:y,bandSize:x,entry:O,index:N}),value:k,payload:O}}),C;return S||A?C=T.map(O=>{var N,D=Array.isArray(O.value)?O.value[0]:null;if(w){var F;return{x:O.x,y:D!=null&&O.y!=null&&(F=c.scale.map(D))!==null&&F!==void 0?F:null,payload:O.payload}}return{x:D!=null&&(N=l.scale.map(D))!==null&&N!==void 0?N:null,y:O.y,payload:O.payload}}):C=w?c.scale.map(_):l.scale.map(_),{points:T,baseLine:C??0,isRange:A}}function jue(t){var e=Jo(t,VH),n=Qs();return R.createElement(fle,{id:e.id,type:"area"},r=>R.createElement(R.Fragment,null,R.createElement(zae,{legendPayload:Aue(e)}),R.createElement(Tue,{dataKey:e.dataKey,data:e.data,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,unit:e.unit,tooltipType:e.tooltipType,id:r}),R.createElement(xle,{type:"area",id:r,data:e.data,dataKey:e.dataKey,xAxisId:e.xAxisId,yAxisId:e.yAxisId,zAxisId:0,stackId:_Y(e.stackId),hide:e.hide,barSize:void 0,baseValue:e.baseValue,isPanorama:n,connectNulls:e.connectNulls}),R.createElement(Lue,Ww({},e,{id:r}))))}var GH=R.memo(jue,yS);GH.displayName="Area";var Fue=["domain","range"],zue=["domain","range"];function h3(t,e){if(t==null)return{};var n,r,i=Bue(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Bue(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function p3(t,e){return t===e?!0:Array.isArray(t)&&t.length===2&&Array.isArray(e)&&e.length===2?t[0]===e[0]&&t[1]===e[1]:!1}function WH(t,e){if(t===e)return!0;var n=t.domain,r=t.range,i=h3(t,Fue),s=e.domain,o=e.range,a=h3(e,zue);return!p3(n,s)||!p3(r,o)?!1:yS(i,a)}var Hue=["type"],Vue=["dangerouslySetInnerHTML","ticks","scale"],Gue=["id","scale"];function IC(){return IC=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},IC.apply(null,arguments)}function m3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function g3(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?m3(Object(n),!0).forEach(function(r){Wue(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):m3(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Wue(t,e,n){return(e=$ue(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function $ue(t){var e=Xue(t,"string");return typeof e=="symbol"?e:e+""}function Xue(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function kC(t,e){if(t==null)return{};var n,r,i=que(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function que(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function Kue(t){var e=Wr(),n=R.useRef(null),r=WP(),i=t.type,s=kC(t,Hue),o=wS(r,"xAxis",i),a=R.useMemo(()=>{if(o!=null)return g3(g3({},s),{},{type:o})},[s,o]);return R.useLayoutEffect(()=>{a!=null&&(n.current===null?e(kle(a)):n.current!==a&&e(Ole({prev:n.current,next:a})),n.current=a)},[a,e]),R.useLayoutEffect(()=>()=>{n.current&&(e(Lle(n.current)),n.current=null)},[e]),null}var Yue=t=>{var e=t.xAxisId,n=t.className,r=zt(g4),i=Qs(),s="xAxis",o=zt(m=>AB(m,s,e,i)),a=zt(m=>Rre(m,e)),l=zt(m=>Dre(m,e)),c=zt(m=>Vz(m,e));if(a==null||l==null||c==null)return null;t.dangerouslySetInnerHTML,t.ticks,t.scale;var d=kC(t,Vue);c.id,c.scale;var f=kC(c,Gue);return R.createElement(n2,IC({},d,f,{x:l.x,y:l.y,width:a.width,height:a.height,className:er("recharts-".concat(s," ").concat(s),n),viewBox:r,ticks:o,axisType:s,axisId:e}))},Zue={allowDataOverflow:ti.allowDataOverflow,allowDecimals:ti.allowDecimals,allowDuplicatedCategory:ti.allowDuplicatedCategory,angle:ti.angle,axisLine:Gc.axisLine,height:ti.height,hide:!1,includeHidden:ti.includeHidden,interval:ti.interval,label:!1,minTickGap:ti.minTickGap,mirror:ti.mirror,orientation:ti.orientation,padding:ti.padding,reversed:ti.reversed,scale:ti.scale,tick:ti.tick,tickCount:ti.tickCount,tickLine:Gc.tickLine,tickSize:Gc.tickSize,type:ti.type,niceTicks:ti.niceTicks,xAxisId:0},Que=t=>{var e=Jo(t,Zue);return R.createElement(R.Fragment,null,R.createElement(Kue,{allowDataOverflow:e.allowDataOverflow,allowDecimals:e.allowDecimals,allowDuplicatedCategory:e.allowDuplicatedCategory,angle:e.angle,dataKey:e.dataKey,domain:e.domain,height:e.height,hide:e.hide,id:e.xAxisId,includeHidden:e.includeHidden,interval:e.interval,minTickGap:e.minTickGap,mirror:e.mirror,name:e.name,orientation:e.orientation,padding:e.padding,reversed:e.reversed,scale:e.scale,tick:e.tick,tickCount:e.tickCount,tickFormatter:e.tickFormatter,ticks:e.ticks,type:e.type,unit:e.unit,niceTicks:e.niceTicks}),R.createElement(Yue,e))},$H=R.memo(Que,WH);$H.displayName="XAxis";var Jue=["type"],ede=["dangerouslySetInnerHTML","ticks","scale"],tde=["id","scale"];function OC(){return OC=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},OC.apply(null,arguments)}function v3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function y3(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?v3(Object(n),!0).forEach(function(r){nde(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):v3(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function nde(t,e,n){return(e=rde(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function rde(t){var e=ide(t,"string");return typeof e=="symbol"?e:e+""}function ide(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function LC(t,e){if(t==null)return{};var n,r,i=sde(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function sde(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function ode(t){var e=Wr(),n=R.useRef(null),r=WP(),i=t.type,s=LC(t,Jue),o=wS(r,"yAxis",i),a=R.useMemo(()=>{if(o!=null)return y3(y3({},s),{},{type:o})},[o,s]);return R.useLayoutEffect(()=>{a!=null&&(n.current===null?e(Dle(a)):n.current!==a&&e(Ule({prev:n.current,next:a})),n.current=a)},[a,e]),R.useLayoutEffect(()=>()=>{n.current&&(e(jle(n.current)),n.current=null)},[e]),null}function ade(t){var e=t.yAxisId,n=t.className,r=t.width,i=t.label,s=R.useRef(null),o=R.useRef(null),a=zt(g4),l=Qs(),c=Wr(),d="yAxis",f=zt(w=>Fre(w,e)),m=zt(w=>jre(w,e)),y=zt(w=>AB(w,d,e,l)),x=zt(w=>Gz(w,e));if(R.useLayoutEffect(()=>{if(!(r!=="auto"||!f||ZR(i)||R.isValidElement(i)||x==null)){var w=s.current;if(w){var A=w.getCalculatedWidth();Math.round(f.width)!==Math.round(A)&&c(Fle({id:e,width:A}))}}},[y,f,c,i,e,r,x]),f==null||m==null||x==null)return null;t.dangerouslySetInnerHTML,t.ticks,t.scale;var S=LC(t,ede);x.id,x.scale;var _=LC(x,tde);return R.createElement(n2,OC({},S,_,{ref:s,labelRef:o,x:m.x,y:m.y,tickTextProps:r==="auto"?{width:void 0}:{width:r},width:f.width,height:f.height,className:er("recharts-".concat(d," ").concat(d),n),viewBox:a,ticks:y,axisType:d,axisId:e}))}var lde={allowDataOverflow:ni.allowDataOverflow,allowDecimals:ni.allowDecimals,allowDuplicatedCategory:ni.allowDuplicatedCategory,angle:ni.angle,axisLine:Gc.axisLine,hide:!1,includeHidden:ni.includeHidden,interval:ni.interval,label:!1,minTickGap:ni.minTickGap,mirror:ni.mirror,orientation:ni.orientation,padding:ni.padding,reversed:ni.reversed,scale:ni.scale,tick:ni.tick,tickCount:ni.tickCount,tickLine:Gc.tickLine,tickSize:Gc.tickSize,type:ni.type,niceTicks:ni.niceTicks,width:ni.width,yAxisId:0},cde=t=>{var e=Jo(t,lde);return R.createElement(R.Fragment,null,R.createElement(ode,{interval:e.interval,id:e.yAxisId,scale:e.scale,type:e.type,domain:e.domain,allowDataOverflow:e.allowDataOverflow,dataKey:e.dataKey,allowDuplicatedCategory:e.allowDuplicatedCategory,allowDecimals:e.allowDecimals,tickCount:e.tickCount,padding:e.padding,includeHidden:e.includeHidden,reversed:e.reversed,ticks:e.ticks,width:e.width,orientation:e.orientation,mirror:e.mirror,hide:e.hide,unit:e.unit,name:e.name,angle:e.angle,minTickGap:e.minTickGap,tick:e.tick,tickFormatter:e.tickFormatter,niceTicks:e.niceTicks}),R.createElement(ade,e))},XH=R.memo(cde,WH);XH.displayName="YAxis";var ude=(t,e)=>e,o2=Oe([ude,fr,iz,_i,WB,ou,ase,Gi],pse);function dde(t){return"getBBox"in t.currentTarget&&typeof t.currentTarget.getBBox=="function"}function a2(t){var e=t.currentTarget.getBoundingClientRect(),n,r;if(dde(t)){var i=t.currentTarget.getBBox();n=i.width>0?e.width/i.width:1,r=i.height>0?e.height/i.height:1}else{var s=t.currentTarget;n=s.offsetWidth>0?e.width/s.offsetWidth:1,r=s.offsetHeight>0?e.height/s.offsetHeight:1}var o=(a,l)=>({relativeX:Math.round((a-e.left)/n),relativeY:Math.round((l-e.top)/r)});return"touches"in t?Array.from(t.touches).map(a=>o(a.clientX,a.clientY)):o(t.clientX,t.clientY)}var qH=Mo("mouseClick"),KH=Wy();KH.startListening({actionCreator:qH,effect:(t,e)=>{var n=t.payload,r=o2(e.getState(),a2(n));(r==null?void 0:r.activeIndex)!=null&&e.dispatch(eie({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var DC=Mo("mouseMove"),YH=Wy(),dm=null,Sf=null,VE=null;YH.startListening({actionCreator:DC,effect:(t,e)=>{var n=t.payload,r=e.getState(),i=r.eventSettings,s=i.throttleDelay,o=i.throttledEvents,a=o==="all"||(o==null?void 0:o.includes("mousemove"));dm!==null&&(cancelAnimationFrame(dm),dm=null),Sf!==null&&(typeof s!="number"||!a)&&(clearTimeout(Sf),Sf=null),VE=a2(n);var l=()=>{var c=e.getState(),d=ix(c,c.tooltip.settings.shared);if(!VE){dm=null,Sf=null;return}if(d==="axis"){var f=o2(c,VE);(f==null?void 0:f.activeIndex)!=null?e.dispatch(LB({activeIndex:f.activeIndex,activeDataKey:void 0,activeCoordinate:f.activeCoordinate})):e.dispatch(OB())}dm=null,Sf=null};if(!a){l();return}s==="raf"?dm=requestAnimationFrame(l):typeof s=="number"&&Sf===null&&(Sf=setTimeout(l,s))}});function fde(t,e){return e instanceof HTMLElement?"HTMLElement <".concat(e.tagName,' class="').concat(e.className,'">'):e===window?"global.window":t==="children"&&typeof e=="object"&&e!==null?"<<CHILDREN>>":e}var x3={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},ZH=cs({name:"rootProps",initialState:x3,reducers:{updateOptions:(t,e)=>{var n;t.accessibilityLayer=e.payload.accessibilityLayer,t.barCategoryGap=e.payload.barCategoryGap,t.barGap=(n=e.payload.barGap)!==null&&n!==void 0?n:x3.barGap,t.barSize=e.payload.barSize,t.maxBarSize=e.payload.maxBarSize,t.stackOffset=e.payload.stackOffset,t.syncId=e.payload.syncId,t.syncMethod=e.payload.syncMethod,t.className=e.payload.className,t.baseValue=e.payload.baseValue,t.reverseStackOrder=e.payload.reverseStackOrder}}}),hde=ZH.reducer,pde=ZH.actions.updateOptions,mde=null,gde={updatePolarOptions:(t,e)=>t===null?e.payload:(t.startAngle=e.payload.startAngle,t.endAngle=e.payload.endAngle,t.cx=e.payload.cx,t.cy=e.payload.cy,t.innerRadius=e.payload.innerRadius,t.outerRadius=e.payload.outerRadius,t)},QH=cs({name:"polarOptions",initialState:mde,reducers:gde});QH.actions.updatePolarOptions;var vde=QH.reducer,JH=Mo("keyDown"),eV=Mo("focus"),tV=Mo("blur"),jS=Wy(),fm=null,Mf=null,kb=null;jS.startListening({actionCreator:JH,effect:(t,e)=>{kb=t.payload,fm!==null&&(cancelAnimationFrame(fm),fm=null);var n=e.getState(),r=n.eventSettings,i=r.throttleDelay,s=r.throttledEvents,o=s==="all"||s.includes("keydown");Mf!==null&&(typeof i!="number"||!o)&&(clearTimeout(Mf),Mf=null);var a=()=>{try{var l=e.getState(),c=l.rootProps.accessibilityLayer!==!1;if(!c)return;var d=l.tooltip.keyboardInteraction,f=kb;if(f!=="ArrowRight"&&f!=="ArrowLeft"&&f!=="Enter")return;var m=H0(d,Lh(l),Tg(l),Cg(l)),y=m==null?-1:Number(m),x=!Number.isFinite(y)||y<0,S=ou(l),_=Lh(l),w=ix(l,l.tooltip.settings.shared);if(f==="Enter"){if(x)return;var A=zw(l,w,"hover",String(d.index));e.dispatch(Fw({active:!d.active,activeIndex:d.index,activeCoordinate:A}));return}var T=Gre(l),C=T==="left-to-right"?1:-1,O=f==="ArrowRight"?1:-1,N;if(x){var D=Tg(l),F=Cg(l),V=O*C,k=pe=>({active:!1,index:String(pe),dataKey:void 0,graphicalItemId:void 0,coordinate:void 0});if(N=-1,V>0){for(var j=0;j<_.length;j++)if(H0(k(j),_,D,F)!=null){N=j;break}}else for(var H=_.length-1;H>=0;H--)if(H0(k(H),_,D,F)!=null){N=H;break}if(N<0)return}else{N=y+O*C;var ne=(S==null?void 0:S.length)||_.length;if(ne===0||N>=ne||N<0)return}var te=zw(l,w,"hover",String(N));e.dispatch(Fw({active:!0,activeIndex:N.toString(),activeCoordinate:te}))}finally{fm=null,Mf=null}};if(!o){a();return}i==="raf"?fm=requestAnimationFrame(a):typeof i=="number"&&Mf===null&&(a(),kb=null,Mf=setTimeout(()=>{kb?a():(Mf=null,fm=null)},i))}});jS.startListening({actionCreator:eV,effect:(t,e)=>{var n=e.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var i=n.tooltip.keyboardInteraction;if(!i.active&&i.index==null){var s="0",o=ix(n,n.tooltip.settings.shared),a=zw(n,o,"hover",String(s));e.dispatch(Fw({active:!0,activeIndex:s,activeCoordinate:a}))}}}});jS.startListening({actionCreator:tV,effect:(t,e)=>{var n=e.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var i=n.tooltip.keyboardInteraction;i.active&&e.dispatch(Fw({active:!1,activeIndex:i.index,activeCoordinate:i.coordinate}))}}});function nV(t){t.persist();var e=t.currentTarget;return new Proxy(t,{get:(n,r)=>{if(r==="currentTarget")return e;var i=Reflect.get(n,r);return typeof i=="function"?i.bind(n):i}})}var zo=Mo("externalEvent"),rV=Wy(),Ob=new Map,d0=new Map,GE=new Map;rV.startListening({actionCreator:zo,effect:(t,e)=>{var n=t.payload,r=n.handler,i=n.reactEvent;if(r!=null){var s=i.type,o=nV(i);GE.set(s,{handler:r,reactEvent:o});var a=Ob.get(s);a!==void 0&&(cancelAnimationFrame(a),Ob.delete(s));var l=e.getState(),c=l.eventSettings,d=c.throttleDelay,f=c.throttledEvents,m=f,y=m==="all"||(m==null?void 0:m.includes(s)),x=d0.get(s);x!==void 0&&(typeof d!="number"||!y)&&(clearTimeout(x),d0.delete(s));var S=()=>{var A=GE.get(s);try{if(!A)return;var T=A.handler,C=A.reactEvent,O=e.getState(),N={activeCoordinate:$ie(O),activeDataKey:Vie(O),activeIndex:_y(O),activeLabel:qB(O),activeTooltipIndex:_y(O),isTooltipActive:Xie(O)};T&&T(N,C)}finally{Ob.delete(s),d0.delete(s),GE.delete(s)}};if(!y){S();return}if(d==="raf"){var _=requestAnimationFrame(S);Ob.set(s,_)}else if(typeof d=="number"){if(!d0.has(s)){S();var w=setTimeout(S,d);d0.set(s,w)}}else S()}}});var yde=Oe([Kg],t=>t.tooltipItemPayloads),xde=Oe([yde,(t,e)=>e,(t,e,n)=>n],(t,e,n)=>{if(e!=null){var r=t.find(s=>s.settings.graphicalItemId===n);if(r!=null){var i=r.getPosition;if(i!=null)return i(e)}}}),iV=Mo("touchMove"),sV=Wy(),Ef=null,$u=null,b3=null,f0=null;sV.startListening({actionCreator:iV,effect:(t,e)=>{var n=t.payload;if(!(n.touches==null||n.touches.length===0)){f0=nV(n);var r=e.getState(),i=r.eventSettings,s=i.throttleDelay,o=i.throttledEvents,a=o==="all"||o.includes("touchmove");Ef!==null&&(cancelAnimationFrame(Ef),Ef=null),$u!==null&&(typeof s!="number"||!a)&&(clearTimeout($u),$u=null),b3=Array.from(n.touches).map(c=>a2({clientX:c.clientX,clientY:c.clientY,currentTarget:n.currentTarget}));var l=()=>{if(f0!=null){var c=e.getState(),d=ix(c,c.tooltip.settings.shared);if(d==="axis"){var f,m=(f=b3)===null||f===void 0?void 0:f[0];if(m==null){Ef=null,$u=null;return}var y=o2(c,m);(y==null?void 0:y.activeIndex)!=null&&e.dispatch(LB({activeIndex:y.activeIndex,activeDataKey:void 0,activeCoordinate:y.activeCoordinate}))}else if(d==="item"){var x,S=f0.touches[0];if(document.elementFromPoint==null||S==null)return;var _=document.elementFromPoint(S.clientX,S.clientY);if(!_||!_.getAttribute)return;var w=_.getAttribute(CY),A=(x=_.getAttribute(PY))!==null&&x!==void 0?x:void 0,T=Qh(c).find(N=>N.id===A);if(w==null||T==null||A==null)return;var C=T.dataKey,O=xde(c,w,A);e.dispatch(Jre({activeDataKey:C,activeIndex:w,activeCoordinate:O,activeGraphicalItemId:A}))}Ef=null,$u=null}};if(!a){l();return}s==="raf"?Ef=requestAnimationFrame(l):typeof s=="number"&&$u===null&&(l(),f0=null,$u=setTimeout(()=>{f0?l():($u=null,Ef=null)},s))}}});var oV={throttleDelay:"raf",throttledEvents:["mousemove","touchmove","pointermove","scroll","wheel"]},aV=cs({name:"eventSettings",initialState:oV,reducers:{setEventSettings:(t,e)=>{e.payload.throttleDelay!=null&&(t.throttleDelay=e.payload.throttleDelay),e.payload.throttledEvents!=null&&(t.throttledEvents=e.payload.throttledEvents)}}}),bde=aV.actions.setEventSettings,_de=aV.reducer,wde=U5({brush:Kle,cartesianAxis:zle,chartData:Wse,errorBars:rue,eventSettings:_de,graphicalItems:vle,layout:fY,legend:AZ,options:zse,polarAxis:Pae,polarOptions:vde,referenceElements:Jle,renderedTicks:_ce,rootProps:hde,tooltip:tie,zIndex:Tse}),Sde=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return UK({reducer:wde,preloadedState:e,middleware:r=>{var i;return r({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((i="es6")!==null&&i!==void 0?i:"")}).concat([KH.middleware,YH.middleware,jS.middleware,rV.middleware,sV.middleware])},enhancers:r=>{var i=r;return typeof r=="function"&&(i=r()),i.concat(Q5({type:"raf"}))},devTools:{serialize:{replacer:fde},name:"recharts-".concat(n)}})};function Mde(t){var e=t.preloadedState,n=t.children,r=t.reduxStoreName,i=Qs(),s=R.useRef(null);if(i)return n;s.current==null&&(s.current=Sde(e,r));var o=DP;return R.createElement(HZ,{context:o,store:s.current},n)}function Ede(t){var e=t.layout,n=t.margin,r=Wr(),i=Qs();return R.useEffect(()=>{i||(r(cY(e)),r(lY(n)))},[r,i,e,n]),null}var Ade=R.memo(Ede,yS);function Tde(t){var e=Wr();return R.useEffect(()=>{e(pde(t))},[e,t]),null}var Cde=t=>{var e=Wr();return R.useEffect(()=>{e(bde(t))},[e,t]),null},Pde=R.memo(Cde,yS);function _3(t){var e=t.zIndex,n=t.isPanorama,r=R.useRef(null),i=Wr();return R.useLayoutEffect(()=>(r.current&&i(Ese({zIndex:e,element:r.current,isPanorama:n})),()=>{i(Ase({zIndex:e,isPanorama:n}))}),[i,e,n]),R.createElement("g",{tabIndex:-1,ref:r,className:"recharts-zIndex-layer_".concat(e)})}function w3(t){var e=t.children,n=t.isPanorama,r=zt(gse);if(!r||r.length===0)return e;var i=r.filter(o=>o<0),s=r.filter(o=>o>0);return R.createElement(R.Fragment,null,i.map(o=>R.createElement(_3,{key:o,zIndex:o,isPanorama:n})),e,s.map(o=>R.createElement(_3,{key:o,zIndex:o,isPanorama:n})))}var Rde=["children"];function Nde(t,e){if(t==null)return{};var n,r,i=Ide(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Ide(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function Xw(){return Xw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Xw.apply(null,arguments)}var kde={width:"100%",height:"100%",display:"block"},Ode=R.forwardRef((t,e)=>{var n=_4(),r=w4(),i=I4();if(!kl(n)||!kl(r))return null;var s=t.children,o=t.otherAttributes,a=t.title,l=t.desc,c,d;return o!=null&&(typeof o.tabIndex=="number"?c=o.tabIndex:c=i?0:void 0,typeof o.role=="string"?d=o.role:d=i?"application":void 0),R.createElement(t5,Xw({},o,{title:a,desc:l,role:d,tabIndex:c,width:n,height:r,style:kde,ref:e}),s)}),Lde=t=>{var e=t.children,n=zt(hS);if(!n)return null;var r=n.width,i=n.height,s=n.y,o=n.x;return R.createElement(t5,{width:r,height:i,x:o,y:s},e)},S3=R.forwardRef((t,e)=>{var n=t.children,r=Nde(t,Rde),i=Qs();return i?R.createElement(Lde,null,R.createElement(w3,{isPanorama:!0},n)):R.createElement(Ode,Xw({ref:e},r),R.createElement(w3,{isPanorama:!1},n))});function Dde(t,e){return zde(t)||Fde(t,e)||jde(t,e)||Ude()}function Ude(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jde(t,e){if(t){if(typeof t=="string")return M3(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?M3(t,e):void 0}}function M3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Fde(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function zde(t){if(Array.isArray(t))return t}function Bde(){var t=Wr(),e=R.useState(null),n=Dde(e,2),r=n[0],i=n[1],s=zt(TY);return R.useEffect(()=>{if(r!=null){var o=r.getBoundingClientRect(),a=o.width/r.offsetWidth;wn(a)&&a!==s&&t(dY(a))}},[r,t,s]),i}function E3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Hde(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?E3(Object(n),!0).forEach(function(r){Vde(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):E3(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Vde(t,e,n){return(e=Gde(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Gde(t){var e=Wde(t,"string");return typeof e=="symbol"?e:e+""}function Wde(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Sd(){return Sd=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Sd.apply(null,arguments)}function qw(t,e){return Kde(t)||qde(t,e)||Xde(t,e)||$de()}function $de(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Xde(t,e){if(t){if(typeof t=="string")return A3(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?A3(t,e):void 0}}function A3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function qde(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function Kde(t){if(Array.isArray(t))return t}var Yde=()=>(eoe(),null);function Kw(t){if(typeof t=="number")return t;if(typeof t=="string"){var e=parseFloat(t);if(!Number.isNaN(e))return e}return 0}var Zde=R.forwardRef((t,e)=>{var n,r,i=R.useRef(null),s=R.useState({containerWidth:Kw((n=t.style)===null||n===void 0?void 0:n.width),containerHeight:Kw((r=t.style)===null||r===void 0?void 0:r.height)}),o=qw(s,2),a=o[0],l=o[1],c=R.useCallback((f,m)=>{l(y=>{var x=Math.round(f),S=Math.round(m);return y.containerWidth===x&&y.containerHeight===S?y:{containerWidth:x,containerHeight:S}})},[]),d=R.useCallback(f=>{if(typeof e=="function"&&e(f),i.current!=null&&(i.current.disconnect(),i.current=null),f!=null&&typeof ResizeObserver<"u"){var m=f.getBoundingClientRect(),y=m.width,x=m.height;c(y,x);var S=w=>{var A=w[0];if(A!=null){var T=A.contentRect,C=T.width,O=T.height;c(C,O)}},_=new ResizeObserver(S);_.observe(f),i.current=_}},[e,c]);return R.useEffect(()=>()=>{var f=i.current;f!=null&&f.disconnect()},[c]),R.createElement(R.Fragment,null,R.createElement(Xy,{width:a.containerWidth,height:a.containerHeight}),R.createElement("div",Sd({ref:d},t)))}),Qde=R.forwardRef((t,e)=>{var n=t.width,r=t.height,i=R.useState({containerWidth:Kw(n),containerHeight:Kw(r)}),s=qw(i,2),o=s[0],a=s[1],l=R.useCallback((d,f)=>{a(m=>{var y=Math.round(d),x=Math.round(f);return m.containerWidth===y&&m.containerHeight===x?m:{containerWidth:y,containerHeight:x}})},[]),c=R.useCallback(d=>{if(typeof e=="function"&&e(d),d!=null){var f=d.getBoundingClientRect(),m=f.width,y=f.height;l(m,y)}},[e,l]);return R.createElement(R.Fragment,null,R.createElement(Xy,{width:o.containerWidth,height:o.containerHeight}),R.createElement("div",Sd({ref:c},t)))}),Jde=R.forwardRef((t,e)=>{var n=t.width,r=t.height;return R.createElement(R.Fragment,null,R.createElement(Xy,{width:n,height:r}),R.createElement("div",Sd({ref:e},t)))}),efe=R.forwardRef((t,e)=>{var n=t.width,r=t.height;return typeof n=="string"||typeof r=="string"?R.createElement(Qde,Sd({},t,{ref:e})):typeof n=="number"&&typeof r=="number"?R.createElement(Jde,Sd({},t,{width:n,height:r,ref:e})):R.createElement(R.Fragment,null,R.createElement(Xy,{width:n,height:r}),R.createElement("div",Sd({ref:e},t)))});function tfe(t){return t?Zde:efe}var nfe=R.forwardRef((t,e)=>{var n=t.children,r=t.className,i=t.height,s=t.onClick,o=t.onContextMenu,a=t.onDoubleClick,l=t.onMouseDown,c=t.onMouseEnter,d=t.onMouseLeave,f=t.onMouseMove,m=t.onMouseUp,y=t.onTouchEnd,x=t.onTouchMove,S=t.onTouchStart,_=t.style,w=t.width,A=t.responsive,T=t.dispatchTouchEvents,C=T===void 0?!0:T,O=R.useRef(null),N=Wr(),D=R.useState(null),F=qw(D,2),V=F[0],k=F[1],j=R.useState(null),H=qw(j,2),ne=H[0],te=H[1],pe=Bde(),oe=VP(),ce=(oe==null?void 0:oe.width)>0?oe.width:w,B=(oe==null?void 0:oe.height)>0?oe.height:i,K=R.useCallback(Ue=>{pe(Ue),typeof e=="function"&&e(Ue),k(Ue),te(Ue),Ue!=null&&(O.current=Ue)},[pe,e,k,te]),q=R.useCallback(Ue=>{N(qH(Ue)),N(zo({handler:s,reactEvent:Ue}))},[N,s]),$=R.useCallback(Ue=>{N(DC(Ue)),N(zo({handler:c,reactEvent:Ue}))},[N,c]),Z=R.useCallback(Ue=>{N(OB()),N(zo({handler:d,reactEvent:Ue}))},[N,d]),ge=R.useCallback(Ue=>{N(DC(Ue)),N(zo({handler:f,reactEvent:Ue}))},[N,f]),ae=R.useCallback(()=>{N(eV())},[N]),fe=R.useCallback(()=>{N(tV())},[N]),_e=R.useCallback(Ue=>{N(JH(Ue.key))},[N]),Se=R.useCallback(Ue=>{N(zo({handler:o,reactEvent:Ue}))},[N,o]),$e=R.useCallback(Ue=>{N(zo({handler:a,reactEvent:Ue}))},[N,a]),Me=R.useCallback(Ue=>{N(zo({handler:l,reactEvent:Ue}))},[N,l]),He=R.useCallback(Ue=>{N(zo({handler:m,reactEvent:Ue}))},[N,m]),Xe=R.useCallback(Ue=>{N(zo({handler:S,reactEvent:Ue}))},[N,S]),ue=R.useCallback(Ue=>{C&&N(iV(Ue)),N(zo({handler:x,reactEvent:Ue}))},[N,C,x]),Q=R.useCallback(Ue=>{N(zo({handler:y,reactEvent:Ue}))},[N,y]),Ge=tfe(A);return R.createElement(nH.Provider,{value:V},R.createElement(gX.Provider,{value:ne},R.createElement(Ge,{width:ce??(_==null?void 0:_.width),height:B??(_==null?void 0:_.height),className:er("recharts-wrapper",r),style:Hde({position:"relative",cursor:"default",width:ce,height:B},_),onClick:q,onContextMenu:Se,onDoubleClick:$e,onFocus:ae,onBlur:fe,onKeyDown:_e,onMouseDown:Me,onMouseEnter:$,onMouseLeave:Z,onMouseMove:ge,onMouseUp:He,onTouchEnd:Q,onTouchMove:ue,onTouchStart:Xe,ref:K},R.createElement(Yde,null),n)))}),rfe=["width","height","responsive","children","className","style","compact","title","desc"];function ife(t,e){if(t==null)return{};var n,r,i=sfe(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function sfe(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var ofe=R.forwardRef((t,e)=>{var n=t.width,r=t.height,i=t.responsive,s=t.children,o=t.className,a=t.style,l=t.compact,c=t.title,d=t.desc,f=ife(t,rfe),m=za(f);return l?R.createElement(R.Fragment,null,R.createElement(Xy,{width:n,height:r}),R.createElement(S3,{otherAttributes:m,title:c,desc:d},s)):R.createElement(nfe,{className:o,style:a,width:n,height:r,responsive:i??!1,onClick:t.onClick,onMouseLeave:t.onMouseLeave,onMouseEnter:t.onMouseEnter,onMouseMove:t.onMouseMove,onMouseDown:t.onMouseDown,onMouseUp:t.onMouseUp,onContextMenu:t.onContextMenu,onDoubleClick:t.onDoubleClick,onTouchStart:t.onTouchStart,onTouchMove:t.onTouchMove,onTouchEnd:t.onTouchEnd},R.createElement(S3,{otherAttributes:m,title:c,desc:d,ref:e},R.createElement(oce,null,s)))});function UC(){return UC=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},UC.apply(null,arguments)}function T3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function afe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?T3(Object(n),!0).forEach(function(r){lfe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):T3(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function lfe(t,e,n){return(e=cfe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function cfe(t){var e=ufe(t,"string");return typeof e=="symbol"?e:e+""}function ufe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var dfe={top:5,right:5,bottom:5,left:5},ffe=afe({accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:dfe,responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},oV),hfe=R.forwardRef(function(e,n){var r,i=Jo(e.categoricalChartProps,ffe),s=e.chartName,o=e.defaultTooltipEventType,a=e.validateTooltipEventTypes,l=e.tooltipPayloadSearcher,c=e.categoricalChartProps,d={chartName:s,defaultTooltipEventType:o,validateTooltipEventTypes:a,tooltipPayloadSearcher:l,eventEmitter:void 0};return R.createElement(Mde,{preloadedState:{options:d},reduxStoreName:(r=c.id)!==null&&r!==void 0?r:s},R.createElement(qle,{chartData:c.data}),R.createElement(Ade,{layout:i.layout,margin:i.margin}),R.createElement(Pde,{throttleDelay:i.throttleDelay,throttledEvents:i.throttledEvents}),R.createElement(Tde,{baseValue:i.baseValue,accessibilityLayer:i.accessibilityLayer,barCategoryGap:i.barCategoryGap,maxBarSize:i.maxBarSize,stackOffset:i.stackOffset,barGap:i.barGap,barSize:i.barSize,syncId:i.syncId,syncMethod:i.syncMethod,className:i.className,reverseStackOrder:i.reverseStackOrder}),R.createElement(ofe,UC({},i,{ref:n})))}),pfe=["axis"],mfe=R.forwardRef((t,e)=>R.createElement(hfe,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:pfe,tooltipPayloadSearcher:jse,categoricalChartProps:t,ref:e}));const gfe="rgba(130,130,150,0.14)",C3="rgba(130,130,150,0.85)";function vfe(t){if(t<=0)return 10;const e=Math.pow(10,Math.floor(Math.log10(t))),n=t/e;return(n<=1?1:n<=2?2:n<=5?5:10)*e}function lV(t,e){return`${e==="%"?Math.round(t):t>=1e3?`${(t/1e3).toFixed(1)}k`:Math.round(t).toString()}${e}`}function yfe({active:t,payload:e,unit:n}){return!t||!(e!=null&&e.length)?null:v.jsx("div",{className:"rounded-lg border border-border/70 bg-popover/95 px-3 py-2 shadow-xl backdrop-blur",children:v.jsx("div",{className:"space-y-1",children:e.map(r=>v.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-mono",children:[v.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:r.color}}),v.jsx("span",{className:"uppercase tracking-wider text-muted-foreground",children:r.name}),v.jsx("span",{className:"ml-auto pl-3 font-bold tabular-nums text-foreground",children:lV(r.value,n)})]},r.dataKey))})})}function cV({data:t,series:e,unit:n="%",yMode:r="percent",height:i=176}){const s=t.reduce((a,l)=>e.reduce((c,d)=>Math.max(c,Number(l[d.key])||0),a),0),o=r==="percent"?Math.min(100,Math.max(25,Math.ceil(s*1.2/25)*25)):Math.max(vfe(s*1.15),10);return v.jsx("div",{style:{height:i},className:"w-full",children:v.jsx(lZ,{width:"100%",height:"100%",children:v.jsxs(mfe,{data:t,margin:{top:8,right:6,bottom:0,left:-12},children:[v.jsx("defs",{children:e.map(a=>v.jsxs("linearGradient",{id:`grad-${a.key}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[v.jsx("stop",{offset:"0%",stopColor:a.color,stopOpacity:.22}),v.jsx("stop",{offset:"100%",stopColor:a.color,stopOpacity:0})]},a.key))}),v.jsx(kH,{vertical:!1,stroke:gfe}),v.jsx($H,{dataKey:"t",hide:!0}),v.jsx(XH,{domain:[0,o],ticks:[0,o/2,o],tickFormatter:a=>lV(a,n),width:42,axisLine:!1,tickLine:!1,tick:{fontSize:10,fill:C3}}),v.jsx(hoe,{content:v.jsx(yfe,{unit:n}),cursor:{stroke:C3,strokeOpacity:.4,strokeDasharray:"3 3"}}),e.map(a=>v.jsx(GH,{type:"monotone",dataKey:a.key,name:a.label,stroke:a.color,strokeWidth:2,fill:`url(#grad-${a.key})`,dot:!1,activeDot:{r:3,strokeWidth:0},isAnimationActive:!1,connectNulls:!0},a.key))]})})})}const xfe=[{key:"cpu",label:"CPU",color:"#2dd4bf"},{key:"ram",label:"RAM",color:"#38bdf8"},{key:"gpu",label:"GPU",color:"#a78bfa"},{key:"disk",label:"Disk",color:"#fbbf24"}];function bfe(){var o,a,l,c;const{sys:t,hist:e}=sX(),n=!!(t!=null&&t.gpu&&t.gpu.busy_percent!=null&&t.gpu.gtt_used!=null&&t.gpu.gtt_total!=null),r=xfe.filter(d=>d.key!=="gpu"||n),i={cpu:(o=t==null?void 0:t.cpu)==null?void 0:o.percent,ram:(a=t==null?void 0:t.ram)==null?void 0:a.percent,gpu:n?t.gpu.busy_percent:null,disk:(l=t==null?void 0:t.disk)==null?void 0:l.percent},s={cpu:(c=t==null?void 0:t.cpu)!=null&&c.cores?`${t.cpu.cores} Cores`:"",ram:t?`${sm(t.ram.used)}/${sm(t.ram.total)} GB`:"",gpu:n?`${sm(t.gpu.gtt_used)}/${sm(t.gpu.gtt_total)} GB`:"",disk:t!=null&&t.disk?`${sm(t.disk.used)}/${sm(t.disk.total)} GB`:""};return v.jsxs("div",{className:"flex flex-col justify-between rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[v.jsxs("div",{children:[v.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[v.jsx(El,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"System-Status"}),v.jsxs("span",{className:"ml-1 inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground/70",children:[v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," live"]})]}),t?v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"mb-2 grid grid-cols-2 gap-x-4 gap-y-1.5",children:r.map(d=>v.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[v.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full",style:{background:d.color}}),v.jsx("span",{className:"shrink-0 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:d.label}),v.jsxs("span",{className:"shrink-0 font-mono text-xs font-bold tabular-nums text-foreground",children:[Math.round(i[d.key]??0),"%"]}),s[d.key]&&v.jsx("span",{className:"truncate font-mono text-[10px] text-muted-foreground/60",children:s[d.key]})]},d.key))}),v.jsx(cV,{data:e,series:r,unit:"%",yMode:"percent",height:176})]}):v.jsx("div",{className:"flex h-44 items-center justify-center text-xs text-muted-foreground",children:"Lade Systemdaten…"})]}),(t==null?void 0:t.temp)&&(t.temp.cpu||t.temp.gpu)&&v.jsxs("div",{className:"mt-3 flex gap-4 border-t border-border/30 pt-3 font-mono text-xs text-muted-foreground/80",children:[t.temp.cpu!=null&&v.jsxs("span",{children:["CPU Temp: ",t.temp.cpu," °C"]}),t.temp.gpu!=null&&v.jsxs("span",{children:["GPU Temp: ",t.temp.gpu," °C"]})]})]})}function Lb({label:t,value:e,tone:n}){return v.jsxs("div",{className:nt("flex items-center justify-between rounded-lg border px-3 py-1.5 text-xs",n==="alert"?"border-amber-500/30 bg-amber-500/5 font-semibold text-amber-400":n==="accent"?"border-primary/30 bg-primary/5 font-semibold text-primary":"border-border/30 bg-background/25 text-muted-foreground"),children:[v.jsx("span",{className:"flex items-center gap-1.5",children:t}),v.jsx("span",{className:"font-mono text-[10px]",children:e})]})}function _fe(){var n;const{data:t}=AP(3e3),e=()=>window.dispatchEvent(new CustomEvent("open-system-drawer",{detail:{tab:"maintenance"}}));return v.jsxs("div",{className:"flex flex-col justify-between rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[v.jsxs("div",{className:"space-y-4",children:[v.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-border/20 pb-2",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(Q8,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Updates & Pflege"})]}),(t==null?void 0:t.last_check)&&v.jsxs("span",{className:"font-mono text-[9px] text-muted-foreground/80",children:["Zuletzt gesucht: ",new Date(t.last_check*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"})]})]}),t?v.jsxs("div",{className:"space-y-1.5",children:[v.jsx(Lb,{label:"OS-Pakete",tone:t.os>0?"alert":"muted",value:t.os>0?`${t.os} verfügbar`:"aktuell"}),v.jsx(Lb,{label:"Engine (llama.cpp)",tone:t.engine>0?"alert":"muted",value:t.engine>0?"Update verfügbar":"aktuell"}),v.jsx(Lb,{label:"Modell-Upgrades",tone:t.models>0?"accent":"muted",value:t.models>0?`${t.models} verfügbar`:"aktuell"}),(n=t.components)==null?void 0:n.map(r=>v.jsx(Lb,{tone:r.update===!0?"alert":"muted",label:v.jsxs(v.Fragment,{children:[r.name,r.reachable===!1&&v.jsx("span",{className:"text-[8px] font-bold uppercase text-red-400/80",children:"offline"})]}),value:r.update===!0?`Update: ${r.latest}`:r.update===!1?"aktuell":r.latest?`neueste: ${r.latest}`:"—"},r.key))]}):v.jsx("div",{className:"flex h-24 items-center justify-center text-xs text-muted-foreground",children:"Lade Updates..."})]}),v.jsxs("button",{onClick:e,className:"mt-4 flex h-9 w-full items-center justify-center gap-1.5 rounded-lg bg-primary text-xs font-semibold text-primary-foreground shadow-md shadow-primary/10 transition-all hover:opacity-90 cursor-pointer",children:["Updates verwalten & Pflege ",v.jsx(rF,{className:"h-3.5 w-3.5"})]})]})}function uV({type:t,title:e,message:n,defaultValue:r,autoValue:i,autoLabel:s,onConfirm:o,onCancel:a}){const l=R.useRef(null);return v.jsx("div",{className:"fixed inset-0 z-[99] bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:v.jsxs("div",{className:"w-full max-w-sm rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:e}),v.jsx("button",{onClick:a||(()=>o()),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:v.jsx(Bc,{className:"h-4 w-4"})})]}),v.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:n}),t==="prompt"&&v.jsxs("div",{className:"flex gap-2",children:[v.jsx("input",{ref:l,type:"text",defaultValue:r,className:"flex-1 h-9 px-3 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground",autoFocus:!0,onKeyDown:c=>{var d;c.key==="Enter"&&o((d=l.current)==null?void 0:d.value)}}),i!==void 0&&v.jsx("button",{type:"button",onClick:()=>{l.current&&(l.current.value=i)},title:"Setup-bewussten Optimalwert eintragen",className:"h-9 px-3 shrink-0 text-xs font-semibold text-primary border border-primary/50 bg-primary/10 hover:bg-primary/20 rounded-lg transition-colors cursor-pointer",children:s||"Auto"})]}),v.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[(t==="confirm"||t==="prompt")&&v.jsx("button",{onClick:a,className:"h-8 px-4 flex items-center justify-center text-xs font-semibold text-muted-foreground border border-border/60 bg-background/20 hover:bg-accent rounded-lg transition-colors cursor-pointer",children:"Abbrechen"}),v.jsx("button",{onClick:()=>{var d;const c=t==="prompt"?(d=l.current)==null?void 0:d.value:void 0;o(c)},className:"h-8 px-4 flex items-center justify-center text-xs font-semibold text-primary-foreground bg-primary hover:bg-primary/95 rounded-lg transition-colors cursor-pointer",children:t==="confirm"?"Ja, fortfahren":t==="prompt"?"Übernehmen":"OK"})]})]})})}function Qg(){const[t,e]=R.useState(null),n=R.useCallback(()=>e(null),[]),r=R.useCallback((a,l,c)=>{e({type:"alert",title:a,message:l,onConfirm:()=>{e(null),c==null||c()}})},[]),i=R.useCallback((a,l,c,d)=>{e({type:"confirm",title:a,message:l,onConfirm:()=>{e(null),c()},onCancel:()=>{e(null),d==null||d()}})},[]),s=R.useCallback((a,l,c,d,f,m)=>{e({type:"prompt",title:a,message:l,defaultValue:c,autoValue:m==null?void 0:m.autoValue,autoLabel:m==null?void 0:m.autoLabel,onConfirm:y=>{e(null),d(y)},onCancel:()=>{e(null),f==null||f()}})},[]),o=t?v.jsx(uV,{...t}):null;return{showAlert:r,showConfirm:i,showPrompt:s,close:n,dialogElement:o}}function wfe(){const t=$h(),{data:e}=EP(3e3),{data:n}=qh(),{showAlert:r,dialogElement:i}=Qg(),[s,o]=R.useState(!1),a=(n==null?void 0:n.models)??[];async function l(c){try{await jt("/api/agent/brain",{method:"POST",body:JSON.stringify({model:c})}),r("Erfolgreich",`Hermes-Gehirn wurde auf '${c}' geändert. Der Gateway-Dienst wurde neu gestartet.`),t.invalidateQueries({queryKey:Lr.agentStatus}),o(!1)}catch(d){r("Fehler",`Fehler beim Wechseln des Gehirns: ${d.message}`)}}return v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[v.jsxs("div",{children:[v.jsxs("div",{className:"flex items-center justify-between mb-4",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(qc,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Hermes Agent"})]}),(e==null?void 0:e.terminal_url)&&v.jsxs("a",{href:_g(e.terminal_url),target:"_blank",rel:"noopener",className:nt("flex items-center gap-1 px-3 py-1 rounded-lg text-xs font-medium transition-all",e.terminal_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/20":"border border-border text-muted-foreground"),children:[v.jsx(iy,{className:"h-3 w-3"})," Terminal öffnen"]})]}),e?v.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[v.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[v.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gateway"}),v.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[v.jsx("span",{className:nt("h-2 w-2 rounded-full",e.gateway_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),v.jsx("span",{className:"text-xs font-medium",children:e.gateway_reachable?"Online":"Offline"})]})]}),v.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[v.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Terminal"}),v.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[v.jsx("span",{className:nt("h-2 w-2 rounded-full",e.terminal_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),v.jsx("span",{className:"text-xs font-medium",children:e.terminal_reachable?"Online":"Offline"})]})]}),v.jsxs("div",{onClick:()=>o(!0),className:"p-3 bg-background/20 rounded-xl border border-border/40 hover:border-primary/45 hover:bg-background/30 transition-all duration-300 cursor-pointer",children:[v.jsxs("div",{className:"flex justify-between items-center",children:[v.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gehirn"}),v.jsx(El,{className:"h-3 w-3 text-primary"})]}),v.jsxs("div",{className:"text-xs font-medium mt-1 font-mono text-primary truncate flex items-center gap-1",children:[v.jsx(V1,{className:"h-3 w-3 shrink-0"}),e.brain_model||"auto"]})]}),v.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[v.jsxs("div",{className:"flex justify-between items-center",children:[v.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Verdrahtung"}),v.jsx(ew,{className:"h-3 w-3 text-primary"})]}),v.jsxs("div",{className:"text-[10px] font-mono mt-1 space-y-0.5 text-muted-foreground",children:[v.jsxs("div",{children:["Config: ",e.has_config?v.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]}),v.jsxs("div",{children:["Skills: ",e.has_skills?v.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]}),v.jsxs("div",{children:["Memory: ",e.has_memories?v.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]})]})]})]}):v.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Agenten-Status…"})]}),e&&v.jsxs("div",{className:"mt-3 border-t border-border/30 pt-3 space-y-1.5",children:[v.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[v.jsx("span",{children:"Telegram"}),v.jsx("span",{className:nt("font-semibold",e.telegram_enabled?"text-emerald-400":""),children:e.telegram_enabled?"aktiv":"nicht konfiguriert"})]}),v.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[v.jsx("span",{children:"MCP-Server"}),v.jsxs("span",{className:"font-semibold text-foreground",children:[e.mcp_server_count??0," verbunden"]})]}),v.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[v.jsx("span",{children:"PC Executor"}),v.jsx("span",{className:nt("font-semibold",e.pc_executor_reachable?"text-emerald-400":""),children:e.pc_executor_reachable?"erreichbar":"nicht verbunden"})]})]}),e&&s&&v.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:v.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[v.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[v.jsx(El,{className:"h-4 w-4"}),v.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),v.jsx("button",{onClick:()=>o(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:v.jsx(Bc,{className:"h-4 w-4"})})]}),v.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:['Das „Gehirn" ist das primäre LLM für Hermes. Wähle ein Modell aus deiner Bibliothek oder nutze ein Gateway-Alias (',v.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",v.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",v.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),v.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:["auto","fast","heavy",...a.map(c=>{var d;return((d=c.name.split("/").pop())==null?void 0:d.replace(".gguf",""))||c.name})].map(c=>{const d=["auto","fast","heavy"].includes(c);return v.jsxs("button",{onClick:()=>l(c),className:nt("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border border-border/30",e.brain_model===c||!e.brain_model&&c==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[v.jsxs("div",{className:"flex flex-col text-left",children:[v.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:c}),v.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:d?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(e.brain_model===c||!e.brain_model&&c==="auto")&&v.jsx(Go,{className:"h-4 w-4 shrink-0 text-primary"})]},c)})})]})}),i]})}function Sfe(){const{data:t}=qh(3e3),e=(t==null?void 0:t.models)??[],n=(t==null?void 0:t.running)??[];return v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[v.jsxs("div",{children:[v.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[v.jsx(V1,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Rollen-Belegung"})]}),v.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto pr-1 scrollbar-thin",children:YF.map(r=>{var o;const i=e.find(a=>a.role===r),s=i?n.includes(i.name):!1;return v.jsxs("div",{className:nt("flex items-center justify-between p-2 rounded-xl border transition-all duration-300",s?"border-emerald-500/30 bg-emerald-500/5 shadow-sm shadow-emerald-500/5":i?"border-primary/20 bg-primary/5":"border-border/30 bg-background/10 opacity-60"),children:[v.jsx("div",{className:"min-w-0 flex-1 mr-2",children:v.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[v.jsx("span",{className:nt("text-[9px] font-semibold uppercase px-1.5 py-0.5 rounded font-mono border tracking-wider shrink-0",CP(r)),children:r}),v.jsxs("div",{className:"flex flex-col min-w-0",children:[v.jsx("span",{className:"text-xs font-semibold truncate font-mono text-foreground",children:i?(o=i.name.split("/").pop())==null?void 0:o.replace(/\.gguf$/i,""):"nicht zugewiesen"}),i&&v.jsxs("div",{className:"flex gap-1 items-center mt-0.5 flex-wrap",children:[i.prompt_cache&&v.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-cyan-500/10 text-cyan-400 border border-cyan-500/20 px-1 py-0.5 rounded",title:"Prompt Caching aktiv",children:"PC"}),i.spec_active&&v.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-emerald-500/10 text-emerald-400 border border-emerald-500/20 px-1 py-0.5 rounded",title:`Speculative Decoding aktiv (Draft: ${i.spec_draft_model})`,children:"SPEC"}),i.parallel_slots>1&&v.jsxs("span",{className:"text-[7px] leading-none font-mono font-bold bg-violet-500/10 text-violet-400 border border-violet-500/20 px-1 py-0.5 rounded",title:`${i.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",i.parallel_slots]}),i.incomplete&&v.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-amber-500/10 text-amber-400 border border-amber-500/20 px-1 py-0.5 rounded",title:"GGUF-Datei fehlt",children:"⚠ fehlt"})]})]})]})}),v.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:i?s?v.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider font-mono",children:[v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]}):v.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground uppercase tracking-wider font-mono",children:"bereit"}):v.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground/60 uppercase tracking-wider font-mono",children:"—"})})]},r)})})]}),v.jsx("div",{className:"mt-4 text-[10px] text-muted-foreground/80 border-t border-border/30 pt-3",children:"Laden erfolgt automatisch per Auto-Swap."})]})}function Mfe(){const t=$h(),{data:e=[]}=jT({limit:3}),[n,r]=R.useState(""),[i,s]=R.useState("stable"),[o,a]=R.useState(!1);async function l(){if(!(!n.trim()||o)){a(!0);try{await jt("/api/memory",{method:"POST",body:JSON.stringify({content:n,category:i,source:"dashboard"})}),r(""),t.invalidateQueries({queryKey:["memory"]})}catch(c){console.error(c)}finally{a(!1)}}}return v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[v.jsxs("div",{children:[v.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[v.jsx(H1,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Gedächtnis"})]}),v.jsxs("div",{className:"space-y-3",children:[v.jsx("textarea",{value:n,onChange:c=>r(c.target.value),placeholder:"Fakt / Regel im Pool speichern...",rows:2,className:"w-full resize-none rounded-xl border border-border/50 bg-background/30 p-2 text-[10px] outline-none focus:ring-1 focus:ring-primary transition-all leading-normal"}),v.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[v.jsxs("select",{value:i,onChange:c=>s(c.target.value),className:"h-7 rounded-lg border border-border/50 bg-background/50 px-2 text-[10px] outline-none cursor-pointer",children:[v.jsx("option",{value:"stable",children:"🔵 Fakt"}),v.jsx("option",{value:"instruction",children:"📋 Regel"}),v.jsx("option",{value:"user",children:"👤 User"}),v.jsx("option",{value:"versioned",children:"🟡 Version"})]}),v.jsxs("button",{onClick:l,disabled:!n.trim()||o,className:"flex h-7 items-center gap-1 rounded-lg bg-primary px-3 text-[10px] font-semibold text-primary-foreground hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[v.jsx(NT,{className:"h-3.5 w-3.5"})," Speichern"]})]})]}),v.jsxs("div",{className:"mt-3.5 space-y-1.5",children:[v.jsx("div",{className:"text-[9px] text-muted-foreground uppercase font-bold tracking-wider",children:"Zuletzt gespeichert:"}),v.jsx("div",{className:"max-h-20 overflow-y-auto space-y-1 pr-1 scrollbar-thin",children:e.length===0?v.jsx("div",{className:"text-[10px] text-muted-foreground/75 py-1",children:"Keine Einträge vorhanden."}):e.map(c=>v.jsxs("div",{className:"text-[10px] bg-background/10 border border-border/30 rounded p-1.5 flex items-start gap-1.5",children:[v.jsx("span",{className:"shrink-0 text-[8px] font-mono text-muted-foreground/80 px-1 py-0.5 rounded bg-muted/20",children:c.category}),v.jsx("span",{className:"truncate flex-1 text-muted-foreground hover:text-foreground transition-colors",title:c.content,children:c.content})]},c.id))})]})]}),v.jsx("div",{className:"mt-4 text-[10px] text-muted-foreground/80 border-t border-border/30 pt-3",children:"Steht allen Clients per MCP zur Verfügung."})]})}const P3=[{key:"prompt",label:"Prompt",color:"#f59e0b"},{key:"completion",label:"Antwort",color:"#2dd4bf"}];function Efe(){const{data:t}=MP(3e3),e=rX(),n=e[e.length-1],r=n?Math.round(n.prompt+n.completion):0;return v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[v.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[v.jsxs("div",{children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(ry,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Token-Durchsatz"}),v.jsxs("span",{className:"ml-1 inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground/70",children:[v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," live"]})]}),t&&v.jsxs("div",{className:"mt-2 flex items-baseline gap-2",children:[v.jsx("span",{className:"font-space text-3xl font-bold tracking-tight text-foreground tabular-nums",children:r.toLocaleString("de-DE")}),v.jsx("span",{className:"text-xs text-muted-foreground",children:"tok/s aktuell"})]}),t&&v.jsxs("div",{className:"mt-0.5 space-y-0.5 font-mono text-[11px] text-muted-foreground/70",children:[v.jsxs("div",{children:[t.total_tokens.toLocaleString("de-DE")," Tokens gesamt · ",v.jsxs("span",{className:"text-emerald-400/90",children:[t.saved_eur.toLocaleString("de-DE",{minimumFractionDigits:2})," € gespart"]})]}),v.jsxs("div",{className:"text-muted-foreground/55",children:["Input ",t.prompt_tokens.toLocaleString("de-DE")," · Output ",t.completion_tokens.toLocaleString("de-DE")]})]})]}),v.jsx("div",{className:"flex shrink-0 flex-col items-end gap-1.5 pt-1",children:P3.map(i=>v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:i.color}}),v.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:i.label}),v.jsx("span",{className:"font-mono text-xs font-bold tabular-nums text-foreground",children:Math.round((n==null?void 0:n[i.key])??0)})]},i.key))})]}),t?v.jsx(cV,{data:e,series:P3,unit:" tok/s",yMode:"auto",height:150}):v.jsx("div",{className:"flex h-[150px] items-center justify-center text-xs text-muted-foreground",children:"Lade Durchsatz…"}),v.jsx("div",{className:"mt-2 border-t border-border/30 pt-2 text-[10px] text-muted-foreground/70",children:"Durchsatz aus dem Gateway abgeleitet (Prefill vs. Generierung). Flach bei Leerlauf."})]})}function Afe(){const{data:t}=d7(3e3),{showAlert:e,dialogElement:n}=Qg(),[r,i]=R.useState({});async function s(o){i(a=>({...a,[o]:!0}));try{const a=await jt("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:o})});a.ok||e("Fehler",`Neustart fehlgeschlagen: ${a.err||"Unbekannt"}`)}catch(a){e("Fehler",`Fehler: ${a.message}`)}finally{i(a=>({...a,[o]:!1}))}}return v.jsxs("div",{className:"flex flex-col rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[v.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(xP,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Dienste"})]}),v.jsx("button",{onClick:()=>window.dispatchEvent(new CustomEvent("open-system-drawer",{detail:{tab:"logs"}})),className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground transition-colors hover:text-primary cursor-pointer",children:"Logs / Pflege"})]}),t?v.jsxs("div",{className:"flex flex-1 flex-col",children:[v.jsx("div",{className:"space-y-1.5",children:t.services.map(o=>v.jsxs("div",{className:"group flex items-center justify-between gap-2 rounded-xl border border-border/30 bg-background/20 p-2.5",children:[v.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[v.jsx("span",{className:nt("h-2.5 w-2.5 shrink-0 rounded-full ring-2 ring-black/40",o.ok?"bg-emerald-500":"bg-amber-500")}),v.jsxs("div",{className:"min-w-0",children:[v.jsx("div",{className:"truncate text-xs font-bold text-foreground",children:o.name}),v.jsx("div",{className:"truncate font-mono text-[9px] text-muted-foreground/60",children:o.url})]})]}),v.jsx("button",{onClick:()=>s(o.name),disabled:r[o.name],className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-lg border border-border/40 text-muted-foreground opacity-0 transition-all hover:bg-primary/5 hover:text-primary group-hover:opacity-100",title:"Dienst neu starten",children:v.jsx(B0,{className:nt("h-3.5 w-3.5",r[o.name]&&"animate-spin")})})]},o.name))}),v.jsxs("div",{className:"mt-auto flex flex-wrap gap-3 border-t border-border/20 pt-2.5 text-[10px] font-semibold text-muted-foreground",children:[v.jsxs("a",{href:_g(t.links.engine_ui),target:"_blank",rel:"noopener",className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-primary transition-colors hover:bg-primary/10",children:[v.jsx(iy,{className:"h-3 w-3"})," Engine"]}),v.jsxs("a",{href:_g(t.links.gateway),target:"_blank",rel:"noopener",className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-primary transition-colors hover:bg-primary/10",children:[v.jsx(iy,{className:"h-3 w-3"})," Gateway"]})]})]}):v.jsx("div",{className:"flex h-24 items-center justify-center text-xs text-muted-foreground",children:"Lade Dienste…"}),n]})}function R3({children:t}){return v.jsx("p",{className:"mb-2 ml-0.5 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/60",children:t})}function Tfe(){return v.jsxs("div",{className:"space-y-7",children:[v.jsxs("div",{children:[v.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Zentrale"}),v.jsx("p",{className:"text-sm text-muted-foreground",children:"Aktueller Status von System, Modellen und Agent."})]}),v.jsxs("div",{className:"grid items-stretch gap-6 lg:grid-cols-3",children:[v.jsx(bfe,{}),v.jsx(Efe,{}),v.jsx(J7,{})]}),v.jsxs("section",{children:[v.jsx(R3,{children:"Stack-Status"}),v.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[v.jsx(Sfe,{}),v.jsx(Afe,{})]})]}),v.jsxs("section",{children:[v.jsx(R3,{children:"Betrieb & Wissen"}),v.jsxs("div",{className:"grid gap-6 md:grid-cols-3",children:[v.jsx(_fe,{}),v.jsx(wfe,{}),v.jsx(Mfe,{})]})]})]})}function Cfe(){const t=$h(),{data:e=[]}=h7(2e3),{showAlert:n,dialogElement:r}=Qg();async function i(a){try{await jt(`/api/jobs/${a}/cancel`,{method:"POST"}),t.invalidateQueries({queryKey:Lr.jobs})}catch(l){n("Fehler",l.message)}}const s=e.filter(a=>a.state==="running"||a.state==="queued"),o=e.filter(a=>a.state!=="running"&&a.state!=="queued").slice(-3);return s.length===0&&o.length===0?null:v.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-4 shadow-lg shadow-black/10",children:[v.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Aktive Downloads"}),s.map(a=>v.jsxs("div",{className:"space-y-1.5 p-3 rounded-xl bg-background/20 border border-border/40",children:[v.jsxs("div",{className:"flex justify-between items-center text-xs",children:[v.jsx("span",{className:"font-semibold truncate max-w-[250px]",children:a.label}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsxs("span",{className:"text-muted-foreground font-mono",children:[a.progress??0,"% • ",FT(a.done_bytes),"/",FT(a.total_bytes),a.eta_s?` • ETA ${y7(a.eta_s)}`:""]}),v.jsx("button",{onClick:()=>i(a.id),className:"text-[10px] text-red-400 hover:text-red-300 font-semibold border border-red-500/25 bg-red-500/5 px-2 py-0.5 rounded transition-all cursor-pointer",children:"Abbrechen"})]})]}),v.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:v.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-500",style:{width:`${a.progress??0}%`}})})]},a.id)),o.map(a=>v.jsxs("div",{className:"flex justify-between items-center text-xs text-muted-foreground px-1",children:[v.jsx("span",{className:"truncate",children:a.label}),v.jsx("span",{className:nt("font-semibold text-[10px] px-1.5 py-0.5 rounded uppercase font-mono",a.state==="done"?"bg-emerald-500/10 text-emerald-400":"bg-amber-500/10 text-amber-400"),children:a.state})]},a.id)),r]})}function Af({children:t,tone:e="muted"}){const n={muted:"bg-muted text-muted-foreground",primary:"bg-primary/15 text-primary",warn:"bg-amber-500/15 text-amber-500"};return v.jsx("span",{className:`rounded px-1.5 py-0.5 text-[11px] font-medium ${n[e]}`,children:t})}function N3({caps:t}){return t?v.jsxs("span",{className:"inline-flex flex-wrap gap-1",children:[t.coder&&v.jsx(Af,{children:"💻 Code"}),t.vision&&v.jsx(Af,{children:"👁 Bild"}),t.reasoning&&v.jsx(Af,{children:"🧠 Reason"}),t.moe&&v.jsxs(Af,{tone:"primary",children:["🧩 MoE",t.active_b?`·${t.active_b}b`:""]}),t.tools==="yes"&&v.jsx(Af,{tone:"primary",children:"🛠 Tools"}),t.tools==="likely"&&v.jsx(Af,{tone:"warn",children:"🛠 Tools?"}),t.embedding&&v.jsx(Af,{children:"🔢 Embed"})]}):null}function Pfe({model:t,onClose:e,onChanged:n}){var S,_;const{data:r,isLoading:i}=g7(t.gguf_path),[s,o]=R.useState(null),[a,l]=R.useState(""),c=r==null?void 0:r.target_vocab,d=(r==null?void 0:r.drafts)??[],f=d.filter(w=>w.compatible===!0),m=t.spec_draft_model;async function y(w){o(w??"__clear__"),l("");try{await jt(`/api/models/${encodeURIComponent(t.name)}/draft`,{method:"POST",body:JSON.stringify({draft_path:w})}),n(),e()}catch(A){l(String((A==null?void 0:A.message)||A)),o(null)}}const x=w=>{var A;return w?`${w.pre??"?"} · ${((A=w.n_vocab)==null?void 0:A.toLocaleString())??"?"} Tokens`:"—"};return v.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:v.jsxs("div",{className:"w-full max-w-lg rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[v.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-2",children:[v.jsx(xh,{className:"h-4 w-4"})," Speculative Draft"]}),v.jsx("button",{onClick:e,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:v.jsx(Bc,{className:"h-4 w-4"})})]}),v.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed",children:['Beschleunigt die Token-Generierung mit einem kleinen "Draft"-Modell. Voraussetzung: der Draft muss den ',v.jsx("strong",{className:"text-foreground",children:"exakt gleichen Tokenizer (Vocab)"})," haben wie das Modell — sonst lehnt llama.cpp es ab."]}),v.jsxs("div",{className:"rounded-lg border border-border/40 bg-background/30 px-3 py-2 text-[11px] font-mono flex items-center justify-between",children:[v.jsx("span",{className:"text-muted-foreground",children:(S=t.name.split("/").pop())==null?void 0:S.replace(/\.gguf$/i,"")}),v.jsxs("span",{className:"text-foreground",children:["Vocab: ",x(c)]})]}),t.spec_active&&m&&v.jsxs("div",{className:"rounded-lg border border-emerald-500/30 bg-emerald-500/5 px-3 py-2 flex items-center justify-between gap-2",children:[v.jsxs("span",{className:"text-[11px] text-emerald-400 font-mono flex items-center gap-1.5 truncate",children:[v.jsx(Go,{className:"h-3.5 w-3.5 shrink-0"})," Aktiv: ",m]}),v.jsx("button",{onClick:()=>y(null),disabled:s!==null,className:"h-6 px-2.5 rounded border border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/10 text-amber-400 text-[9px] font-bold uppercase shrink-0 cursor-pointer disabled:opacity-50",children:"Deaktivieren"})]}),!(r!=null&&r.target_exists)&&v.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-[11px] text-amber-400 flex items-center gap-2",children:[v.jsx(yg,{className:"h-3.5 w-3.5 shrink-0"}),"Modell-GGUF noch nicht vorhanden — Spec-Draft ist nach dem Download konfigurierbar."]}),v.jsx("div",{className:"space-y-1.5 max-h-64 overflow-y-auto pr-1",children:i?v.jsx("div",{className:"text-xs text-muted-foreground py-6 text-center",children:"Prüfe Vocab-Kompatibilität…"}):d.length===0?v.jsxs("div",{className:"text-[11px] text-muted-foreground border border-dashed border-border/50 rounded-lg p-4 text-center",children:["Keine Draft-Modelle in ",v.jsx("code",{className:"font-mono",children:"/srv/models/drafts"}),". Lade ein kleines same-family-Modell (z.B. Qwen3-0.6B) und lege es dort ab."]}):d.map(w=>{var C,O;const A=w.filename===m,T=w.compatible===!0;return v.jsxs("div",{className:nt("rounded-lg border px-3 py-2 flex items-center justify-between gap-2 text-left",T?"border-border/40 bg-background/20":"border-border/20 bg-background/10 opacity-60",A&&"border-primary/40 bg-primary/10"),children:[v.jsxs("div",{className:"min-w-0",children:[v.jsx("div",{className:"text-[11px] font-mono font-semibold text-foreground truncate",children:w.filename}),v.jsxs("div",{className:"text-[9px] text-muted-foreground font-mono",children:[Bo(w.size_bytes)," · Vocab: ",x(w.vocab)]})]}),T?A?v.jsxs("span",{className:"text-[9px] font-bold uppercase text-primary flex items-center gap-1 shrink-0",children:[v.jsx(Go,{className:"h-3.5 w-3.5"})," Aktiv"]}):v.jsx("button",{onClick:()=>y(w.path),disabled:s!==null,className:"h-7 px-3 rounded-lg border border-emerald-500/30 bg-emerald-500/5 hover:bg-emerald-500/15 text-emerald-400 text-[9px] font-bold uppercase shrink-0 cursor-pointer disabled:opacity-50",children:"Aktivieren"}):v.jsxs("span",{className:"text-[9px] font-bold uppercase text-amber-400/80 flex items-center gap-1 shrink-0",title:w.compatible===!1?`Inkompatibel: Tokenizer/Vocab weicht ab (Draft ${(C=w.vocab)==null?void 0:C.pre}/${(O=w.vocab)==null?void 0:O.n_vocab} ≠ Modell ${c==null?void 0:c.pre}/${c==null?void 0:c.n_vocab}).`:"Kompatibilität nicht prüfbar (Datei fehlt).",children:[v.jsx(yg,{className:"h-3.5 w-3.5"})," ",w.compatible===!1?"Vocab ≠":"n/a"]})]},w.path)})}),!i&&(r==null?void 0:r.target_exists)&&d.length>0&&f.length===0&&v.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-[11px] text-amber-400 leading-relaxed",children:["Kein vocab-kompatibler Draft verfügbar — Speculative Decoding ist für dieses Modell nicht möglich. Es braucht einen Draft mit identischem Tokenizer (pre=",v.jsx("span",{className:"font-mono",children:c==null?void 0:c.pre}),", n_vocab=",v.jsx("span",{className:"font-mono",children:(_=c==null?void 0:c.n_vocab)==null?void 0:_.toLocaleString()}),")."]}),a&&v.jsx("div",{className:"text-[10px] text-red-400 font-mono",children:a})]})})}function Rfe(){var rt,ft,nn,qe,dt,Dt,Ut,pt;const t=$h(),{data:e,isLoading:n,error:r}=qh(4e3),{data:i}=f7(4e3),{data:s}=VF(),{data:o}=AP(4e3),{data:a}=p7(),{data:l}=K1(),{showAlert:c,showConfirm:d,showPrompt:f,dialogElement:m}=Qg(),y=(e==null?void 0:e.models)??[],x=(e==null?void 0:e.running)??[],S=r?String(r):"",_=()=>{t.invalidateQueries({queryKey:Lr.models}),t.invalidateQueries({queryKey:Lr.routing})},[w,A]=R.useState(null),[T,C]=R.useState(null),[O,N]=R.useState(null),[D,F]=R.useState(null),[V,k]=R.useState(!1),[j,H]=R.useState(!1),[ne,te]=R.useState(null),[pe,oe]=R.useState("grid"),[ce,B]=R.useState("all"),K=y.filter(de=>ce==="in_use"?!!de.role||x.includes(de.name):!0),[q,$]=R.useState({width:800,height:360}),Z=R.useRef(null),ge=R.useCallback(de=>{if(Z.current&&(Z.current.disconnect(),Z.current=null),de){const J=new ResizeObserver(Ae=>{if(!Ae||Ae.length===0)return;const re=Ae[0].contentRect;$({width:re.width,height:re.height})});J.observe(de),Z.current=J}},[]),ae=q.width,fe=q.height,_e=de=>{const J=ae*.1,Ae=fe*de,re=ae*.5,Fe=fe*.5,Te=ae*.3,Le=Ae,Ke=ae*.3;return`M ${J} ${Ae} C ${Te} ${Le}, ${Ke} ${Fe}, ${re} ${Fe}`},Se=de=>{const J=ae*.5,Ae=fe*.5,re=ae*.9,Fe=fe*de,Te=ae*.7,Le=Ae,Ke=ae*.7;return`M ${J} ${Ae} C ${Te} ${Le}, ${Ke} ${Fe}, ${re} ${Fe}`};async function $e(de){try{await jt(`/api/models/${encodeURIComponent(de)}/load`,{method:"POST"}),_()}catch(J){c("Fehler",`Fehler beim Laden des Modells: ${J.message}`)}}async function Me(de){try{await jt(`/api/models/${encodeURIComponent(de)}/unload`,{method:"POST"}),_()}catch(J){c("Fehler",`Fehler beim Entladen des Modells: ${J.message}`)}}async function He(){try{await jt("/api/models/unload",{method:"POST"}),_()}catch(de){c("Fehler",`Fehler beim Entladen aller Modelle: ${de.message}`)}}async function Xe(de,J){try{await jt(`/api/models/${encodeURIComponent(J)}/role`,{method:"POST",body:JSON.stringify({role:de||null})}),_()}catch(Ae){c("Fehler",`Fehler beim Zuweisen der Rolle: ${Ae.message||Ae}`)}}function ue(de){C(de),N(null),jt(`/api/roles/${encodeURIComponent(de)}/recommend`).then(J=>N(J)).catch(()=>{})}async function Q(de,J){let Ae=null;try{Ae=await jt(`/api/models/${encodeURIComponent(de)}/ctx/auto`)}catch{}const re=Ae?`Optimal für dein Setup: ${(Ae.ctx/1024).toFixed(0)}k (${Ae.ctx}) — GTT ${Ae.gtt_gb} GB − reserviert ${Ae.reserved_gb} GB (${Ae.mode}) → ${Ae.budget_gb} GB frei. »Auto« trägt diesen Wert ein.`:"Gib die gewünschte Kontextlänge in Tokens an:";f("Kontextlänge anpassen",re,String(J||32768),async Fe=>{if(Fe)try{await jt(`/api/models/${encodeURIComponent(de)}/ctx`,{method:"POST",body:JSON.stringify({ctx:parseInt(Fe,10)})}),_()}catch(Te){c("Fehler",`Fehler beim Setzen des Kontexts: ${Te.message||Te}`)}},void 0,Ae?{autoValue:String(Ae.ctx),autoLabel:`Auto (${(Ae.ctx/1024).toFixed(0)}k)`}:void 0)}async function Ge(de){d("Modell löschen?",`Modell '${de}' und alle zugehörigen GGUF-Dateien unwiderruflich von der Box löschen?`,async()=>{try{await jt(`/api/models/${encodeURIComponent(de)}`,{method:"DELETE"}),_()}catch(J){c("Fehler",`Fehler beim Löschen: ${J.message||J}`)}})}async function Ue(de,J,Ae,re){try{await jt("/api/models/install",{method:"POST",body:JSON.stringify({repo:de,role:J,quant:Ae,jinja:re})}),c("Herunterladen gestartet",`Download für '${de}' gestartet! Der Fortschritt wird oben angezeigt.`)}catch(Fe){c("Fehler",`Fehler beim Starten des Upgrades: ${Fe.message||Fe}`)}}async function We(de){const J=a==null?void 0:a.budget,Ae=J&&!J.fits?`
|
||
|
||
⚠ Speicher-Warnung: Dieses Brain (~${J.brain_gb} GB) muss immer resident sein. Zusammen mit dem größten on-demand-Modell (~${J.largest_ondemand_gb} GB) sprengt das das Budget (${J.gtt_gb} GB) → heavy/coder würden das Brain verdrängen. Erwäge ein kleineres Brain oder weniger Kontext.`:"";d("Agent-Hirn aktualisieren?",`Neues Hermes-Modell '${de.split("/").pop()}' herunterladen und als Agent-Hirn (Rolle hermes) setzen? Hermes nutzt danach automatisch das neue Modell.${Ae}`,async()=>{try{await jt("/api/models/install",{method:"POST",body:JSON.stringify({repo:de,role:"hermes",quant:"Q4_K_M",jinja:!0})}),c("Download gestartet","Das neue Agent-Hirn wird geladen. Fortschritt oben."),_()}catch(re){c("Fehler",`Update fehlgeschlagen: ${re.message||re}`)}})}async function Qe(de){d("Agent-Hirn wechseln?",`'${de.split("/").pop()}' als Agent-Hirn (Alias hermes) setzen? Es wird warm gehalten (brains-Gruppe); Hermes nutzt es nach einem kurzen Gateway-Restart.`,async()=>{try{await jt("/api/agent/brain/set",{method:"POST",body:JSON.stringify({model_id:de})}),c("Erledigt","Agent-Hirn gewechselt. Gateway wurde neugestartet."),k(!1),_()}catch(J){c("Fehler",`Wechsel fehlgeschlagen: ${J.message||J}`)}})}async function xt(de){de&&(await navigator.clipboard.writeText(de),H(!0),setTimeout(()=>H(!1),1500))}if(n)return v.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Initialisiere HUD Cockpit…"});if(S)return v.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Gateway oder Engine nicht erreichbar (",S,")."]});const at=y.filter(de=>x.includes(de.name)),ee=at.reduce((de,J)=>de+(J.size_bytes||0),0),W=((rt=l==null?void 0:l.gpu)==null?void 0:rt.gtt_total)||((ft=l==null?void 0:l.gpu)==null?void 0:ft.vram_total)||0,Ee=((nn=l==null?void 0:l.gpu)==null?void 0:nn.gtt_used)||0,Be=16*1024**3,le=W>2*1024**3?W:ee>Be?ee*1.2:Be,Ce=de=>y.find(J=>J.role===de),lt=de=>{const J=Ce(de);return J?x.includes(J.name):!1};return v.jsxs("div",{className:"space-y-8",children:[v.jsx("style",{children:`
|
||
@keyframes flow-dash {
|
||
to {
|
||
stroke-dashoffset: -20;
|
||
}
|
||
}
|
||
.svg-flow-path {
|
||
stroke-dasharray: 4 6;
|
||
animation: flow-dash 1s linear infinite;
|
||
}
|
||
`}),v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[v.jsxs("div",{className:"flex justify-between items-center",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(tE,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"VRAM / Memory Belegung"})]}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground",children:["Speicher-Pool: ",Bo(ee)," Gewichte",Ee>0?` · ${Bo(Ee)} real belegt (inkl. KV)`:""," / ",Bo(le)]}),x.length>0&&v.jsx("button",{onClick:He,className:"h-6 px-2.5 rounded border border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/10 text-amber-400 text-[9px] font-bold uppercase transition-all cursor-pointer",children:"Alle entladen"})]})]}),v.jsx("div",{className:"h-7 w-full rounded-xl bg-background/50 border border-border/40 overflow-hidden flex p-0.5 relative group",children:at.length===0?v.jsx("div",{className:"w-full h-full flex items-center justify-center text-[10px] text-muted-foreground/60 italic font-mono select-none",children:"VRAM Leer — Auto-Swap lädt Modelle bei Anfrage"}):at.map((de,J)=>{var Fe;const Ae=(de.size_bytes||0)/le*100,re=["from-teal-500 to-emerald-500","from-indigo-500 to-blue-500","from-purple-500 to-pink-500","from-cyan-500 to-sky-500"][J%4];return v.jsxs("div",{style:{width:`${Ae}%`},className:nt("h-full rounded bg-gradient-to-r flex items-center justify-between px-2.5 transition-all text-white/95 shrink-0 shadow-inner select-none",re),title:`${de.name} (${Bo(de.size_bytes)})`,children:[v.jsxs("span",{className:"text-[9px] font-bold truncate max-w-[120px] font-space tracking-wide",children:[de.role?`[${de.role}] `:"",(Fe=de.name.split("/").pop())==null?void 0:Fe.replace(".gguf","")]}),v.jsx("span",{className:"text-[8px] font-mono opacity-80",children:Bo(de.size_bytes)})]},de.name)})})]}),v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-4",children:[v.jsxs("div",{children:[v.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Gateway Graph"}),v.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 leading-relaxed",children:"Klicke links auf Editoren, um Configs zu kopieren. Klicke rechts auf Rollen, um GGUF-Zuweisungen live zu ändern."})]}),v.jsxs("div",{ref:ge,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[v.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[v.jsxs("defs",{children:[v.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[v.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),v.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),v.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[v.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),v.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),v.jsx("path",{d:_e(.1),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(ne==="roocode"||w==="roocode")&&v.jsx("path",{d:_e(.1),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:_e(.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(ne==="cursor"||w==="cursor")&&v.jsx("path",{d:_e(.3),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:_e(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(ne==="opencode"||w==="opencode")&&v.jsx("path",{d:_e(.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:_e(.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(ne==="zed"||w==="zed")&&v.jsx("path",{d:_e(.7),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:_e(.9),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(ne==="continue"||w==="continue")&&v.jsx("path",{d:_e(.9),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:Se(.12),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),lt("fast")&&v.jsx("path",{d:Se(.12),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:Se(.31),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),lt("heavy")&&v.jsx("path",{d:Se(.31),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:Se(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),lt("coder")&&v.jsx("path",{d:Se(.5),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:Se(.69),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),lt("vision")&&v.jsx("path",{d:Se(.69),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:Se(.88),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),lt("scout")&&v.jsx("path",{d:Se(.88),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),v.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"10%"},onMouseEnter:()=>te("roocode"),onMouseLeave:()=>te(null),onClick:()=>A(de=>de==="roocode"?null:"roocode"),children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),v.jsx("span",{children:"Roo Code"})]}),v.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"30%"},onMouseEnter:()=>te("cursor"),onMouseLeave:()=>te(null),onClick:()=>A(de=>de==="cursor"?null:"cursor"),children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),v.jsx("span",{children:"Cursor IDE"})]}),v.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"50%"},onMouseEnter:()=>te("opencode"),onMouseLeave:()=>te(null),onClick:()=>A(de=>de==="opencode"?null:"opencode"),children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),v.jsx("span",{children:"OpenCode"})]}),v.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"70%"},onMouseEnter:()=>te("zed"),onMouseLeave:()=>te(null),onClick:()=>A(de=>de==="zed"?null:"zed"),children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),v.jsx("span",{children:"Zed"})]}),v.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"90%"},onMouseEnter:()=>te("continue"),onMouseLeave:()=>te(null),onClick:()=>A(de=>de==="continue"?null:"continue"),children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),v.jsx("span",{children:"Continue"})]}),v.jsxs("div",{className:"absolute select-none z-10 w-36 py-3 px-4 -translate-y-1/2 -translate-x-1/2 rounded-2xl border border-primary/50 bg-card/90 backdrop-blur-md flex flex-col items-center justify-center text-center shadow-lg shadow-primary/5",style:{left:"50%",top:"50%"},children:[v.jsx("div",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Gateway Auto"}),v.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground mt-0.5",children:["Schwelle: > ",i!=null&&i.heavy_threshold_chars?i.heavy_threshold_chars/1e3:"4","k Zeichen"]}),v.jsx("div",{className:"mt-1 px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[9px] font-semibold text-primary uppercase font-mono",children:"Auto-Swap"})]}),YF.map(de=>{var Te;const J=["12%","31%","50%","69%","88%"],Ae=Ce(de),re=Ae?x.includes(Ae.name):!1;if(de==="agent")return null;const Fe={fast:0,heavy:1,coder:2,vision:3,scout:4}[de];return v.jsxs("div",{className:nt("absolute z-10 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none cursor-pointer",re?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":Ae?"border-border/60 bg-card/75":"border-dashed border-border/40 bg-background/20"),style:{left:"90%",top:J[Fe]},onClick:()=>ue(de),children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:de}),re&&v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),v.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground max-w-[150px]",children:Ae?(Te=Ae.name.split("/").pop())==null?void 0:Te.replace(".gguf",""):"Keine Zuweisung"})]},de)}),w&&s&&v.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:v.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200 flex flex-col justify-between",children:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[v.jsxs("span",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:[w==="roocode"&&"Roo Code Setup",w==="cursor"&&"Cursor Setup",w==="opencode"&&"OpenCode Setup",w==="zed"&&"Zed Setup",w==="continue"&&"Continue Setup"]}),v.jsx("button",{onClick:()=>A(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:v.jsx(Bc,{className:"h-4 w-4"})})]}),v.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed space-y-2",children:[w==="roocode"&&v.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[v.jsxs("li",{children:["Suche in VS Code nach der Erweiterung ",v.jsx("strong",{children:"Roo Code"})," und installiere sie."]}),v.jsxs("li",{children:["Wähle in den Roo Code Einstellungen: Provider: ",v.jsx("strong",{children:"OpenAI Compatible"}),"."]}),v.jsxs("li",{children:["Füge das untenstehende JSON-Snippet in die ",v.jsx("code",{children:"settings.json"})," ein."]})]}),w==="cursor"&&v.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[v.jsxs("li",{children:["Öffne Cursor Settings ➔ ",v.jsx("strong",{children:"Models"}),"."]}),v.jsxs("li",{children:["Deaktiviere Cloud-Modelle, klappe ",v.jsx("strong",{children:"OpenAI API"})," auf."]}),v.jsxs("li",{children:["Trage die Base URL unten ein und aktiviere das Modell ",v.jsx("strong",{children:"auto"}),"."]})]}),w==="opencode"&&v.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[v.jsxs("li",{children:["Öffne die ",v.jsx("code",{children:"opencode.jsonc"})," Konfigurationsdatei."]}),v.jsxs("li",{children:["Ersetze den Provider-Eintrag unter ",v.jsx("code",{children:"provider"})," mit dem Snippet unten."]})]}),w==="zed"&&v.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[v.jsxs("li",{children:["Öffne die Zed Settings (",v.jsx("code",{children:"ctrl+,"}),")."]}),v.jsxs("li",{children:["Füge das untenstehende JSON-Segment unter ",v.jsx("code",{children:"language_models"})," ein."]})]}),w==="continue"&&v.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[v.jsx("li",{children:"Klicke auf das Zahnrad-Symbol in der Continue-Erweiterung."}),v.jsxs("li",{children:["Füge den Gateway-Eintrag zum ",v.jsx("code",{children:"models"}),"-Array hinzu."]})]})]}),s.tools&&v.jsxs("div",{className:"relative rounded-xl border border-border/40 bg-black/40 overflow-hidden mt-1 shrink-0",children:[v.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border/20 bg-black/20",children:[v.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:"JSON Config"}),v.jsxs("button",{onClick:()=>{var de,J,Ae,re,Fe;return xt(w==="roocode"?(de=s.tools.cline)==null?void 0:de.snippet:w==="cursor"?(J=s.tools.cursor)==null?void 0:J.snippet:w==="opencode"?(Ae=s.tools.opencode)==null?void 0:Ae.snippet:w==="zed"?(re=s.tools.zed)==null?void 0:re.snippet:(Fe=s.tools.continue)==null?void 0:Fe.snippet)},className:"text-xs font-semibold text-primary hover:text-primary-foreground flex items-center gap-1 cursor-pointer",children:[j?v.jsx(Go,{className:"h-3.5 w-3.5 text-emerald-400"}):v.jsx(J_,{className:"h-3.5 w-3.5"}),v.jsx("span",{children:j?"Kopiert":"Kopieren"})]})]}),v.jsx("pre",{className:"p-3 max-h-48 overflow-y-auto text-xs font-mono text-cyan-200/90 whitespace-pre scrollbar-thin select-text",children:v.jsxs("code",{children:[w==="roocode"&&((qe=s.tools.cline)==null?void 0:qe.snippet),w==="cursor"&&((dt=s.tools.cursor)==null?void 0:dt.snippet),w==="opencode"&&((Dt=s.tools.opencode)==null?void 0:Dt.snippet),w==="zed"&&((Ut=s.tools.zed)==null?void 0:Ut.snippet),w==="continue"&&((pt=s.tools.continue)==null?void 0:pt.snippet)]})})]}),v.jsx("button",{onClick:()=>A(null),className:"w-full h-9 rounded-lg bg-primary text-primary-foreground hover:opacity-90 font-semibold text-xs transition-opacity cursor-pointer mt-2",children:"Schließen"})]})})]}),v.jsxs("div",{className:"flex flex-wrap items-center gap-6 mt-3 text-[10px] text-muted-foreground border-t border-border/20 pt-3",children:[v.jsxs("span",{className:"flex items-center gap-1.5",children:[v.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),v.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Gateway"})]}),v.jsxs("span",{className:"flex items-center gap-1.5",children:[v.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),v.jsx("span",{children:"Grüner Puls: Aktive Verbindung / Warmes Modell geladen"})]}),v.jsxs("span",{className:"flex items-center gap-1.5",children:[v.jsx("span",{className:"h-2 w-2 rounded bg-gradient-to-r from-teal-500 to-emerald-500"}),v.jsx("span",{children:"VRAM-Verlauf: Modellspezifischer Speicheranteil"})]})]})]}),v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[v.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground px-1",children:"Gateway Steckplatz-Belegung (Slot-Zuweisung)"}),v.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3",children:["fast","heavy","coder","vision","scout"].map(de=>{var re;const J=y.find(Fe=>Fe.role===de),Ae=J?x.includes(J.name):!1;return v.jsxs("div",{onClick:()=>ue(de),className:nt("rounded-xl border p-3 flex flex-col justify-between gap-2.5 transition-all cursor-pointer select-none text-left bg-background/25 hover:border-primary/45 hover:bg-background/40 group min-h-[90px]",Ae?"border-emerald-500/40 shadow-sm shadow-emerald-500/5":J?"border-primary/20 bg-primary/5":"border-border/30 border-dashed opacity-75"),children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("span",{className:nt("text-[9px] font-bold uppercase tracking-wider font-mono px-1.5 py-0.5 rounded border",CP(de)),children:de}),Ae&&v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),v.jsx("div",{className:"text-[10px] font-mono font-medium truncate text-foreground/90 pr-1 font-space",title:J==null?void 0:J.name,children:J?(re=J.name.split("/").pop())==null?void 0:re.replace(/\.gguf$/i,""):"nicht zugewiesen"}),v.jsx("div",{className:"text-[8px] text-primary/70 group-hover:text-primary font-bold uppercase tracking-wider transition-colors font-space",children:"Ändern ➔"})]},de)})})]}),(a==null?void 0:a.current)&&v.jsxs("div",{className:"rounded-2xl border border-indigo-500/30 bg-indigo-500/5 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[v.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(qc,{className:"h-4.5 w-4.5 text-indigo-400"}),v.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Agent-Hirn (Hermes)"}),a.current.version!=null&&v.jsxs("span",{className:"text-[9px] font-mono px-1.5 py-0.5 rounded bg-indigo-500/15 text-indigo-300 border border-indigo-500/25",children:["v",a.current.version]})]}),v.jsx("button",{onClick:()=>k(!0),className:"h-7 px-3 rounded-lg border border-indigo-500/30 bg-indigo-500/5 text-indigo-300 text-[9px] font-bold uppercase hover:bg-indigo-500/15 transition-all cursor-pointer",children:"Hirn wechseln"})]}),v.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 rounded-xl bg-background/30 border border-border/30 p-3.5",children:[v.jsxs("div",{className:"min-w-0",children:[v.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:a.current.name,children:a.current.name.split("/").pop()}),v.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[v.jsx("span",{children:a.current.params_b?`${a.current.params_b}B`:"—"}),v.jsx("span",{children:"•"}),v.jsx("span",{children:a.current.quant||"GGUF"}),v.jsx("span",{children:"•"}),v.jsx("span",{children:Bo(a.current.size_bytes||0)})]})]}),a.update_available&&a.recommended?v.jsxs("button",{onClick:()=>We(a.recommended.repo),className:nt("h-8 px-3 shrink-0 flex items-center justify-center gap-1.5 rounded-lg text-[10px] font-bold uppercase transition-all cursor-pointer shadow-md",a.budget&&!a.budget.fits?"bg-red-500 text-white hover:bg-red-400 shadow-red-500/10":"bg-amber-500 text-black hover:bg-amber-400 shadow-amber-500/10"),children:[v.jsx(vg,{className:"h-3.5 w-3.5"})," Aktualisieren"]}):v.jsxs("span",{className:"h-8 px-3 shrink-0 flex items-center gap-1.5 text-[10px] font-bold text-emerald-400 uppercase tracking-wide bg-emerald-500/5 border border-emerald-500/15 rounded-lg select-none",children:[v.jsx(Go,{className:"h-4 w-4"})," Neueste Generation"]})]}),a.update_available&&a.recommended&&v.jsxs("div",{className:"text-[10px] text-amber-400/90 flex items-center gap-1.5",children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),"Neuere Generation verfügbar: ",v.jsx("span",{className:"font-mono font-bold",children:a.recommended.name.replace(/-GGUF$/i,"")}),"(v",a.recommended.version,", ",a.recommended.params_b,"B) — von NousResearch."]}),a.budget&&v.jsxs("div",{className:nt("text-[10px] flex items-start gap-1.5 leading-relaxed",a.budget.fits?"text-muted-foreground/80":"text-red-400 font-semibold"),children:[v.jsx(tE,{className:"h-3 w-3 shrink-0 mt-0.5"}),v.jsxs("span",{children:["Always-On-Brain ~",a.budget.brain_gb," GB + größtes on-demand (~",a.budget.largest_ondemand_gb," GB) = ",(a.budget.brain_gb+a.budget.largest_ondemand_gb).toFixed(1)," / ",a.budget.gtt_gb," GB",a.budget.fits?" · passt gleichzeitig ✓":" · passt NICHT gleichzeitig ⚠ — heavy/coder würden das Brain verdrängen. Kleineres Brain oder weniger Kontext."]})]})]}),v.jsxs("div",{className:"space-y-4",children:[v.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 px-1",children:[v.jsxs("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:["Installierte Modell-Bibliothek (",K.length," von ",y.length,")"]}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[v.jsx("button",{onClick:()=>B("all"),className:nt("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",ce==="all"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Vorhanden"}),v.jsx("button",{onClick:()=>B("in_use"),className:nt("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",ce==="in_use"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"In Benutzung"})]}),v.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[v.jsx("button",{onClick:()=>oe("grid"),className:nt("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",pe==="grid"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Grid"}),v.jsx("button",{onClick:()=>oe("list"),className:nt("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",pe==="list"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"List"})]})]})]}),pe==="grid"?v.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:K.length===0?v.jsx("div",{className:"col-span-full text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:ce==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):K.map(de=>{const J=x.includes(de.name),Ae=o==null?void 0:o.model_list.find(Fe=>Fe.role===de.role),re=TI(de.name);return v.jsxs("div",{className:nt("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-4 transition-all duration-300 hover:border-primary/40 group relative overflow-hidden",J?"border-primary/45 shadow-primary/5":de.role?"border-primary/30 bg-primary/5 shadow-inner":"border-border/60"),children:[v.jsxs("div",{className:"space-y-3",children:[v.jsx("div",{className:"flex items-start justify-between gap-3",children:v.jsxs("div",{className:"flex gap-2.5 min-w-0",children:[v.jsx("div",{className:nt("w-7 h-7 rounded-lg border flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",re.color),title:re.name,children:re.initial}),v.jsxs("div",{className:"min-w-0",children:[v.jsx("h3",{className:"text-xs font-bold tracking-tight text-foreground line-clamp-2 break-all font-mono",title:de.name,children:de.name.split("/").pop()}),v.jsxs("div",{className:"flex items-center gap-2 flex-wrap mt-1",children:[v.jsx("span",{className:"text-[9px] font-mono text-muted-foreground bg-background/40 px-1.5 py-0.5 rounded border border-border/30",children:de.quant||"GGUF"}),J&&v.jsxs("span",{className:"flex items-center gap-1 text-[9px] font-semibold text-emerald-400 uppercase tracking-wider",children:[v.jsx(ry,{className:"h-3 w-3 animate-pulse"})," Warm"]}),de.role&&v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[9px] font-mono text-primary font-bold uppercase",children:de.role}),de.prompt_cache&&v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-cyan-500/10 border border-cyan-500/20 text-[9px] font-mono text-cyan-400 font-bold uppercase",title:"Prompt Caching aktiv",children:"PC"}),de.spec_active?v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-emerald-500/10 border border-emerald-500/20 text-[9px] font-mono text-emerald-400 font-bold uppercase",title:`Speculative Decoding aktiv (Draft: ${de.spec_draft_model})`,children:"SPEC"}):de.spec_draft_model?v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[9px] font-mono text-amber-400 font-bold uppercase",title:`Draft gesetzt (${de.spec_draft_model}), aber INAKTIV — --spec-type fehlt oder Vocab inkompatibel. Über 'Spec' neu konfigurieren.`,children:"SPEC?"}):null,de.parallel_slots>1&&v.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-violet-500/10 border border-violet-500/20 text-[9px] font-mono text-violet-400 font-bold uppercase",title:`${de.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",de.parallel_slots]}),de.incomplete&&v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[9px] font-mono text-amber-400 font-bold uppercase",title:"GGUF-Datei fehlt — Modell kann nicht geladen werden",children:"⚠ Datei fehlt"})]})]})]})}),v.jsx("div",{className:"border-t border-border/30 pt-3 flex flex-wrap gap-1",children:v.jsx(N3,{caps:de.capabilities})})]}),v.jsxs("div",{className:"space-y-3 pt-1",children:[v.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[10px] font-mono text-muted-foreground",children:[v.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[v.jsx(tE,{className:"h-3.5 w-3.5 text-primary/80"}),v.jsxs("div",{children:[v.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Größe"}),v.jsx("div",{className:"text-foreground font-semibold",children:Bo(de.size_bytes)})]})]}),v.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[v.jsx(W8,{className:"h-3.5 w-3.5 text-primary/80"}),v.jsxs("div",{children:[v.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Kontext"}),v.jsx("div",{className:"text-foreground font-semibold",children:MI(de.ctx)})]})]})]}),Ae&&v.jsxs("div",{className:"p-3 bg-amber-500/5 border border-amber-500/30 rounded-xl space-y-2 flex flex-col justify-between shrink-0",children:[v.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1",children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping"}),v.jsxs("span",{children:["Upgrade verfügbar: ",Ae.repo.split("/").pop()]})]}),v.jsxs("button",{onClick:()=>Ue(Ae.repo,de.role,de.quant||"Q4_K_M",de.capabilities.tools!=="no"),className:"h-7 w-full flex items-center justify-center gap-1 rounded-lg bg-amber-500 text-black text-[10px] font-bold hover:bg-amber-400 transition-colors cursor-pointer",children:[v.jsx(vg,{className:"h-3 w-3"})," Smart-Swap starten"]})]}),v.jsxs("div",{className:"flex items-center gap-1.5 border-t border-border/20 pt-3 mt-auto",children:[v.jsx("button",{onClick:()=>J?Me(de.name):$e(de.name),disabled:de.incomplete&&!J,className:nt("flex-1 h-7 rounded-lg text-[9px] font-bold uppercase transition-all border flex items-center justify-center gap-1",de.incomplete&&!J?"border-border/30 bg-background/10 text-muted-foreground/50 cursor-not-allowed":J?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400 cursor-pointer":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary cursor-pointer"),children:J?"Entladen":"Laden"}),v.jsx("button",{onClick:()=>Q(de.name,de.ctx),className:"h-7 px-2.5 rounded-lg border border-border/40 text-[9px] font-bold uppercase hover:bg-accent text-muted-foreground transition-colors cursor-pointer",title:"Kontextlänge anpassen",children:"Ctx"}),v.jsxs("button",{onClick:()=>F(de),className:nt("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-colors cursor-pointer flex items-center gap-1",de.spec_active?"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10":de.spec_draft_model?"border-amber-500/30 text-amber-400 hover:bg-amber-500/10":"border-border/40 text-muted-foreground hover:bg-accent"),title:"Speculative Draft konfigurieren (Vocab-geprüft)",children:[v.jsx(xh,{className:"h-3 w-3"})," Spec"]}),v.jsx("button",{onClick:()=>Ge(de.name),className:"h-7 w-7 rounded-lg border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 flex items-center justify-center transition-colors cursor-pointer",title:"Modell löschen",children:v.jsx(IT,{className:"h-3.5 w-3.5"})})]})]})]},de.name)})}):v.jsx("div",{className:"space-y-2",children:K.length===0?v.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:ce==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):K.map(de=>{const J=x.includes(de.name),Ae=TI(de.name);return v.jsxs("div",{className:nt("rounded-xl border bg-card/45 backdrop-blur-md p-3.5 shadow-lg shadow-black/5 flex flex-col sm:flex-row sm:items-center justify-between gap-3 hover:border-primary/40 transition-all",J?"border-primary/45":de.role?"border-primary/30 bg-primary/5":"border-border/60"),children:[v.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[v.jsx("div",{className:nt("w-8 h-8 rounded-lg border border-border/40 flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",Ae.color),title:Ae.name,children:Ae.initial}),v.jsxs("div",{className:"min-w-0 text-left",children:[v.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[v.jsx("h4",{className:"text-xs font-bold text-foreground truncate max-w-[250px] sm:max-w-[400px] break-all font-mono",title:de.name,children:de.name.split("/").pop()}),de.role&&v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[8px] font-mono text-primary font-bold uppercase shrink-0",children:de.role}),de.prompt_cache&&v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-cyan-500/10 border border-cyan-500/20 text-[8px] font-mono text-cyan-400 font-bold uppercase shrink-0",title:"Prompt Caching aktiv",children:"PC"}),de.spec_active?v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-emerald-500/10 border border-emerald-500/20 text-[8px] font-mono text-emerald-400 font-bold uppercase shrink-0",title:`Speculative Decoding aktiv (Draft: ${de.spec_draft_model})`,children:"SPEC"}):de.spec_draft_model?v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[8px] font-mono text-amber-400 font-bold uppercase shrink-0",title:`Draft gesetzt (${de.spec_draft_model}), aber INAKTIV — --spec-type fehlt oder Vocab inkompatibel.`,children:"SPEC?"}):null,de.parallel_slots>1&&v.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-violet-500/10 border border-violet-500/20 text-[8px] font-mono text-violet-400 font-bold uppercase shrink-0",title:`${de.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",de.parallel_slots]}),de.incomplete&&v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[8px] font-mono text-amber-400 font-bold uppercase shrink-0",title:"GGUF-Datei fehlt",children:"⚠ Datei fehlt"}),J&&v.jsxs("span",{className:"flex items-center gap-0.5 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider shrink-0",children:[v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]})]}),v.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[v.jsxs("span",{children:["Größe: ",Bo(de.size_bytes)]}),v.jsx("span",{children:"•"}),v.jsxs("span",{children:["Kontext: ",MI(de.ctx)]}),v.jsx("span",{children:"•"}),v.jsx("span",{className:"font-mono text-[9px]",children:de.quant||"GGUF"})]})]})]}),v.jsxs("div",{className:"flex items-center gap-3 shrink-0 self-end sm:self-auto",children:[v.jsx("div",{className:"hidden lg:flex flex-wrap gap-1",children:v.jsx(N3,{caps:de.capabilities})}),v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx("button",{onClick:()=>J?Me(de.name):$e(de.name),disabled:de.incomplete&&!J,className:nt("h-7 px-3 rounded-lg text-[9px] font-bold uppercase transition-all border flex items-center gap-1",de.incomplete&&!J?"border-border/30 bg-background/10 text-muted-foreground/50 cursor-not-allowed":J?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400 cursor-pointer":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary cursor-pointer"),children:J?"Entladen":"Laden"}),v.jsx("button",{onClick:()=>Q(de.name,de.ctx),className:"h-7 px-2.5 rounded-lg border border-border/40 text-[9px] font-bold uppercase hover:bg-accent text-muted-foreground transition-all cursor-pointer",title:"Kontextlänge anpassen",children:"Ctx"}),v.jsxs("button",{onClick:()=>F(de),className:nt("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-all cursor-pointer flex items-center gap-1",de.spec_active?"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10":de.spec_draft_model?"border-amber-500/30 text-amber-400 hover:bg-amber-500/10":"border-border/40 text-muted-foreground hover:bg-accent"),title:"Speculative Draft konfigurieren (Vocab-geprüft)",children:[v.jsx(xh,{className:"h-3 w-3"})," Spec"]}),v.jsx("button",{onClick:()=>Ge(de.name),className:"h-7 w-7 rounded-lg flex items-center justify-center border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 transition-all cursor-pointer",title:"Modell löschen",children:v.jsx(IT,{className:"h-3.5 w-3.5"})})]})]})]},de.name)})})]}),T&&(()=>{var Fe,Te;const de=O&&O.role===T?O:null,J={};de==null||de.models.forEach(Le=>{J[Le.name]=Le});const Ae=de?de.models.map(Le=>y.find(Ke=>Ke.name===Le.name)).filter(Boolean):y,re=Le=>{Xe(T,Le),C(null)};return v.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:v.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[v.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:["Rolle '",T,"' konfigurieren"]}),v.jsx("button",{onClick:()=>C(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:v.jsx(Bc,{className:"h-4 w-4"})})]}),v.jsxs("div",{className:"flex items-center justify-between gap-2",children:[v.jsxs("p",{className:"text-xs text-muted-foreground",children:["Wähle ein Modell für die Rolle ",v.jsx("strong",{className:"text-foreground",children:T}),":"]}),(de==null?void 0:de.recommended)&&v.jsxs("button",{onClick:()=>re(de.recommended),title:(Fe=J[de.recommended])==null?void 0:Fe.reason,className:"shrink-0 h-7 px-3 text-[11px] font-semibold text-primary border border-primary/50 bg-primary/10 hover:bg-primary/20 rounded-lg cursor-pointer flex items-center gap-1",children:[v.jsx(xh,{className:"h-3 w-3"})," Auto: ",(Te=de.recommended.split("/").pop())==null?void 0:Te.replace(/\.gguf$/i,"")]})]}),v.jsxs("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:[v.jsx("button",{onClick:()=>re(""),className:"w-full text-left px-3 py-2 rounded-lg text-xs hover:bg-accent text-red-400 font-semibold cursor-pointer border border-red-500/20 bg-red-500/5 flex items-center justify-between",children:v.jsx("span",{children:"Zuweisung entfernen"})}),Ae.map(Le=>{var Cn;const Ke=J[Le.name],ut=Le.role===T,Kt=!!(Ke!=null&&Ke.recommended),un=!!Ke&&!Ke.suitable;return v.jsxs("button",{onClick:()=>re(Le.name),className:nt("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border",Kt?"border-primary/50 bg-primary/10":ut?"text-primary font-bold bg-primary/5 border-primary/30":un?"border-border/20 bg-background/10 opacity-60":"text-foreground bg-background/20 border-border/30"),children:[v.jsxs("div",{className:"flex flex-col text-left min-w-0",children:[v.jsxs("span",{className:"truncate max-w-[260px] font-semibold flex items-center gap-1.5",children:[(Cn=Le.name.split("/").pop())==null?void 0:Cn.replace(/\.gguf$/i,""),Kt&&v.jsx("span",{className:"text-[8px] font-bold uppercase tracking-wide text-primary bg-primary/15 px-1.5 py-0.5 rounded",children:"Empfohlen"})]}),v.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:Ke?`${Ke.params_b}B · ${Le.quant} · ${Ke.reason}`:`${Bo(Le.size_bytes)} · ${Le.quant}`})]}),ut&&v.jsx(Go,{className:"h-4 w-4 shrink-0 text-primary"})]},Le.name)})]})]})})})(),D&&v.jsx(Pfe,{model:D,onClose:()=>F(null),onChanged:_}),V&&v.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:v.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[v.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[v.jsx(qc,{className:"h-4 w-4"})," Agent-Hirn wechseln"]}),v.jsx("button",{onClick:()=>k(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:v.jsx(Bc,{className:"h-4 w-4"})})]}),v.jsxs("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:["Wähle ein ",v.jsx("strong",{className:"text-foreground",children:"installiertes"})," Modell als Agent-Hirn. Es bekommt den",v.jsx("code",{className:"text-primary",children:" hermes"}),'-Alias, wird warm gehalten (brains-Gruppe), und Hermes nutzt es nach einem kurzen Gateway-Restart. Neues Modell (z.B. Hermes-4.3 oder Gemma-4)? Erst über „Modelle finden" laden.']}),v.jsx("div",{className:"space-y-1.5 max-h-72 overflow-y-auto pr-1",children:y.map(de=>{var Ae;const J=de.role==="hermes";return v.jsxs("button",{onClick:()=>!J&&Qe(de.name),disabled:J||de.incomplete,className:nt("w-full text-left px-3 py-2.5 rounded-lg text-xs flex items-center justify-between font-mono border transition-all",J?"border-indigo-500/40 bg-indigo-500/10 text-indigo-300":de.incomplete?"border-border/20 bg-background/10 text-muted-foreground/50 cursor-not-allowed":"border-border/30 bg-background/20 text-foreground hover:bg-accent cursor-pointer"),children:[v.jsxs("div",{className:"flex flex-col min-w-0",children:[v.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:(Ae=de.name.split("/").pop())==null?void 0:Ae.replace(/\.gguf$/i,"")}),v.jsxs("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:[de.capabilities.params_b?`${de.capabilities.params_b}B`:"?"," · ",Bo(de.size_bytes),de.role&&` · Rolle: ${de.role}`,de.capabilities.tools!=="no"?" · Tools ✓":" · ohne Tools"]})]}),J?v.jsxs("span",{className:"text-[9px] font-bold uppercase text-indigo-300 shrink-0 flex items-center gap-1",children:[v.jsx(Go,{className:"h-3.5 w-3.5"})," Aktiv"]}):v.jsx("span",{className:"text-[9px] font-bold uppercase text-primary/70 shrink-0",children:"Als Hirn setzen →"})]},de.name)})}),v.jsxs("div",{className:"text-[10px] text-amber-400/80 flex items-start gap-1.5 border-t border-border/20 pt-2.5",children:[v.jsx("span",{children:"💡"}),v.jsxs("span",{children:["Für einen ",v.jsx("strong",{children:"Agenten"})," sind Hermes-Modelle (natives Tool-Calling) meist die robustere Wahl als allgemeine Modelle."]})]})]})}),m]})}function Nfe(){const[t,e]=R.useState(""),[n,r]=R.useState([]),[i,s]=R.useState("Q4_K_M"),[o,a]=R.useState(""),[l,c]=R.useState(""),[d,f]=R.useState(""),[m,y]=R.useState([]),[x,S]=R.useState(null),[_,w]=R.useState(!1),A=["fast","heavy","coder","vision","scout"],{data:T}=qh(),C=l?T==null?void 0:T.models.find(H=>(H.role||"").toLowerCase()===l):void 0;async function O(H,ne,te){if(w(!1),!H.trim()){S(null);return}try{const pe=await jt(`/api/fit?params_b=0&quant=${encodeURIComponent(ne)}&ctx=8192&name=${encodeURIComponent(H)}&role=${encodeURIComponent(te)}`);S(pe)}catch{S(null)}}async function N(H){const ne=H??t;if(ne.trim()){a("Analysiere HuggingFace Repository..."),S(null);try{const te=await jt(`/api/hf/quants?repo=${encodeURIComponent(ne)}`);e(te.repo),r(te.quants);const pe=te.quants.length?te.quants.includes("Q4_K_M")?"Q4_K_M":te.quants[0]:i;te.quants.length&&s(pe),a(te.quants.length?"":"Keine GGUF-Dateien in diesem Repository gefunden."),te.quants.length&&O(te.repo,pe,l)}catch(te){a(`Fehler: ${te}`)}}}function D(H){s(H),O(t,H,l)}function F(H){c(H),n.length&&O(t,i,H)}async function V(){if(d.trim()){a("Durchsuche HuggingFace...");try{const H=await jt(`/api/hf/search?q=${encodeURIComponent(d)}`);y(H.results),a(H.results.length?"":"Keine Ergebnisse gefunden.")}catch(H){a(`Suche fehlgeschlagen: ${H}`)}}}async function k(){if(t.trim()){if((x==null?void 0:x.fit.level)==="too_tight"&&!_){w(!0);return}a("Download-Job wird initiiert...");try{await jt("/api/models/install",{method:"POST",body:JSON.stringify({repo:t,quant:i,role:l||void 0,jinja:!0})}),w(!1),a(`Download gestartet: ${t} (${i})${l?`, Rolle: ${l}`:""}. Fortschritt oben.`+(C?` „${l}" wurde von ${C.name} übernommen.`:"")+(l==="fast"||l==="coder"?" Speculative Draft (Vocab-geprüft) kannst du nach dem Download an der Modellkarte (»Spec«) setzen.":""))}catch(H){a(`Download-Fehler: ${H}`)}}}const j=(x==null?void 0:x.fit.level)==="perfect"?"text-emerald-400 border-emerald-500/40 bg-emerald-500/10":(x==null?void 0:x.fit.level)==="marginal"?"text-amber-400 border-amber-500/40 bg-amber-500/10":"text-red-400 border-red-500/40 bg-red-500/10";return v.jsxs("div",{className:"space-y-4 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10",children:[v.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"HF Download & Suche"}),v.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[v.jsx("input",{value:t,onChange:H=>{e(H.target.value),S(null),w(!1)},placeholder:"HF-URL oder org/repo (z.B. unsloth/Qwen2.5-Coder-7B-Instruct-GGUF)",className:"flex-1 h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),v.jsxs("div",{className:"flex gap-2",children:[v.jsx("button",{onClick:()=>N(),className:"h-9 px-4 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer whitespace-nowrap",children:"Quants laden"}),n.length>0&&v.jsxs(v.Fragment,{children:[v.jsx("select",{value:i,onChange:H=>D(H.target.value),className:"h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none text-foreground font-semibold",children:n.map(H=>v.jsx("option",{value:H,className:"bg-popover text-foreground",children:H},H))}),v.jsxs("select",{value:l,onChange:H=>F(H.target.value),title:"Rolle (optional) — bestimmt Auto-Konfiguration + setup-bewussten Kontext",className:"h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none text-foreground font-semibold",children:[v.jsx("option",{value:"",className:"bg-popover text-foreground",children:"Rolle…"}),A.map(H=>v.jsx("option",{value:H,className:"bg-popover text-foreground",children:H},H))]}),v.jsx("button",{onClick:k,className:`h-9 px-4 rounded-lg text-xs font-semibold transition-all cursor-pointer flex items-center gap-1.5 ${_?"bg-red-500 text-white hover:opacity-90":"bg-primary text-primary-foreground hover:opacity-90"}`,children:_?v.jsxs(v.Fragment,{children:[v.jsx(yg,{className:"h-3.5 w-3.5"})," OOM-Risiko — trotzdem laden"]}):v.jsxs(v.Fragment,{children:[v.jsx(vg,{className:"h-3.5 w-3.5"})," Herunterladen"]})})]})]})]}),x&&v.jsxs("div",{className:`flex flex-wrap items-center gap-x-3 gap-y-1 rounded-lg border px-3 py-2 text-[11px] font-medium ${j}`,children:[v.jsx("span",{className:"font-bold uppercase tracking-wide",children:x.fit.text}),v.jsxs("span",{className:"font-mono opacity-90",children:["~",x.params_b,"B · ~",x.fit.req_gb," GB / ",x.sys_ram_gb," GB RAM · ~",x.fit.tps," t/s"]}),x.fit.level!=="too_tight"&&v.jsxs("span",{className:"font-mono opacity-80",title:`Setup-bewusst: GTT ${x.budget.gtt_gb} GB − reserviert ${x.budget.reserved_gb} GB (${x.budget.mode}) → ${x.budget.budget_gb} GB frei`,children:["ctx → ",(x.assigned_ctx/1024).toFixed(0),"k"]}),x.fit.level==="too_tight"&&v.jsx("span",{className:"opacity-90",children:"— passt nicht in den Speicher, würde beim Laden abstürzen (OOM)."})]}),C&&v.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-[11px] font-medium text-amber-400",children:[v.jsx(yg,{className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),v.jsxs("span",{children:["Rolle ",v.jsxs("strong",{children:["„",l,'"']})," ist aktuell ",v.jsx("strong",{children:C.name})," zugewiesen. Beim Download übernimmt das neue Modell diese Rolle — ",C.name," bleibt installiert, verliert sie aber."]})]}),v.jsxs("div",{className:"flex gap-2 border-t border-border/20 pt-4",children:[v.jsxs("div",{className:"relative flex-1",children:[v.jsx("input",{value:d,onChange:H=>f(H.target.value),onKeyDown:H=>H.key==="Enter"&&V(),placeholder:"HuggingFace durchsuchen (z.B. Llama-3.1)...",className:"w-full h-9 pl-9 pr-3 rounded-lg border border-border/60 bg-background/40 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),v.jsx(yP,{className:"absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),v.jsx("button",{onClick:V,className:"h-9 px-4 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer",children:"Suchen"})]}),m.length>0&&v.jsx("div",{className:"max-h-48 space-y-1.5 overflow-y-auto border border-border/40 bg-background/20 p-2 rounded-xl scrollbar-thin",children:m.map(H=>v.jsxs("button",{onClick:()=>{e(H.repo),y([]),f(""),N(H.repo)},className:"flex w-full items-center justify-between rounded-lg px-3 py-2 text-left text-xs bg-background/10 border border-border/10 hover:border-primary/30 hover:bg-background/30 transition-all",children:[v.jsx("span",{className:"font-semibold truncate",children:H.repo}),v.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground flex items-center gap-1 shrink-0",children:[v.jsx(vg,{className:"h-3 w-3"})," ",H.downloads.toLocaleString()]})]},H.repo))}),o&&v.jsx("div",{className:"text-[10px] font-medium text-primary font-mono",children:o})]})}const Ife={fast:{title:"Schnelles Alltags-Hirn",desc:"Schnelle MoE-Antworten für Chat, Zusammenfassungen und alltägliche Aufgaben.",icon:xh},heavy:{title:"Schweres Reasoning",desc:"Große Modelle für komplexe Logik, Mathematik und tiefgründiges Planen.",icon:H1},coder:{title:"Coden & Entwicklung",desc:"Autovervollständigung, Refactoring und Codegenerierung direkt in deiner IDE.",icon:iF},vision:{title:"Bilder & Vision",desc:"Verarbeitet Bilder, Screenshots und visuelle Diagramme in multimodalen Chats.",icon:PT},scout:{title:"Multimodal-Allrounder",desc:"Multimodaler Allrounder für schnelle Antworten, Übersetzungen und Alltag.",icon:CT}};function kfe(){const{data:t,isLoading:e,error:n}=m7(),{data:r}=qh(),{data:i}=AP(),s=(r==null?void 0:r.models)??[],o=n?String(n):"",[a,l]=R.useState({}),[c,d]=R.useState({}),[f,m]=R.useState(!1);async function y(x,S,_,w){l(A=>({...A,[x]:"Starte..."}));try{await jt("/api/models/install",{method:"POST",body:JSON.stringify({repo:x,role:S,quant:_,jinja:w})}),l(A=>({...A,[x]:"Download läuft"}))}catch{l(T=>({...T,[x]:"Fehler"}))}}return e?v.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Analysiere Hardware und suche passende GGUF-Empfehlungen…"}):o||!t?v.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Empfehlungsdienst temporär nicht erreichbar (",o,")."]}):v.jsxs("div",{className:"space-y-8",children:[v.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground bg-background/25 border border-border/40 p-4 rounded-xl flex flex-col sm:flex-row sm:items-center justify-between gap-3 shadow-sm",children:[v.jsxs("div",{children:["Modell-Registry geladen für ",v.jsxs("span",{className:"text-foreground font-bold",children:[t.sys_ram_gb," GB"]})," System-RAM."]}),v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx(J8,{className:"h-3.5 w-3.5 text-primary fill-primary/20"}),v.jsx("span",{children:"Empfehlungen sind automatisch auf deine Box-Hardware optimiert."})]})]}),v.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:t.categories.map(x=>{const S=Ife[x.role]||{title:x.title||x.role,desc:"Spezifisches Modell für diese Systemrolle.",icon:V1},_=S.icon,w=s.find(D=>D.role===x.role),A=i==null?void 0:i.model_list.find(D=>D.role===x.role),T=x.models.find(D=>D.repo===x.recommended)||x.models[0];if(!T)return null;const C=a[T.repo],O=x.models.filter(D=>D.repo!==x.recommended),N=!!c[x.role];return v.jsxs("div",{className:nt("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-5 transition-all duration-300 hover:border-primary/40",w?"border-border/60":"border-primary/20 shadow-primary/5"),children:[v.jsxs("div",{className:"space-y-4",children:[v.jsxs("div",{className:"flex items-start justify-between gap-3",children:[v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary/10 border border-primary/20 flex items-center justify-center text-primary shadow-sm shrink-0",children:v.jsx(_,{className:"h-5.5 w-5.5"})}),v.jsxs("div",{children:[v.jsx("h3",{className:"text-sm font-bold tracking-tight text-foreground",children:S.title}),v.jsxs("span",{className:"text-[9px] font-mono text-muted-foreground uppercase bg-background/50 px-1.5 py-0.5 rounded border border-border/30 inline-block mt-0.5",children:["Rolle: ",x.role]})]})]}),w?v.jsxs("span",{className:"flex items-center gap-1.5 text-[9px] font-bold text-emerald-400 uppercase tracking-wider bg-emerald-500/10 border border-emerald-500/20 px-2.5 py-1 rounded-lg",children:[v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"Aktiviert"]}):v.jsx("span",{className:"text-[9px] font-bold text-primary/70 uppercase tracking-wider bg-primary/10 border border-primary/20 px-2.5 py-1 rounded-lg",children:"Frei"})]}),v.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:S.desc}),v.jsx("div",{className:"p-3.5 rounded-xl bg-background/35 border border-border/30 space-y-2.5",children:w?v.jsxs("div",{className:"space-y-1.5",children:[v.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Aktive GGUF-Belegung"}),v.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:w.name,children:w.name.split("/").pop()}),v.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2",children:[v.jsxs("span",{children:["Größe: ",FT(w.size_bytes||0)]}),v.jsx("span",{children:"•"}),v.jsxs("span",{children:["Quant: ",w.quant||"GGUF"]})]})]}):v.jsxs("div",{className:"space-y-1.5",children:[v.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-primary/80",children:"Empfohlenes Modell"}),v.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:T.name,children:T.name}),v.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 flex-wrap",children:[v.jsxs("span",{children:["Ersteller: ",T.author]}),v.jsx("span",{children:"•"}),v.jsxs("span",{children:["Quant: ",T.quant]})]}),v.jsx("div",{className:"flex items-center gap-1.5 pt-0.5",children:v.jsx(Q7,{fit:T.fit})})]})}),v.jsx("div",{className:"pt-1",children:w?A?v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1.5",children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),v.jsxs("span",{children:["Bessere Version in der Registry: ",A.repo.split("/").pop()]})]}),v.jsxs("button",{onClick:()=>y(A.repo,x.role,T.quant||"Q4_K_M",T.caps.tools!=="no"),disabled:!!a[A.repo],className:"h-8 w-full flex items-center justify-center gap-1.5 rounded-lg bg-amber-500 text-black text-xs font-bold hover:bg-amber-400 disabled:opacity-50 transition-all cursor-pointer shadow-md shadow-amber-500/10",children:[v.jsx(vg,{className:"h-3.5 w-3.5"}),a[A.repo]||"Auf neue Version aktualisieren"]})]}):v.jsxs("div",{className:"h-8 flex items-center justify-center gap-1.5 text-[10px] font-bold text-emerald-400 uppercase tracking-wide bg-emerald-500/5 border border-emerald-500/10 rounded-lg select-none",children:[v.jsx(Go,{className:"h-4 w-4"})," Auf neuestem Stand"]}):v.jsxs("button",{onClick:()=>y(T.repo,x.role,T.quant||"Q4_K_M",T.caps.tools!=="no"),disabled:!!C,className:nt("h-8 w-full flex items-center justify-center gap-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer border",C?"border-primary/40 bg-primary/5 text-primary":"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/10"),children:[v.jsx(vg,{className:"h-3.5 w-3.5"}),C||"Optimales Modell einsetzen"]})})]}),O.length>0&&v.jsxs("div",{className:"border-t border-border/20 pt-3",children:[v.jsxs("button",{onClick:()=>d(D=>({...D,[x.role]:!N})),className:"flex items-center gap-1.5 text-[10px] text-muted-foreground/80 hover:text-foreground transition-colors cursor-pointer",children:[N?v.jsx(w8,{className:"h-3 w-3"}):v.jsx(b8,{className:"h-3 w-3"}),v.jsxs("span",{children:["Alternative Empfehlungen anzeigen (",O.length,")"]})]}),N&&v.jsx("div",{className:"mt-2.5 space-y-2 max-h-36 overflow-y-auto pr-1 scrollbar-thin",children:O.map(D=>v.jsxs("div",{className:"p-2 rounded-lg bg-background/25 border border-border/20 flex items-center justify-between gap-3",children:[v.jsxs("div",{className:"min-w-0",children:[v.jsx("div",{className:"text-[10px] font-mono font-bold text-foreground truncate",title:D.name,children:D.name}),v.jsxs("div",{className:"text-[9px] text-muted-foreground flex items-center gap-1.5 mt-0.5",children:[v.jsxs("span",{children:["Quant: ",D.quant]}),v.jsx("span",{children:"•"}),v.jsx("span",{children:D.fit.text})]})]}),v.jsx("button",{onClick:()=>y(D.repo,x.role,D.quant||"Q4_K_M",D.caps.tools!=="no"),disabled:!!a[D.repo],className:"h-6 px-2.5 rounded bg-background/40 hover:bg-background/80 border border-border/40 text-[9px] font-bold text-foreground transition-all cursor-pointer shrink-0 disabled:opacity-50",children:a[D.repo]||"Installieren"})]},D.repo))})]})]},x.role)})}),v.jsxs("div",{className:"border border-border/50 bg-card/20 rounded-2xl overflow-hidden shadow-md mt-4",children:[v.jsxs("button",{onClick:()=>m(!f),className:"w-full px-5 py-4 flex items-center justify-between text-xs font-bold uppercase tracking-wider text-muted-foreground hover:bg-card/30 transition-colors cursor-pointer",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(yP,{className:"h-4 w-4 text-primary"}),v.jsx("span",{children:"Eigenes Modell von Hugging Face laden (Erweiterte Ansicht)"})]}),v.jsx("span",{className:"text-[10px] text-primary hover:underline",children:f?"Ausblenden ▲":"Anzeigen ▼"})]}),f&&v.jsx("div",{className:"p-5 border-t border-border/20 bg-card/10",children:v.jsx(Nfe,{})})]})]})}function Ofe(){const[t,e]=R.useState("cockpit");return v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[v.jsxs("div",{children:[v.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Modell-Manager"}),v.jsx("p",{className:"text-sm text-muted-foreground",children:"Verwalte deine Modelle und passe das Gateway-Routing live über das interaktive Cockpit an."})]}),v.jsx("div",{className:"flex rounded-xl border border-border/60 bg-card/45 backdrop-blur-md p-1 self-start",children:["cockpit","discover"].map(n=>v.jsx("button",{onClick:()=>e(n),className:nt("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",t===n?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:n==="cockpit"?"Cockpit":"Modelle finden"},n))})]}),v.jsx(Cfe,{}),v.jsx("div",{className:"transition-all duration-300",children:t==="cockpit"?v.jsx(Rfe,{}):v.jsx(kfe,{})})]})}const Lfe={cline:"cline_settings.json",cursor:"Settings → Models",opencode:"opencode.jsonc",zed:"settings.json",continue:"~/.continue/config.json",claude_code:"~/.zshrc / env"};function I3({line:t,loading:e}){return e||!t?v.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-muted-foreground",children:[v.jsx(vP,{className:"h-3 w-3 animate-spin"})," prüfe…"]}):t.ok?v.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-emerald-400",children:[v.jsx(S8,{className:"h-3 w-3"})," ",t.detail]}):v.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-red-400",children:[v.jsx(E8,{className:"h-3 w-3"})," ",t.detail]})}function k3({tool:t,fileName:e,accent:n,copied:r,onCopy:i}){return v.jsxs("div",{className:"flex flex-col border border-border/60 bg-black/60 rounded-2xl overflow-hidden shadow-2xl",children:[v.jsxs("div",{className:"flex h-11 items-center justify-between px-4 border-b border-border/40 bg-black/40 shrink-0",children:[v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx("span",{className:"h-3 w-3 rounded-full bg-red-500/80"}),v.jsx("span",{className:"h-3 w-3 rounded-full bg-amber-500/80"}),v.jsx("span",{className:"h-3 w-3 rounded-full bg-emerald-500/80"})]}),v.jsx("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground/75 bg-background/30 px-3 py-1 rounded-md border border-border/20",children:v.jsx("span",{children:e})}),v.jsxs("button",{onClick:i,className:"flex h-7 px-2.5 items-center gap-1.5 rounded-lg border border-border/40 bg-background/30 text-[10px] font-semibold text-muted-foreground hover:text-foreground hover:bg-background/60 transition-all cursor-pointer",children:[r?v.jsx(Go,{className:"h-3.5 w-3.5 text-emerald-400"}):v.jsx(J_,{className:"h-3.5 w-3.5"}),v.jsx("span",{children:r?"Kopiert":"Kopieren"})]})]}),v.jsx("pre",{className:nt("p-5 overflow-x-auto text-xs font-mono whitespace-pre leading-relaxed scrollbar-thin select-text bg-black/10",n==="teal"?"text-cyan-200/90":"text-violet-200/90"),children:v.jsx("code",{children:t.snippet})})]})}function Dfe(){const[t,e]=R.useState(localStorage.getItem("mc_host")||"192.168.178.151"),[n,r]=R.useState(localStorage.getItem("mc_mcp_path")||""),[i,s]=R.useState("cline"),[o,a]=R.useState(null),l=new URLSearchParams({host:t});n&&l.set("mcp_path",n);const{data:c,error:d}=VF(l.toString()),{data:f,isLoading:m}=v7(),y=d?String(d):"";function x(A){e(A),A&&localStorage.setItem("mc_host",A)}function S(A){r(A),localStorage.setItem("mc_mcp_path",A)}const _=c==null?void 0:c.tools[i];async function w(A,T){T&&(await navigator.clipboard.writeText(T),a(A),setTimeout(()=>a(null),1500))}return v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{children:[v.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Verbindung & Integration"}),v.jsxs("p",{className:"text-sm text-muted-foreground",children:["Binde deinen lokalen Agenten an die Box an — über ",v.jsx("span",{className:"text-foreground",children:"zwei getrennte Leitungen"}),": das Modell (Gateway) und das geteilte Gedächtnis (MCP)."]})]}),v.jsxs("div",{className:"p-5 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md shadow-lg shadow-black/10",children:[v.jsxs("div",{className:"grid gap-4 md:grid-cols-[170px_1fr] items-center",children:[v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-background/40 p-4 text-center",children:[v.jsx(L8,{className:"h-7 w-7 mx-auto text-muted-foreground"}),v.jsx("div",{className:"mt-2 text-sm font-semibold text-foreground",children:"Dein lokaler Agent"}),v.jsx("div",{className:"text-[11px] text-muted-foreground",children:"Cline · Cursor · Zed …"})]}),v.jsxs("div",{className:"flex flex-col gap-2.5",children:[v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx(rI,{className:"h-4 w-4 text-muted-foreground shrink-0"}),v.jsxs("div",{className:"flex-1 rounded-xl border border-primary/25 bg-primary/5 px-3.5 py-2.5",children:[v.jsxs("div",{className:"flex items-center justify-between gap-2",children:[v.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-primary",children:[v.jsx(El,{className:"h-3.5 w-3.5"})," Leitung 1 — Modell"]}),v.jsx(I3,{line:f==null?void 0:f.gateway,loading:m})]}),v.jsx("div",{className:"mt-1 text-[11px] font-mono text-primary/80",children:"Gateway · :9001/v1 · model auto"})]})]}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx(rI,{className:"h-4 w-4 text-muted-foreground shrink-0"}),v.jsxs("div",{className:"flex-1 rounded-xl border border-violet-500/25 bg-violet-500/5 px-3.5 py-2.5",children:[v.jsxs("div",{className:"flex items-center justify-between gap-2",children:[v.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-violet-300",children:[v.jsx(H1,{className:"h-3.5 w-3.5"})," Leitung 2 — Gedächtnis"]}),v.jsx(I3,{line:f==null?void 0:f.memory,loading:m})]}),v.jsx("div",{className:"mt-1 text-[11px] font-mono text-violet-300/80",children:"MCP · mcp_memory.py · separat"})]})]})]})]}),v.jsxs("p",{className:"mt-3.5 text-[11px] text-muted-foreground leading-relaxed",children:["Der Gateway liefert ",v.jsx("span",{className:"text-foreground",children:"nur das LLM"}),". Das geteilte Gedächtnis läuft über einen",v.jsx("span",{className:"text-foreground",children:" eigenen MCP-Server"})," — beide werden unabhängig eingerichtet."]})]}),v.jsxs("div",{className:"grid gap-4 md:grid-cols-2 p-5 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md shadow-lg shadow-black/10",children:[v.jsxs("div",{className:"space-y-1.5",children:[v.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[v.jsx(k8,{className:"h-3.5 w-3.5 text-primary"})," Box LAN IP-Adresse"]}),v.jsx("input",{value:t,onChange:A=>x(A.target.value),placeholder:"z.B. 192.168.178.151",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 font-mono text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"})]}),v.jsxs("div",{className:"space-y-1.5",children:[v.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[v.jsx(N8,{className:"h-3.5 w-3.5 text-violet-400"})," Lokaler MCP-Scriptpfad",v.jsx("span",{className:"text-violet-400/70 normal-case font-semibold tracking-normal",children:"(nur Leitung 2)"})]}),v.jsx("input",{value:n,onChange:A=>S(A.target.value),placeholder:"z.B. F:\\Coding Stuff\\mission-control-2\\mcp\\mcp_memory.py",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 font-mono text-xs outline-none focus:ring-1 focus:ring-violet-500/50 text-foreground"})]})]}),y&&v.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Fehler beim Generieren der Snippets: ",y]}),c&&v.jsxs("div",{className:"grid gap-5 lg:grid-cols-2",children:[v.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 border-t-2 border-t-primary/70 bg-card/30 p-4",children:[v.jsxs("div",{children:[v.jsxs("div",{className:"flex items-center gap-2 text-sm font-space font-bold text-foreground",children:[v.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-md bg-primary/15 text-primary text-[11px]",children:"1"}),"Modell anbinden"]}),v.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:"Wähle dein Tool — das Snippet zeigt auf den Gateway."})]}),v.jsx("div",{className:"flex flex-wrap gap-1.5",children:Object.entries(c.tools).map(([A,T])=>v.jsx("button",{onClick:()=>s(A),className:nt("rounded-lg px-3 py-1.5 text-[11px] font-semibold tracking-wide transition-all cursor-pointer",i===A?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"border border-border/50 text-muted-foreground hover:text-foreground"),children:T.label},A))}),_&&v.jsxs(v.Fragment,{children:[_.note&&v.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-xl bg-primary/5 border border-primary/20 text-[11px] text-muted-foreground leading-relaxed",children:[v.jsx(sI,{className:"h-4 w-4 text-primary shrink-0 mt-0.5"}),v.jsx("span",{children:_.note})]}),v.jsx(k3,{tool:_,fileName:Lfe[i]||"config.json",accent:"teal",copied:o==="model",onCopy:()=>w("model",_.snippet)})]})]}),v.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 border-t-2 border-t-violet-500/70 bg-card/30 p-4",children:[v.jsxs("div",{children:[v.jsxs("div",{className:"flex items-center gap-2 text-sm font-space font-bold text-foreground",children:[v.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-md bg-violet-500/15 text-violet-300 text-[11px]",children:"2"}),"Gedächtnis anbinden",v.jsx("span",{className:"text-[10px] font-medium text-muted-foreground normal-case",children:"optional"})]}),v.jsxs("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:["Ein MCP-Block — gilt zusätzlich für ",v.jsx("em",{children:"jedes"})," Tool aus Schritt 1."]})]}),v.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-xl bg-violet-500/5 border border-violet-500/20 text-[11px] text-muted-foreground leading-relaxed",children:[v.jsx(sI,{className:"h-4 w-4 text-violet-400 shrink-0 mt-0.5"}),v.jsx("span",{children:c.memory.note})]}),v.jsx(k3,{tool:c.memory,fileName:"mcp.json",accent:"violet",copied:o==="memory",onCopy:()=>w("memory",c.memory.snippet)})]})]})]})}const Ufe="modulepreload",jfe=function(t){return"/"+t},O3={},Ffe=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let o=function(c){return Promise.all(c.map(d=>Promise.resolve(d).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=o(n.map(c=>{if(c=jfe(c),c in O3)return;O3[c]=!0;const d=c.endsWith(".css"),f=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${f}`))return;const m=document.createElement("link");if(m.rel=d?"stylesheet":Ufe,d||(m.as="script"),m.crossOrigin="",m.href=c,l&&m.setAttribute("nonce",l),document.head.appendChild(m),d)return new Promise((y,x)=>{m.addEventListener("load",y),m.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})};class zfe extends R.Component{constructor(){super(...arguments);fo(this,"state",{error:null})}static getDerivedStateFromError(n){return{error:n}}render(){return this.state.error?v.jsxs("div",{className:"h-[480px] rounded-2xl border border-red-500/20 bg-red-500/5 p-6 text-xs text-red-400 overflow-auto",children:[v.jsx("div",{className:"font-semibold mb-2",children:"Graph konnte nicht gerendert werden"}),v.jsx("pre",{className:"whitespace-pre-wrap break-words text-[11px] leading-relaxed",children:this.state.error.message})]}):this.props.children}}const Bfe=R.lazy(()=>Ffe(()=>import("./GraphView-DcdEwQDM.js"),[]).then(t=>({default:t.GraphView}))),L3=["identity","knowledge","rules","events"],D3=new Set(["auto","agent","hermes"]),WE={identity:{label:"Identität",icon:e9,bg:"bg-cyan-500/10",text:"text-cyan-400"},knowledge:{label:"Wissen",icon:sy,bg:"bg-indigo-500/10",text:"text-indigo-400"},rules:{label:"Regeln",icon:K8,bg:"bg-violet-500/10",text:"text-violet-400"},events:{label:"Ereignisse",icon:A8,bg:"bg-amber-500/10",text:"text-amber-400"}},U3={label:"Gedächtnis",icon:AT,bg:"bg-muted/10",text:"text-muted-foreground"},Hfe={identity:"border-l-cyan-500/80",knowledge:"border-l-indigo-500/80",rules:"border-l-violet-500/80",events:"border-l-amber-500/80"},j3=`Hi Hermes! Lass uns ein kurzes Onboarding machen, damit du dich künftig an mich erinnerst. Stell mir nacheinander ein paar kurze Fragen zu:
|
||
1) wer ich bin und woran ich gerade arbeite,
|
||
2) wie ich angesprochen werden möchte,
|
||
3) meine bevorzugten Tools, Sprachen und Arbeitsweise,
|
||
4) wichtige Regeln/Konventionen, die du beachten sollst,
|
||
5) meine Infrastruktur (Server, Dienste – ohne Geheimnisse).
|
||
Frag immer nur eine Sache auf einmal und fass am Ende zusammen, was du dir gemerkt hast.`;function Vfe(){const[t,e]=R.useState(""),[n,r]=R.useState(""),[i,s]=R.useState(""),[o,a]=R.useState("knowledge"),[l,c]=R.useState(!1),[d,f]=R.useState(!1),[m,y]=R.useState("graph"),[x,S]=R.useState(!1),_=$h(),{showAlert:w,showConfirm:A,dialogElement:T}=Qg(),{data:C=[]}=jT({}),{data:O=[],error:N}=jT({q:n,category:t}),{data:D}=c7(m==="graph"),F=N?String(N):"",V=()=>{_.invalidateQueries({queryKey:["memory"]}),_.invalidateQueries({queryKey:["memory-graph"]})},k=R.useMemo(()=>{const K=C.length,q=C.filter($=>D3.has($.source)).length;return{total:K,auto:q,manual:K-q,cats:new Set(C.map($=>$.category)).size}},[C]),j=C.length===0,H=R.useMemo(()=>{const K=D??{nodes:[],edges:[]};if(!n.trim())return K;const q=n.toLowerCase(),$=K.nodes.filter(ge=>ge.content.toLowerCase().includes(q)),Z=new Set($.map(ge=>ge.id));return{nodes:$,edges:K.edges.filter(ge=>Z.has(ge.source)&&Z.has(ge.target))}},[D,n]);async function ne(){i.trim()&&(await jt("/api/memory",{method:"POST",body:JSON.stringify({content:i,category:o,source:"ui"})}),s(""),S(!1),V())}async function te(K){await jt(`/api/memory/${K}`,{method:"DELETE"}),V()}async function pe(){try{await navigator.clipboard.writeText(j3),f(!0),setTimeout(()=>f(!1),1800)}catch{w("Kopieren fehlgeschlagen","Markiere den Prompt und kopiere ihn manuell (Strg+C).")}}function oe(){pe(),window.dispatchEvent(new CustomEvent("mc-navigate",{detail:{view:"terminal"}}))}async function ce(){c(!0);try{const K=await jt("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!1})});if(K.duplicate_count===0){w("Ergebnis","Keine Dubletten gefunden — alles sauber.");return}A("Deduplizierung bestätigen",`${K.duplicate_count} Dublette(n) in ${K.groups.length} Gruppe(n) gefunden. Entfernen?`,async()=>{try{await jt("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!0})}),V()}catch(q){w("Fehler",`Fehler beim Löschen: ${q.message}`)}})}catch(K){w("Fehler",`Fehler bei der Deduplizierung: ${K.message}`)}finally{c(!1)}}const B=({value:K,label:q,accent:$})=>v.jsxs("span",{className:nt("flex items-center gap-1.5 text-[11px] rounded-lg px-2.5 py-1 border",$==="auto"?"text-emerald-400 bg-emerald-500/[0.07] border-emerald-500/20":"text-muted-foreground bg-card/40 border-border/50"),children:[$==="auto"&&v.jsx(Vm,{className:"h-3 w-3"}),v.jsx("b",{className:nt("font-semibold",$==="auto"?"":"text-foreground"),children:K})," ",q]});return v.jsxs("div",{className:"space-y-5",children:[v.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center justify-between gap-3",children:[v.jsxs("div",{children:[v.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Gedächtnis-Pool"}),v.jsx("p",{className:"text-sm text-muted-foreground",children:"Geteilte Konstitution — Hermes, IDEs & Gateway lesen und lernen hier per MCP."})]}),v.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[v.jsxs("div",{className:"relative",children:[v.jsx("input",{value:n,onChange:K=>r(K.target.value),placeholder:"Semantisch suchen…",className:"w-52 h-9 pl-8 pr-3 rounded-lg border border-border/60 bg-card/45 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),v.jsx(yP,{className:"absolute left-2.5 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),v.jsxs("button",{onClick:()=>S(K=>!K),className:"h-9 px-3 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer shadow-md shadow-primary/10",children:[v.jsx(NT,{className:"h-4 w-4"})," Eintrag"]}),v.jsx("div",{className:"flex items-center gap-1 p-1 bg-card/30 border border-border/40 rounded-lg",children:[["liste",F8,"Liste"],["graph",Z8,"Graph"]].map(([K,q,$])=>v.jsxs("button",{onClick:()=>y(K),className:nt("flex h-7 px-2.5 items-center gap-1.5 text-[11px] font-semibold rounded-md transition-all cursor-pointer",m===K?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[v.jsx(q,{className:"h-3.5 w-3.5"})," ",$]},K))}),v.jsx("button",{onClick:ce,disabled:l,className:"flex h-9 w-9 items-center justify-center rounded-lg border border-border/60 bg-card hover:border-primary/50 transition-all cursor-pointer shadow-md disabled:opacity-50",title:"Deduplizieren",children:v.jsx(Vm,{className:"h-4 w-4 text-primary"})})]})]}),!j&&v.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[v.jsx(B,{value:k.total,label:"Fakten"}),v.jsx(B,{value:k.auto,label:"auto gelernt",accent:"auto"}),v.jsx(B,{value:k.manual,label:"manuell"}),v.jsx(B,{value:k.cats,label:"Kategorien"}),v.jsxs("span",{className:"ml-auto text-[11px] text-muted-foreground/70 flex items-center gap-1.5",children:[v.jsx(Vm,{className:"h-3 w-3 text-emerald-400"})," lernt automatisch aus Hermes-Gesprächen"]})]}),x&&v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-4 space-y-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Neuen Eintrag anlegen"}),v.jsx("button",{onClick:()=>S(!1),className:"text-muted-foreground hover:text-foreground",children:v.jsx(Bc,{className:"h-4 w-4"})})]}),v.jsx("textarea",{value:i,onChange:K=>s(K.target.value),rows:2,placeholder:"Eine Regel, Vorliebe oder einen stabilen Fakt über dich oder das Projekt…",className:"w-full resize-none rounded-xl border border-border/60 bg-background/30 p-3 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground leading-relaxed"}),v.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[v.jsx("select",{value:o,onChange:K=>a(K.target.value),className:"h-8 rounded-lg border border-border/60 bg-background/50 px-2 text-xs outline-none font-semibold text-foreground cursor-pointer",children:L3.map(K=>{var q;return v.jsx("option",{value:K,className:"bg-popover text-foreground",children:((q=WE[K])==null?void 0:q.label)||K},K)})}),v.jsxs("button",{onClick:ne,className:"h-9 px-4 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer",children:[v.jsx(NT,{className:"h-4 w-4"})," Speichern"]})]})]}),F&&v.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Fehler: ",F]}),j?v.jsxs("div",{className:"rounded-2xl border border-dashed border-border/60 bg-card/20 p-8 sm:p-10 flex flex-col items-center text-center gap-5",children:[v.jsx("div",{className:"h-14 w-14 rounded-2xl bg-primary/10 flex items-center justify-center",children:v.jsx(B8,{className:"h-7 w-7 text-primary"})}),v.jsxs("div",{className:"space-y-1.5 max-w-lg",children:[v.jsx("h3",{className:"text-base font-semibold text-foreground",children:"Lass Hermes dich kennenlernen"}),v.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Statt Fakten einzutippen: führ ein kurzes Onboarding-Gespräch mit Hermes. Was ihr besprecht, merkt sich das Gedächtnis automatisch — du musst nichts manuell pflegen."})]}),v.jsxs("div",{className:"w-full max-w-lg text-left",children:[v.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[v.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Sende das an Hermes"}),v.jsx("button",{onClick:pe,className:"flex items-center gap-1 text-[10px] font-semibold text-muted-foreground hover:text-foreground transition-colors",children:d?v.jsxs(v.Fragment,{children:[v.jsx(Go,{className:"h-3 w-3 text-emerald-400"})," Kopiert"]}):v.jsxs(v.Fragment,{children:[v.jsx(J_,{className:"h-3 w-3"})," Kopieren"]})})]}),v.jsx("pre",{className:"w-full rounded-xl border border-border/60 bg-background/40 p-3.5 text-[11px] leading-relaxed text-foreground/90 whitespace-pre-wrap font-mono",children:j3})]}),v.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[v.jsxs("button",{onClick:oe,className:"h-9 px-4 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer",children:[v.jsx(aF,{className:"h-4 w-4"})," Im Terminal starten"]}),v.jsxs("button",{onClick:pe,className:"h-9 px-4 rounded-lg border border-border/60 bg-card text-xs font-semibold hover:border-primary/50 transition-all flex items-center gap-1.5 cursor-pointer",children:[d?v.jsx(Go,{className:"h-4 w-4 text-emerald-400"}):v.jsx(J_,{className:"h-4 w-4"})," Prompt kopieren"]})]}),v.jsxs("p",{className:"text-[11px] text-muted-foreground/70 flex items-center gap-1.5",children:[v.jsx(Y8,{className:"h-3 w-3"})," Funktioniert genauso über Telegram —"," ",v.jsx("button",{onClick:()=>S(!0),className:"underline hover:text-foreground",children:"oder lieber manuell anlegen"}),"."]})]}):m==="graph"?v.jsx(zfe,{children:v.jsx(R.Suspense,{fallback:v.jsx("div",{className:"h-[480px] rounded-2xl border border-border/60 bg-card/30 flex items-center justify-center text-xs text-muted-foreground",children:"Graph wird geladen…"}),children:v.jsx(Bfe,{data:H,onDelete:te})})}):v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 p-1 bg-card/30 border border-border/40 rounded-xl w-fit",children:[v.jsx("button",{onClick:()=>e(""),className:nt("h-7 px-3 rounded-lg text-[10px] font-semibold uppercase tracking-wider transition-all cursor-pointer",t?"text-muted-foreground hover:text-foreground":"bg-primary text-primary-foreground"),children:"Alle"}),L3.map(K=>{const q=WE[K]||U3,$=q.icon;return v.jsxs("button",{onClick:()=>e(K),className:nt("h-7 px-2.5 rounded-lg text-[10px] font-semibold uppercase tracking-wider transition-all cursor-pointer flex items-center gap-1",t===K?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[v.jsx($,{className:"h-3 w-3"})," ",q.label]},K)})]}),v.jsx("div",{className:"space-y-3",children:O.length===0?v.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center",children:"Keine Einträge für die aktuellen Filterkriterien gefunden."}):O.map(K=>{const q=WE[K.category]||U3,$=q.icon,Z=D3.has(K.source);return v.jsxs("div",{className:nt("flex items-start justify-between gap-4 p-4 rounded-xl border border-l-4 bg-card/45 backdrop-blur-md border-border/60 shadow-md shadow-black/5 hover:border-primary/20 transition-all group",Hfe[K.category]||"border-l-muted"),children:[v.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[v.jsxs("span",{className:nt("flex items-center gap-1 px-2 py-0.5 rounded text-[9px] font-bold uppercase tracking-wider font-mono shrink-0",q.bg,q.text),children:[v.jsx($,{className:"h-3 w-3"}),v.jsx("span",{className:"hidden sm:inline",children:q.label})]}),v.jsx("span",{className:"text-xs text-foreground leading-relaxed break-words whitespace-pre-wrap flex-1",children:K.content})]}),v.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[typeof K.score=="number"&&v.jsxs("span",{className:"text-[9px] font-mono text-primary bg-primary/10 px-1.5 py-0.5 rounded uppercase tracking-wider",title:"Relevanz der semantischen Suche",children:[Math.round(K.score*100),"%"]}),v.jsxs("span",{className:nt("flex items-center gap-1 text-[9px] font-mono px-1.5 py-0.5 rounded uppercase tracking-wider",Z?"text-emerald-400 bg-emerald-500/10":"text-muted-foreground/60 bg-background/20"),title:Z?"Automatisch gelernt":"Manuell angelegt",children:[Z&&v.jsx(Vm,{className:"h-2.5 w-2.5"}),K.source]}),v.jsx("button",{onClick:()=>te(K.id),title:"Eintrag löschen",className:"h-7 w-7 rounded-lg flex items-center justify-center border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 transition-all opacity-0 group-hover:opacity-100",children:v.jsx(IT,{className:"h-3.5 w-3.5"})})]})]},K.id)})})]}),T]})}function Db({label:t,ok:e,detail:n,icon:r,onClick:i}){return v.jsxs("div",{onClick:i,className:nt("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-3 hover:border-primary/40 transition-all duration-300",e?"border-border/60":"border-amber-500/30",i&&"cursor-pointer hover:bg-card/70"),children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:t}),v.jsx(r,{className:nt("h-4.5 w-4.5",e?"text-primary":"text-amber-500")})]}),v.jsxs("div",{className:"space-y-1.5",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("span",{className:nt("h-2 w-2 rounded-full ring-2 ring-black/40",e?"bg-emerald-500 animate-pulse":"bg-amber-500")}),v.jsx("span",{className:"text-xs font-semibold text-foreground",children:e?"Bereit / Online":"Offline / Inaktiv"})]}),n&&v.jsx("div",{className:"text-[10px] font-mono text-muted-foreground truncate max-w-[200px]",title:n,children:n})]}),i&&v.jsxs("button",{onClick:s=>{s.stopPropagation(),i()},className:"mt-2 flex items-center justify-center gap-1.5 w-full py-1.5 px-3 rounded-lg border border-primary/30 bg-primary/10 hover:bg-primary/20 text-primary text-[10px] font-bold uppercase tracking-wider transition-all cursor-pointer font-space",children:[v.jsx(El,{className:"h-3.5 w-3.5"}),v.jsx("span",{children:"Gehirn wechseln"})]})]})}function Gfe(){const{data:t,error:e}=EP(5e3),{data:n}=qh(),{showAlert:r,dialogElement:i}=Qg(),s=$h(),o=e?String(e):"",a=R.useMemo(()=>["auto","fast","heavy",...((n==null?void 0:n.models)??[]).map(O=>{var N;return((N=O.name.split("/").pop())==null?void 0:N.replace(".gguf",""))||O.name})],[n]),[l,c]=R.useState(null),[d,f]=R.useState(!1),[m,y]=R.useState({width:800,height:360}),x=R.useRef(null),S=R.useCallback(C=>{if(x.current&&(x.current.disconnect(),x.current=null),C){const O=new ResizeObserver(N=>{if(!N||N.length===0)return;const D=N[0].contentRect;y({width:D.width,height:D.height})});O.observe(C),x.current=O}},[]),_=m.width,w=m.height,A=(C,O,N,D)=>{const F=(C+N)/2;return`M ${C} ${O} C ${F} ${O}, ${F} ${D}, ${N} ${D}`};async function T(C){try{await jt("/api/agent/brain",{method:"POST",body:JSON.stringify({model:C})}),r("Erfolgreich",`Hermes-Gehirn wurde auf '${C}' geändert. Der Gateway-Dienst wurde neu gestartet.`),s.invalidateQueries({queryKey:Lr.agentStatus}),f(!1)}catch(O){r("Fehler",`Fehler beim Wechseln des Gehirns: ${O.message}`)}}return v.jsxs("div",{className:"space-y-6",children:[v.jsx("style",{children:`
|
||
@keyframes flow-dash {
|
||
to {
|
||
stroke-dashoffset: -20;
|
||
}
|
||
}
|
||
.svg-flow-path {
|
||
stroke-dasharray: 4 6;
|
||
animation: flow-dash 1s linear infinite;
|
||
}
|
||
`}),v.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[v.jsxs("div",{children:[v.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Hermes Agenten-Cockpit"}),v.jsxs("p",{className:"text-sm text-muted-foreground",children:["Hermes ist ein autonomer Agent, der im Hintergrund der Box läuft (Port ",v.jsx("code",{children:":8642"}),") und seine eigene UI besitzt."]})]}),(t==null?void 0:t.terminal_url)&&v.jsxs("a",{href:_g(t.terminal_url),target:"_blank",rel:"noopener",className:nt("flex h-9 px-4 items-center gap-1.5 text-xs font-semibold rounded-lg transition-all cursor-pointer shadow-md shrink-0 self-start",t.terminal_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-primary/10":"border border-border/60 text-muted-foreground bg-background/20"),children:[v.jsx(iy,{className:"h-4 w-4"}),v.jsx("span",{children:"Terminal öffnen"})]})]}),o&&v.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400 font-mono",children:["Status nicht lesbar (",o,")."]}),t&&v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[v.jsx(Db,{label:"Agent Gateway",ok:t.gateway_reachable,detail:"Port :8642 (REST API)",icon:qc}),v.jsx(Db,{label:"Terminal",ok:t.terminal_reachable,detail:"Web-Terminal (hermes chat)",icon:ry}),v.jsx(Db,{label:"Aktives Gehirn",ok:t.gateway_reachable,detail:t.brain_model?`Model: ${t.brain_model}`:"Model: auto",icon:El,onClick:()=>f(!0)}),v.jsx(Db,{label:"Verdrahtung",ok:t.has_config,detail:`Config: ${t.has_config?"✓":"—"} · Skills: ${t.has_skills?"✓":"—"} · Memory: ${t.has_memories?"✓":"—"}`,icon:ew})]}),v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-4",children:[v.jsxs("div",{children:[v.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Agent Flow Graph"}),v.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 leading-relaxed",children:"Visualisiert das Zusammenspiel und die Verbindungspfade zwischen den Hermes-Systemkomponenten."})]}),v.jsxs("div",{ref:S,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[v.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[v.jsxs("defs",{children:[v.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[v.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),v.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),v.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[v.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),v.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),v.jsx("path",{d:A(_*.15,w*.5,_*.5,w*.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(l==="terminal"||t.terminal_reachable)&&v.jsx("path",{d:A(_*.15,w*.5,_*.5,w*.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:A(_*.5,w*.5,_*.85,w*.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(l==="gateway"||l==="brain"||t.gateway_reachable)&&v.jsx("path",{d:A(_*.5,w*.5,_*.85,w*.3),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:A(_*.5,w*.5,_*.85,w*.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(l==="gateway"||l==="wiring"||t.gateway_reachable)&&v.jsx("path",{d:A(_*.5,w*.5,_*.85,w*.7),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),v.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-36 h-9 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2.5 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"15%",top:"50%"},onMouseEnter:()=>c("terminal"),onMouseLeave:()=>c(null),onClick:()=>t.terminal_reachable&&window.open(_g(t.terminal_url),"_blank"),title:t.terminal_reachable?"Klicken um das Hermes-Terminal zu öffnen":"Terminal offline",children:[v.jsx(ry,{className:nt("h-3.5 w-3.5",t.terminal_reachable?"text-emerald-400":"text-amber-500")}),v.jsx("span",{children:"Terminal"}),v.jsx("span",{className:nt("w-1.5 h-1.5 rounded-full animate-pulse ml-auto",t.terminal_reachable?"bg-emerald-500":"bg-amber-500")})]}),v.jsxs("div",{className:"absolute select-none z-10 w-40 py-2.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-2xl border border-primary/50 bg-card/90 backdrop-blur-md flex flex-col items-center justify-center text-center shadow-lg shadow-primary/5 cursor-pointer",style:{left:"50%",top:"50%"},onMouseEnter:()=>c("gateway"),onMouseLeave:()=>c(null),children:[v.jsxs("div",{className:"flex items-center gap-1",children:[v.jsx(qc,{className:"h-3.5 w-3.5 text-primary"}),v.jsx("span",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Agent Gateway"})]}),v.jsx("div",{className:"text-[9px] font-mono text-muted-foreground mt-0.5",children:"Port :8642"}),v.jsx("div",{className:nt("mt-1 px-1.5 py-0.5 rounded text-[8px] font-semibold uppercase font-mono border",t.gateway_reachable?"bg-emerald-500/10 border-emerald-500/20 text-emerald-400":"bg-red-500/10 border-red-500/20 text-red-400"),children:t.gateway_reachable?"Online":"Offline"})]}),v.jsxs("div",{className:nt("absolute z-20 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none cursor-pointer",t.gateway_reachable?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":"border-border/60 bg-card/75"),style:{left:"85%",top:"30%"},onMouseEnter:()=>c("brain"),onMouseLeave:()=>c(null),onClick:()=>f(!0),children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[v.jsx(El,{className:"h-3 w-3 text-primary"}),v.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Aktives Gehirn"})]}),t.gateway_reachable&&v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),v.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground font-space",title:t.brain_model,children:t.brain_model||"auto"})]}),v.jsxs("div",{className:nt("absolute z-10 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none",t.has_config?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":"border-border/60 bg-card/75"),style:{left:"85%",top:"70%"},onMouseEnter:()=>c("wiring"),onMouseLeave:()=>c(null),children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[v.jsx(ew,{className:"h-3 w-3 text-primary"}),v.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Verdrahtung"})]}),t.has_config&&v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),v.jsxs("div",{className:"text-[9px] font-mono mt-0.5 text-muted-foreground flex gap-1 justify-between",children:[v.jsxs("span",{children:["Config: ",t.has_config?"✓":"—"]}),v.jsxs("span",{children:["Skills: ",t.has_skills?"✓":"—"]}),v.jsxs("span",{children:["Memory: ",t.has_memories?"✓":"—"]})]})]})]}),v.jsxs("div",{className:"flex flex-wrap items-center gap-6 mt-3 text-[10px] text-muted-foreground border-t border-border/20 pt-3",children:[v.jsxs("span",{className:"flex items-center gap-1.5",children:[v.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),v.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Agenten"})]}),v.jsxs("span",{className:"flex items-center gap-1.5",children:[v.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),v.jsx("span",{children:"Grüner Puls: Verbindung hergestellt / Modul online"})]})]})]}),v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 space-y-4 shadow-lg shadow-black/10",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(H8,{className:"h-5 w-5 text-primary"}),v.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"PC Verbindung"})]}),v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("span",{className:nt("h-2 w-2 rounded-full",t.pc_executor_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),v.jsx("span",{className:"text-xs font-semibold text-foreground",children:t.pc_executor_reachable?"Erreichbar":"Nicht verbunden"})]})]}),v.jsxs("div",{className:"grid gap-6 md:grid-cols-2 text-xs text-muted-foreground leading-relaxed text-left",children:[v.jsxs("div",{className:"space-y-3",children:[v.jsxs("p",{children:["Der ",v.jsx("strong",{className:"text-foreground",children:"Hermes PC Executor"})," läuft auf ",v.jsx("code",{className:"text-foreground font-mono px-1 py-0.5 rounded bg-muted/40 border border-border/30",children:"192.168.178.98:7777"})," und ermöglicht Hermes den direkten Zugriff auf deinen Windows-PC — Shell-Befehle, Screenshots, Tastatureingaben."]}),v.jsxs("p",{children:["Hermes erreicht den PC über den MCP-Server ",v.jsx("code",{className:"text-foreground font-mono px-1 py-0.5 rounded bg-muted/40 border border-border/30",children:"hermes-pc-control"}),", der automatisch beim Gateway-Start verbunden wird."]})]}),v.jsx("div",{className:"space-y-3",children:t.pc_executor_reachable?v.jsxs("div",{className:"p-3.5 bg-emerald-500/5 border border-emerald-500/20 rounded-xl space-y-1",children:[v.jsxs("div",{className:"text-emerald-400 font-semibold text-xs flex items-center gap-1.5",children:[v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"PC Executor verbunden"]}),v.jsxs("p",{className:"text-[10px]",children:["Hermes kann jetzt per Telegram oder Terminal Befehle auf TobisNicerPC ausführen. Nutze ",v.jsx("code",{className:"text-foreground",children:"pc_shell"}),", ",v.jsx("code",{className:"text-foreground",children:"pc_screenshot"})," oder ",v.jsx("code",{className:"text-foreground",children:"pc_open"}),"."]})]}):v.jsxs("div",{className:"space-y-2",children:[v.jsx("h4",{className:"text-xs font-bold text-foreground",children:"PC Executor starten"}),v.jsxs("p",{children:["Starte ",v.jsx("code",{className:"text-foreground font-mono",children:"start.bat"})," im Ordner ",v.jsx("code",{className:"text-foreground font-mono",children:"client\\hermes-pc\\"})," auf dem Windows-PC und lasse das Fenster offen."]}),v.jsx("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[9px] text-cyan-300",children:"client\\hermes-pc\\start.bat"})]})})]})]}),!t.gateway_reachable&&v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 space-y-4 shadow-lg shadow-black/10 text-left",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(sy,{className:"h-5 w-5 text-amber-500"}),v.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"Hermes-Agent Diagnostics"})]}),v.jsxs("div",{className:"text-xs text-muted-foreground space-y-3 leading-relaxed",children:[v.jsx("p",{children:"Der Hermes-Dienst ist auf der Box derzeit offline oder kann sich nicht mit dem lokalen llama-swap verbinden."}),v.jsxs("p",{children:["Stelle sicher, dass die systemd-Dienste auf der Box laufen. Du kannst den Status im ",v.jsx("strong",{children:"OS & Updates Drawer"})," prüfen und die Dienste bei Bedarf neu starten."]}),v.jsxs("div",{className:"p-3.5 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1",children:[v.jsx("div",{className:"text-muted-foreground/60",children:"# Dienste manuell auf der Box prüfen:"}),v.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-gateway"}),v.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-terminal"})]}),v.jsxs("p",{children:["Weitere Einrichtungsdetails (Brain-Konfiguration, MCP-Kopplungen, SSH-Tunneling und Such-Engines) findest du in der Dokumentationsdatei:",v.jsx("code",{className:"ml-1 px-1.5 py-0.5 rounded bg-muted/40 text-foreground border border-border/30",children:"docs/HERMES_SETUP.md"}),"."]})]})]})]}),t&&d&&v.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:v.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[v.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[v.jsx(El,{className:"h-4 w-4"}),v.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),v.jsx("button",{onClick:()=>f(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:v.jsx(Bc,{className:"h-4 w-4"})})]}),v.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:['Das „Gehirn" ist das primäre LLM für Hermes. Wähle ein Modell aus deiner Bibliothek oder nutze ein Gateway-Alias (',v.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",v.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",v.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),v.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:a.map(C=>{const O=["auto","fast","heavy"].includes(C);return v.jsxs("button",{onClick:()=>T(C),className:nt("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border border-border/30",t.brain_model===C||!t.brain_model&&C==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[v.jsxs("div",{className:"flex flex-col text-left",children:[v.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:C}),v.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:O?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(t.brain_model===C||!t.brain_model&&C==="auto")&&v.jsx(Go,{className:"h-4 w-4 shrink-0 text-primary"})]},C)})})]})}),i]})}function Wfe(){const{data:t}=EP(5e3),e=t!=null&&t.terminal_url?_g(t.terminal_url):void 0,n=t==null?void 0:t.terminal_reachable;return v.jsxs("div",{className:"flex h-full flex-col gap-4",children:[v.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[v.jsxs("div",{children:[v.jsx("h1",{className:"bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text font-space text-2xl font-bold tracking-tight text-transparent",children:"Hermes Terminal"}),v.jsxs("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:["Interaktiver Agent (",v.jsx("code",{className:"rounded bg-background/40 px-1 font-mono text-[11px] text-primary",children:"hermes chat"}),') mit Tools & PC-Steuerung — „mehr als Chatten".']})]}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground",children:[v.jsx("span",{className:`h-2 w-2 rounded-full ${n?"bg-emerald-500 animate-pulse":"bg-amber-500"}`}),n?"online":"offline"]}),e&&v.jsxs("a",{href:e,target:"_blank",rel:"noopener",className:"flex h-8 items-center gap-1.5 rounded-lg border border-border/60 bg-background/20 px-3 text-xs font-semibold text-muted-foreground transition-all hover:border-primary/50 hover:text-foreground",children:[v.jsx(iy,{className:"h-3.5 w-3.5"})," In neuem Tab"]})]})]}),e?v.jsxs("div",{className:"relative min-h-[68vh] flex-1 overflow-hidden rounded-2xl border border-border/60 bg-black/50 shadow-lg shadow-black/25",children:[n===!1&&v.jsxs("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center gap-3 bg-black/70 text-center",children:[v.jsx(yg,{className:"h-8 w-8 text-amber-400"}),v.jsx("div",{className:"text-sm font-semibold text-amber-300",children:"Terminal nicht erreichbar"}),v.jsxs("p",{className:"max-w-sm text-[11px] leading-normal text-muted-foreground",children:["Der ",v.jsx("code",{className:"font-mono text-primary",children:"hermes-terminal"}),"-Dienst (ttyd) läuft nicht. Auf der Box: ",v.jsx("code",{className:"font-mono",children:"systemctl --user restart hermes-terminal"}),"."]})]}),v.jsx("iframe",{src:e,title:"Hermes Terminal",className:"h-full w-full border-0",style:{minHeight:"68vh"}})]}):v.jsxs("div",{className:"flex min-h-[68vh] flex-1 items-center justify-center rounded-2xl border border-border/60 bg-background/20 text-xs text-muted-foreground",children:[v.jsx(oF,{className:"mr-2 h-4 w-4"})," Lade Terminal…"]})]})}/**
|
||
* @license
|
||
* Copyright 2010-2024 Three.js Authors
|
||
* SPDX-License-Identifier: MIT
|
||
*/const Td="169",Xf={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},qf={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},dV=0,jC=1,fV=2,$fe=3,hV=0,FS=1,W0=2,Oa=3,Dl=0,ss=1,xo=2,Wc=0,Sh=1,FC=2,zC=3,BC=4,pV=5,ud=100,mV=101,gV=102,vV=103,yV=104,xV=200,bV=201,_V=202,wV=203,Yw=204,Zw=205,SV=206,MV=207,EV=208,AV=209,TV=210,CV=211,PV=212,RV=213,NV=214,Qw=0,Jw=1,e1=2,Uh=3,t1=4,n1=5,r1=6,i1=7,ox=0,IV=1,kV=2,Cl=0,OV=1,LV=2,DV=3,l2=4,UV=5,jV=6,FV=7,HC="attached",zV="detached",zS=300,Jc=301,Cd=302,My=303,Ey=304,Jg=306,Pd=1e3,_o=1001,Rg=1002,ri=1003,BS=1004,Xfe=1004,ih=1005,qfe=1005,Cr=1006,tg=1007,Kfe=1007,qo=1008,Yfe=1008,Ha=1009,c2=1010,u2=1011,Ng=1012,HS=1013,eu=1014,Zs=1015,ev=1016,VS=1017,GS=1018,jh=1020,d2=35902,f2=1021,h2=1022,is=1023,p2=1024,m2=1025,Mh=1026,Fh=1027,WS=1028,ax=1029,g2=1030,$S=1031,Zfe=1032,XS=1033,$0=33776,X0=33777,q0=33778,K0=33779,s1=35840,o1=35841,a1=35842,l1=35843,c1=36196,u1=37492,d1=37496,f1=37808,h1=37809,p1=37810,m1=37811,g1=37812,v1=37813,y1=37814,x1=37815,b1=37816,_1=37817,w1=37818,S1=37819,M1=37820,E1=37821,Y0=36492,A1=36494,T1=36495,v2=36283,C1=36284,P1=36285,R1=36286,BV=2200,HV=2201,VV=2202,Ig=2300,kg=2301,W_=2302,sh=2400,oh=2401,Ay=2402,qS=2500,y2=2501,GV=0,x2=1,N1=2,WV=3200,$V=3201,Qfe=3202,Jfe=3203,lu=0,XV=1,Lc="",ji="srgb",xi="srgb-linear",KS="display-p3",lx="display-p3-linear",Ty="linear",Jn="srgb",Cy="rec709",Py="p3",ehe=0,Kf=7680,the=7681,nhe=7682,rhe=7683,ihe=34055,she=34056,ohe=5386,ahe=512,lhe=513,che=514,uhe=515,dhe=516,fhe=517,hhe=518,VC=519,qV=512,KV=513,YV=514,b2=515,ZV=516,QV=517,JV=518,e6=519,Ry=35044,t6=35048,phe=35040,mhe=35045,ghe=35049,vhe=35041,yhe=35046,xhe=35050,bhe=35042,_he="100",GC="300 es",Ml=2e3,Ny=2001;let Bl=class{addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(n)===-1&&r[e].push(n)}hasEventListener(e,n){if(this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(n)!==-1}removeEventListener(e,n){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(n);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const r=this._listeners[e.type];if(r!==void 0){e.target=this;const i=r.slice(0);for(let s=0,o=i.length;s<o;s++)i[s].call(this,e);e.target=null}}};const Qi=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let F3=1234567;const Eh=Math.PI/180,Og=180/Math.PI;function So(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(Qi[t&255]+Qi[t>>8&255]+Qi[t>>16&255]+Qi[t>>24&255]+"-"+Qi[e&255]+Qi[e>>8&255]+"-"+Qi[e>>16&15|64]+Qi[e>>24&255]+"-"+Qi[n&63|128]+Qi[n>>8&255]+"-"+Qi[n>>16&255]+Qi[n>>24&255]+Qi[r&255]+Qi[r>>8&255]+Qi[r>>16&255]+Qi[r>>24&255]).toLowerCase()}function Ar(t,e,n){return Math.max(e,Math.min(n,t))}function _2(t,e){return(t%e+e)%e}function whe(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)}function She(t,e,n){return t!==e?(n-t)/(e-t):0}function Z0(t,e,n){return(1-n)*t+n*e}function Mhe(t,e,n,r){return Z0(t,e,1-Math.exp(-n*r))}function Ehe(t,e=1){return e-Math.abs(_2(t,e*2)-e)}function Ahe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function The(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))}function Che(t,e){return t+Math.floor(Math.random()*(e-t+1))}function Phe(t,e){return t+Math.random()*(e-t)}function Rhe(t){return t*(.5-Math.random())}function Nhe(t){t!==void 0&&(F3=t);let e=F3+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Ihe(t){return t*Eh}function khe(t){return t*Og}function Ohe(t){return(t&t-1)===0&&t!==0}function Lhe(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function Dhe(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function Uhe(t,e,n,r,i){const s=Math.cos,o=Math.sin,a=s(n/2),l=o(n/2),c=s((e+r)/2),d=o((e+r)/2),f=s((e-r)/2),m=o((e-r)/2),y=s((r-e)/2),x=o((r-e)/2);switch(i){case"XYX":t.set(a*d,l*f,l*m,a*c);break;case"YZY":t.set(l*m,a*d,l*f,a*c);break;case"ZXZ":t.set(l*f,l*m,a*d,a*c);break;case"XZX":t.set(a*d,l*x,l*y,a*c);break;case"YXY":t.set(l*y,a*d,l*x,a*c);break;case"ZYZ":t.set(l*x,l*y,a*d,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Ss(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function cn(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(t*4294967295);case Uint16Array:return Math.round(t*65535);case Uint8Array:return Math.round(t*255);case Int32Array:return Math.round(t*2147483647);case Int16Array:return Math.round(t*32767);case Int8Array:return Math.round(t*127);default:throw new Error("Invalid component type.")}}const gr={DEG2RAD:Eh,RAD2DEG:Og,generateUUID:So,clamp:Ar,euclideanModulo:_2,mapLinear:whe,inverseLerp:She,lerp:Z0,damp:Mhe,pingpong:Ehe,smoothstep:Ahe,smootherstep:The,randInt:Che,randFloat:Phe,randFloatSpread:Rhe,seededRandom:Nhe,degToRad:Ihe,radToDeg:khe,isPowerOfTwo:Ohe,ceilPowerOfTwo:Lhe,floorPowerOfTwo:Dhe,setQuaternionFromProperEuler:Uhe,normalize:cn,denormalize:Ss};class Ve{constructor(e=0,n=0){Ve.prototype.isVector2=!0,this.x=e,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,n){return this.x=e,this.y=n,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const n=this.x,r=this.y,i=e.elements;return this.x=i[0]*n+i[3]*r+i[6],this.y=i[1]*n+i[4]*r+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(n,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const r=this.dot(e)/n;return Math.acos(Ar(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y;return n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this}rotateAround(e,n){const r=Math.cos(n),i=Math.sin(n),s=this.x-e.x,o=this.y-e.y;return this.x=s*r-o*i+e.x,this.y=s*i+o*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Xt{constructor(e,n,r,i,s,o,a,l,c){Xt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,r,i,s,o,a,l,c)}set(e,n,r,i,s,o,a,l,c){const d=this.elements;return d[0]=e,d[1]=i,d[2]=a,d[3]=n,d[4]=s,d[5]=l,d[6]=r,d[7]=o,d[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],this}extractBasis(e,n,r){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const n=e.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const r=e.elements,i=n.elements,s=this.elements,o=r[0],a=r[3],l=r[6],c=r[1],d=r[4],f=r[7],m=r[2],y=r[5],x=r[8],S=i[0],_=i[3],w=i[6],A=i[1],T=i[4],C=i[7],O=i[2],N=i[5],D=i[8];return s[0]=o*S+a*A+l*O,s[3]=o*_+a*T+l*N,s[6]=o*w+a*C+l*D,s[1]=c*S+d*A+f*O,s[4]=c*_+d*T+f*N,s[7]=c*w+d*C+f*D,s[2]=m*S+y*A+x*O,s[5]=m*_+y*T+x*N,s[8]=m*w+y*C+x*D,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=e,n[4]*=e,n[7]*=e,n[2]*=e,n[5]*=e,n[8]*=e,this}determinant(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],d=e[8];return n*o*d-n*a*c-r*s*d+r*a*l+i*s*c-i*o*l}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],d=e[8],f=d*o-a*c,m=a*l-d*s,y=c*s-o*l,x=n*f+r*m+i*y;if(x===0)return this.set(0,0,0,0,0,0,0,0,0);const S=1/x;return e[0]=f*S,e[1]=(i*c-d*r)*S,e[2]=(a*r-i*o)*S,e[3]=m*S,e[4]=(d*n-i*l)*S,e[5]=(i*s-a*n)*S,e[6]=y*S,e[7]=(r*l-c*n)*S,e[8]=(o*n-r*s)*S,this}transpose(){let e;const n=this.elements;return e=n[1],n[1]=n[3],n[3]=e,e=n[2],n[2]=n[6],n[6]=e,e=n[5],n[5]=n[7],n[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const n=this.elements;return e[0]=n[0],e[1]=n[3],e[2]=n[6],e[3]=n[1],e[4]=n[4],e[5]=n[7],e[6]=n[2],e[7]=n[5],e[8]=n[8],this}setUvTransform(e,n,r,i,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(r*l,r*c,-r*(l*o+c*a)+o+e,-i*c,i*l,-i*(-c*o+l*a)+a+n,0,0,1),this}scale(e,n){return this.premultiply($E.makeScale(e,n)),this}rotate(e){return this.premultiply($E.makeRotation(-e)),this}translate(e,n){return this.premultiply($E.makeTranslation(e,n)),this}makeTranslation(e,n){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,n,0,0,1),this}makeRotation(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,-r,0,r,n,0,0,0,1),this}makeScale(e,n){return this.set(e,0,0,0,n,0,0,0,1),this}equals(e){const n=this.elements,r=e.elements;for(let i=0;i<9;i++)if(n[i]!==r[i])return!1;return!0}fromArray(e,n=0){for(let r=0;r<9;r++)this.elements[r]=e[r+n];return this}toArray(e=[],n=0){const r=this.elements;return e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2],e[n+3]=r[3],e[n+4]=r[4],e[n+5]=r[5],e[n+6]=r[6],e[n+7]=r[7],e[n+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const $E=new Xt;function n6(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}const jhe={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function $m(t,e){return new jhe[t](e)}function Iy(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function r6(){const t=Iy("canvas");return t.style.display="block",t}const z3={};function $_(t){t in z3||(z3[t]=!0,console.warn(t))}function Fhe(t,e,n){return new Promise(function(r,i){function s(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:i();break;case t.TIMEOUT_EXPIRED:setTimeout(s,n);break;default:r()}}setTimeout(s,n)})}function zhe(t){const e=t.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function Bhe(t){const e=t.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const B3=new Xt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),H3=new Xt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),h0={[xi]:{transfer:Ty,primaries:Cy,luminanceCoefficients:[.2126,.7152,.0722],toReference:t=>t,fromReference:t=>t},[ji]:{transfer:Jn,primaries:Cy,luminanceCoefficients:[.2126,.7152,.0722],toReference:t=>t.convertSRGBToLinear(),fromReference:t=>t.convertLinearToSRGB()},[lx]:{transfer:Ty,primaries:Py,luminanceCoefficients:[.2289,.6917,.0793],toReference:t=>t.applyMatrix3(H3),fromReference:t=>t.applyMatrix3(B3)},[KS]:{transfer:Jn,primaries:Py,luminanceCoefficients:[.2289,.6917,.0793],toReference:t=>t.convertSRGBToLinear().applyMatrix3(H3),fromReference:t=>t.applyMatrix3(B3).convertLinearToSRGB()}},Hhe=new Set([xi,lx]),In={enabled:!0,_workingColorSpace:xi,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(t){if(!Hhe.has(t))throw new Error(`Unsupported working color space, "${t}".`);this._workingColorSpace=t},convert:function(t,e,n){if(this.enabled===!1||e===n||!e||!n)return t;const r=h0[e].toReference,i=h0[n].fromReference;return i(r(t))},fromWorkingColorSpace:function(t,e){return this.convert(t,this._workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this._workingColorSpace)},getPrimaries:function(t){return h0[t].primaries},getTransfer:function(t){return t===Lc?Ty:h0[t].transfer},getLuminanceCoefficients:function(t,e=this._workingColorSpace){return t.fromArray(h0[e].luminanceCoefficients)}};function ng(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function XE(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let hm;class i6{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{hm===void 0&&(hm=Iy("canvas")),hm.width=e.width,hm.height=e.height;const r=hm.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=hm}return n.width>2048||n.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),n.toDataURL("image/jpeg",.6)):n.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const n=Iy("canvas");n.width=e.width,n.height=e.height;const r=n.getContext("2d");r.drawImage(e,0,0,e.width,e.height);const i=r.getImageData(0,0,e.width,e.height),s=i.data;for(let o=0;o<s.length;o++)s[o]=ng(s[o]/255)*255;return r.putImageData(i,0,0),n}else if(e.data){const n=e.data.slice(0);for(let r=0;r<n.length;r++)n instanceof Uint8Array||n instanceof Uint8ClampedArray?n[r]=Math.floor(ng(n[r]/255)*255):n[r]=ng(n[r]);return{data:n,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let Vhe=0;class ah{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Vhe++}),this.uuid=So(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const r={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let o=0,a=i.length;o<a;o++)i[o].isDataTexture?s.push(qE(i[o].image)):s.push(qE(i[o]))}else s=qE(i);r.url=s}return n||(e.images[this.uuid]=r),r}}function qE(t){return typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap?i6.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let Ghe=0;class dr extends Bl{constructor(e=dr.DEFAULT_IMAGE,n=dr.DEFAULT_MAPPING,r=_o,i=_o,s=Cr,o=qo,a=is,l=Ha,c=dr.DEFAULT_ANISOTROPY,d=Lc){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Ghe++}),this.uuid=So(),this.name="",this.source=new ah(e),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=r,this.wrapT=i,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new Ve(0,0),this.repeat=new Ve(1,1),this.center=new Ve(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Xt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=d,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const r={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(r.userData=this.userData),n||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==zS)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Pd:e.x=e.x-Math.floor(e.x);break;case _o:e.x=e.x<0?0:1;break;case Rg:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Pd:e.y=e.y-Math.floor(e.y);break;case _o:e.y=e.y<0?0:1;break;case Rg:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}dr.DEFAULT_IMAGE=null;dr.DEFAULT_MAPPING=zS;dr.DEFAULT_ANISOTROPY=1;class Ln{constructor(e=0,n=0,r=0,i=1){Ln.prototype.isVector4=!0,this.x=e,this.y=n,this.z=r,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,n,r,i){return this.x=e,this.y=n,this.z=r,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;case 3:this.w=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this.w=e.w+n.w,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this.w+=e.w*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this.w=e.w-n.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const n=this.x,r=this.y,i=this.z,s=this.w,o=e.elements;return this.x=o[0]*n+o[4]*r+o[8]*i+o[12]*s,this.y=o[1]*n+o[5]*r+o[9]*i+o[13]*s,this.z=o[2]*n+o[6]*r+o[10]*i+o[14]*s,this.w=o[3]*n+o[7]*r+o[11]*i+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const n=Math.sqrt(1-e.w*e.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/n,this.y=e.y/n,this.z=e.z/n),this}setAxisAngleFromRotationMatrix(e){let n,r,i,s;const l=e.elements,c=l[0],d=l[4],f=l[8],m=l[1],y=l[5],x=l[9],S=l[2],_=l[6],w=l[10];if(Math.abs(d-m)<.01&&Math.abs(f-S)<.01&&Math.abs(x-_)<.01){if(Math.abs(d+m)<.1&&Math.abs(f+S)<.1&&Math.abs(x+_)<.1&&Math.abs(c+y+w-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const T=(c+1)/2,C=(y+1)/2,O=(w+1)/2,N=(d+m)/4,D=(f+S)/4,F=(x+_)/4;return T>C&&T>O?T<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(T),i=N/r,s=D/r):C>O?C<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(C),r=N/i,s=F/i):O<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(O),r=D/s,i=F/s),this.set(r,i,s,n),this}let A=Math.sqrt((_-x)*(_-x)+(f-S)*(f-S)+(m-d)*(m-d));return Math.abs(A)<.001&&(A=1),this.x=(_-x)/A,this.y=(f-S)/A,this.z=(m-d)/A,this.w=Math.acos((c+y+w-1)/2),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this.w=n[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this.w=Math.max(e.w,Math.min(n.w,this.w)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this.w=Math.max(e,Math.min(n,this.w)),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(n,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this.w+=(e.w-this.w)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this.z=e.z+(n.z-e.z)*r,this.w=e.w+(n.w-e.w)*r,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this.w=e[n+3],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e[n+3]=this.w,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this.w=e.getW(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class s6 extends Bl{constructor(e=1,n=1,r={}){super(),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=1,this.scissor=new Ln(0,0,e,n),this.scissorTest=!1,this.viewport=new Ln(0,0,e,n);const i={width:e,height:n,depth:1};r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Cr,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},r);const s=new dr(i,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.colorSpace);s.flipY=!1,s.generateMipmaps=r.generateMipmaps,s.internalFormat=r.internalFormat,this.textures=[];const o=r.count;for(let a=0;a<o;a++)this.textures[a]=s.clone(),this.textures[a].isRenderTargetTexture=!0;this.depthBuffer=r.depthBuffer,this.stencilBuffer=r.stencilBuffer,this.resolveDepthBuffer=r.resolveDepthBuffer,this.resolveStencilBuffer=r.resolveStencilBuffer,this.depthTexture=r.depthTexture,this.samples=r.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,n,r=1){if(this.width!==e||this.height!==n||this.depth!==r){this.width=e,this.height=n,this.depth=r;for(let i=0,s=this.textures.length;i<s;i++)this.textures[i].image.width=e,this.textures[i].image.height=n,this.textures[i].image.depth=r;this.dispose()}this.viewport.set(0,0,e,n),this.scissor.set(0,0,e,n)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let r=0,i=e.textures.length;r<i;r++)this.textures[r]=e.textures[r].clone(),this.textures[r].isRenderTargetTexture=!0;const n=Object.assign({},e.texture.image);return this.texture.source=new ah(n),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Va extends s6{constructor(e=1,n=1,r={}){super(e,n,r),this.isWebGLRenderTarget=!0}}class YS extends dr{constructor(e=null,n=1,r=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:n,height:r,depth:i},this.magFilter=ri,this.minFilter=ri,this.wrapR=_o,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Whe extends Va{constructor(e=1,n=1,r=1,i={}){super(e,n,i),this.isWebGLArrayRenderTarget=!0,this.depth=r,this.texture=new YS(null,e,n,r),this.texture.isRenderTargetTexture=!0}}class w2 extends dr{constructor(e=null,n=1,r=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:n,height:r,depth:i},this.magFilter=ri,this.minFilter=ri,this.wrapR=_o,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class $he extends Va{constructor(e=1,n=1,r=1,i={}){super(e,n,i),this.isWebGL3DRenderTarget=!0,this.depth=r,this.texture=new w2(null,e,n,r),this.texture.isRenderTargetTexture=!0}}class qt{constructor(e=0,n=0,r=0,i=1){this.isQuaternion=!0,this._x=e,this._y=n,this._z=r,this._w=i}static slerpFlat(e,n,r,i,s,o,a){let l=r[i+0],c=r[i+1],d=r[i+2],f=r[i+3];const m=s[o+0],y=s[o+1],x=s[o+2],S=s[o+3];if(a===0){e[n+0]=l,e[n+1]=c,e[n+2]=d,e[n+3]=f;return}if(a===1){e[n+0]=m,e[n+1]=y,e[n+2]=x,e[n+3]=S;return}if(f!==S||l!==m||c!==y||d!==x){let _=1-a;const w=l*m+c*y+d*x+f*S,A=w>=0?1:-1,T=1-w*w;if(T>Number.EPSILON){const O=Math.sqrt(T),N=Math.atan2(O,w*A);_=Math.sin(_*N)/O,a=Math.sin(a*N)/O}const C=a*A;if(l=l*_+m*C,c=c*_+y*C,d=d*_+x*C,f=f*_+S*C,_===1-a){const O=1/Math.sqrt(l*l+c*c+d*d+f*f);l*=O,c*=O,d*=O,f*=O}}e[n]=l,e[n+1]=c,e[n+2]=d,e[n+3]=f}static multiplyQuaternionsFlat(e,n,r,i,s,o){const a=r[i],l=r[i+1],c=r[i+2],d=r[i+3],f=s[o],m=s[o+1],y=s[o+2],x=s[o+3];return e[n]=a*x+d*f+l*y-c*m,e[n+1]=l*x+d*m+c*f-a*y,e[n+2]=c*x+d*y+a*m-l*f,e[n+3]=d*x-a*f-l*m-c*y,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,n,r,i){return this._x=e,this._y=n,this._z=r,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,n=!0){const r=e._x,i=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(r/2),d=a(i/2),f=a(s/2),m=l(r/2),y=l(i/2),x=l(s/2);switch(o){case"XYZ":this._x=m*d*f+c*y*x,this._y=c*y*f-m*d*x,this._z=c*d*x+m*y*f,this._w=c*d*f-m*y*x;break;case"YXZ":this._x=m*d*f+c*y*x,this._y=c*y*f-m*d*x,this._z=c*d*x-m*y*f,this._w=c*d*f+m*y*x;break;case"ZXY":this._x=m*d*f-c*y*x,this._y=c*y*f+m*d*x,this._z=c*d*x+m*y*f,this._w=c*d*f-m*y*x;break;case"ZYX":this._x=m*d*f-c*y*x,this._y=c*y*f+m*d*x,this._z=c*d*x-m*y*f,this._w=c*d*f+m*y*x;break;case"YZX":this._x=m*d*f+c*y*x,this._y=c*y*f+m*d*x,this._z=c*d*x-m*y*f,this._w=c*d*f-m*y*x;break;case"XZY":this._x=m*d*f-c*y*x,this._y=c*y*f-m*d*x,this._z=c*d*x+m*y*f,this._w=c*d*f+m*y*x;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return n===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,n){const r=n/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){const n=e.elements,r=n[0],i=n[4],s=n[8],o=n[1],a=n[5],l=n[9],c=n[2],d=n[6],f=n[10],m=r+a+f;if(m>0){const y=.5/Math.sqrt(m+1);this._w=.25/y,this._x=(d-l)*y,this._y=(s-c)*y,this._z=(o-i)*y}else if(r>a&&r>f){const y=2*Math.sqrt(1+r-a-f);this._w=(d-l)/y,this._x=.25*y,this._y=(i+o)/y,this._z=(s+c)/y}else if(a>f){const y=2*Math.sqrt(1+a-r-f);this._w=(s-c)/y,this._x=(i+o)/y,this._y=.25*y,this._z=(l+d)/y}else{const y=2*Math.sqrt(1+f-r-a);this._w=(o-i)/y,this._x=(s+c)/y,this._y=(l+d)/y,this._z=.25*y}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let r=e.dot(n)+1;return r<Number.EPSILON?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*n.z-e.z*n.y,this._y=e.z*n.x-e.x*n.z,this._z=e.x*n.y-e.y*n.x,this._w=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Ar(this.dot(e),-1,1)))}rotateTowards(e,n){const r=this.angleTo(e);if(r===0)return this;const i=Math.min(1,n/r);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,n){const r=e._x,i=e._y,s=e._z,o=e._w,a=n._x,l=n._y,c=n._z,d=n._w;return this._x=r*d+o*a+i*c-s*l,this._y=i*d+o*l+s*a-r*c,this._z=s*d+o*c+r*l-i*a,this._w=o*d-r*a-i*l-s*c,this._onChangeCallback(),this}slerp(e,n){if(n===0)return this;if(n===1)return this.copy(e);const r=this._x,i=this._y,s=this._z,o=this._w;let a=o*e._w+r*e._x+i*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=r,this._y=i,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const y=1-n;return this._w=y*o+n*this._w,this._x=y*r+n*this._x,this._y=y*i+n*this._y,this._z=y*s+n*this._z,this.normalize(),this}const c=Math.sqrt(l),d=Math.atan2(c,a),f=Math.sin((1-n)*d)/c,m=Math.sin(n*d)/c;return this._w=o*f+this._w*m,this._x=r*f+this._x*m,this._y=i*f+this._y*m,this._z=s*f+this._z*m,this._onChangeCallback(),this}slerpQuaternions(e,n,r){return this.copy(e).slerp(n,r)}random(){const e=2*Math.PI*Math.random(),n=2*Math.PI*Math.random(),r=Math.random(),i=Math.sqrt(1-r),s=Math.sqrt(r);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(n),s*Math.cos(n))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,n=0){return this._x=e[n],this._y=e[n+1],this._z=e[n+2],this._w=e[n+3],this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._w,e}fromBufferAttribute(e,n){return this._x=e.getX(n),this._y=e.getY(n),this._z=e.getZ(n),this._w=e.getW(n),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class X{constructor(e=0,n=0,r=0){X.prototype.isVector3=!0,this.x=e,this.y=n,this.z=r}set(e,n,r){return r===void 0&&(r=this.z),this.x=e,this.y=n,this.z=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,n){return this.x=e.x*n.x,this.y=e.y*n.y,this.z=e.z*n.z,this}applyEuler(e){return this.applyQuaternion(V3.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(V3.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*n+s[3]*r+s[6]*i,this.y=s[1]*n+s[4]*r+s[7]*i,this.z=s[2]*n+s[5]*r+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,r=this.y,i=this.z,s=e.elements,o=1/(s[3]*n+s[7]*r+s[11]*i+s[15]);return this.x=(s[0]*n+s[4]*r+s[8]*i+s[12])*o,this.y=(s[1]*n+s[5]*r+s[9]*i+s[13])*o,this.z=(s[2]*n+s[6]*r+s[10]*i+s[14])*o,this}applyQuaternion(e){const n=this.x,r=this.y,i=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*i-a*r),d=2*(a*n-s*i),f=2*(s*r-o*n);return this.x=n+l*c+o*f-a*d,this.y=r+l*d+a*c-s*f,this.z=i+l*f+s*d-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const n=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*n+s[4]*r+s[8]*i,this.y=s[1]*n+s[5]*r+s[9]*i,this.z=s[2]*n+s[6]*r+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(n,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this.z=e.z+(n.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,n){const r=e.x,i=e.y,s=e.z,o=n.x,a=n.y,l=n.z;return this.x=i*l-s*a,this.y=s*o-r*l,this.z=r*a-i*o,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const r=e.dot(this)/n;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return KE.copy(this).projectOnVector(e),this.sub(KE)}reflect(e){return this.sub(KE.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const r=this.dot(e)/n;return Math.acos(Ar(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return n*n+r*r+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,n,r){const i=Math.sin(n)*e;return this.x=i*Math.sin(r),this.y=Math.cos(n)*e,this.z=i*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,n,r){return this.x=e*Math.sin(n),this.y=r,this.z=e*Math.cos(n),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this}setFromMatrixScale(e){const n=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=n,this.y=r,this.z=i,this}setFromMatrixColumn(e,n){return this.fromArray(e.elements,n*4)}setFromMatrix3Column(e,n){return this.fromArray(e.elements,n*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,n=Math.random()*2-1,r=Math.sqrt(1-n*n);return this.x=r*Math.cos(e),this.y=n,this.z=r*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const KE=new X,V3=new qt;class os{constructor(e=new X(1/0,1/0,1/0),n=new X(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=n}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromArray(e){this.makeEmpty();for(let n=0,r=e.length;n<r;n+=3)this.expandByPoint(Pa.fromArray(e,n));return this}setFromBufferAttribute(e){this.makeEmpty();for(let n=0,r=e.count;n<r;n++)this.expandByPoint(Pa.fromBufferAttribute(e,n));return this}setFromPoints(e){this.makeEmpty();for(let n=0,r=e.length;n<r;n++)this.expandByPoint(e[n]);return this}setFromCenterAndSize(e,n){const r=Pa.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}setFromObject(e,n=!1){return this.makeEmpty(),this.expandByObject(e,n)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,n=!1){e.updateWorldMatrix(!1,!1);const r=e.geometry;if(r!==void 0){const s=r.getAttribute("position");if(n===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=s.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,Pa):Pa.fromBufferAttribute(s,o),Pa.applyMatrix4(e.matrixWorld),this.expandByPoint(Pa);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Ub.copy(e.boundingBox)):(r.boundingBox===null&&r.computeBoundingBox(),Ub.copy(r.boundingBox)),Ub.applyMatrix4(e.matrixWorld),this.union(Ub)}const i=e.children;for(let s=0,o=i.length;s<o;s++)this.expandByObject(i[s],n);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,n){return n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Pa),Pa.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let n,r;return e.normal.x>0?(n=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(n=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(n+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(n+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(n+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(n+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),n<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(p0),jb.subVectors(this.max,p0),pm.subVectors(e.a,p0),mm.subVectors(e.b,p0),gm.subVectors(e.c,p0),Xu.subVectors(mm,pm),qu.subVectors(gm,mm),Tf.subVectors(pm,gm);let n=[0,-Xu.z,Xu.y,0,-qu.z,qu.y,0,-Tf.z,Tf.y,Xu.z,0,-Xu.x,qu.z,0,-qu.x,Tf.z,0,-Tf.x,-Xu.y,Xu.x,0,-qu.y,qu.x,0,-Tf.y,Tf.x,0];return!YE(n,pm,mm,gm,jb)||(n=[1,0,0,0,1,0,0,0,1],!YE(n,pm,mm,gm,jb))?!1:(Fb.crossVectors(Xu,qu),n=[Fb.x,Fb.y,Fb.z],YE(n,pm,mm,gm,jb))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Pa).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Pa).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(wc[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),wc[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),wc[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),wc[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),wc[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),wc[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),wc[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),wc[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(wc),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const wc=[new X,new X,new X,new X,new X,new X,new X,new X],Pa=new X,Ub=new os,pm=new X,mm=new X,gm=new X,Xu=new X,qu=new X,Tf=new X,p0=new X,jb=new X,Fb=new X,Cf=new X;function YE(t,e,n,r,i){for(let s=0,o=t.length-3;s<=o;s+=3){Cf.fromArray(t,s);const a=i.x*Math.abs(Cf.x)+i.y*Math.abs(Cf.y)+i.z*Math.abs(Cf.z),l=e.dot(Cf),c=n.dot(Cf),d=r.dot(Cf);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>a)return!1}return!0}const Xhe=new os,m0=new X,ZE=new X;class Bi{constructor(e=new X,n=-1){this.isSphere=!0,this.center=e,this.radius=n}set(e,n){return this.center.copy(e),this.radius=n,this}setFromPoints(e,n){const r=this.center;n!==void 0?r.copy(n):Xhe.setFromPoints(e).getCenter(r);let i=0;for(let s=0,o=e.length;s<o;s++)i=Math.max(i,r.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const n=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=n*n}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,n){const r=this.center.distanceToSquared(e);return n.copy(e),r>this.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;m0.subVectors(e,this.center);const n=m0.lengthSq();if(n>this.radius*this.radius){const r=Math.sqrt(n),i=(r-this.radius)*.5;this.center.addScaledVector(m0,i/r),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(ZE.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(m0.copy(e.center).add(ZE)),this.expandByPoint(m0.copy(e.center).sub(ZE))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Sc=new X,QE=new X,zb=new X,Ku=new X,JE=new X,Bb=new X,eA=new X;class Jh{constructor(e=new X,n=new X(0,0,-1)){this.origin=e,this.direction=n}set(e,n){return this.origin.copy(e),this.direction.copy(n),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,n){return n.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Sc)),this}closestPointToPoint(e,n){n.subVectors(e,this.origin);const r=n.dot(this.direction);return r<0?n.copy(this.origin):n.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const n=Sc.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(Sc.copy(this.origin).addScaledVector(this.direction,n),Sc.distanceToSquared(e))}distanceSqToSegment(e,n,r,i){QE.copy(e).add(n).multiplyScalar(.5),zb.copy(n).sub(e).normalize(),Ku.copy(this.origin).sub(QE);const s=e.distanceTo(n)*.5,o=-this.direction.dot(zb),a=Ku.dot(this.direction),l=-Ku.dot(zb),c=Ku.lengthSq(),d=Math.abs(1-o*o);let f,m,y,x;if(d>0)if(f=o*l-a,m=o*a-l,x=s*d,f>=0)if(m>=-x)if(m<=x){const S=1/d;f*=S,m*=S,y=f*(f+o*m+2*a)+m*(o*f+m+2*l)+c}else m=s,f=Math.max(0,-(o*m+a)),y=-f*f+m*(m+2*l)+c;else m=-s,f=Math.max(0,-(o*m+a)),y=-f*f+m*(m+2*l)+c;else m<=-x?(f=Math.max(0,-(-o*s+a)),m=f>0?-s:Math.min(Math.max(-s,-l),s),y=-f*f+m*(m+2*l)+c):m<=x?(f=0,m=Math.min(Math.max(-s,-l),s),y=m*(m+2*l)+c):(f=Math.max(0,-(o*s+a)),m=f>0?s:Math.min(Math.max(-s,-l),s),y=-f*f+m*(m+2*l)+c);else m=o>0?-s:s,f=Math.max(0,-(o*m+a)),y=-f*f+m*(m+2*l)+c;return r&&r.copy(this.origin).addScaledVector(this.direction,f),i&&i.copy(QE).addScaledVector(zb,m),y}intersectSphere(e,n){Sc.subVectors(e.center,this.origin);const r=Sc.dot(this.direction),i=Sc.dot(Sc)-r*r,s=e.radius*e.radius;if(i>s)return null;const o=Math.sqrt(s-i),a=r-o,l=r+o;return l<0?null:a<0?this.at(l,n):this.at(a,n)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const n=e.normal.dot(this.direction);if(n===0)return e.distanceToPoint(this.origin)===0?0:null;const r=-(this.origin.dot(e.normal)+e.constant)/n;return r>=0?r:null}intersectPlane(e,n){const r=this.distanceToPlane(e);return r===null?null:this.at(r,n)}intersectsPlane(e){const n=e.distanceToPoint(this.origin);return n===0||e.normal.dot(this.direction)*n<0}intersectBox(e,n){let r,i,s,o,a,l;const c=1/this.direction.x,d=1/this.direction.y,f=1/this.direction.z,m=this.origin;return c>=0?(r=(e.min.x-m.x)*c,i=(e.max.x-m.x)*c):(r=(e.max.x-m.x)*c,i=(e.min.x-m.x)*c),d>=0?(s=(e.min.y-m.y)*d,o=(e.max.y-m.y)*d):(s=(e.max.y-m.y)*d,o=(e.min.y-m.y)*d),r>o||s>i||((s>r||isNaN(r))&&(r=s),(o<i||isNaN(i))&&(i=o),f>=0?(a=(e.min.z-m.z)*f,l=(e.max.z-m.z)*f):(a=(e.max.z-m.z)*f,l=(e.min.z-m.z)*f),r>l||a>i)||((a>r||r!==r)&&(r=a),(l<i||i!==i)&&(i=l),i<0)?null:this.at(r>=0?r:i,n)}intersectsBox(e){return this.intersectBox(e,Sc)!==null}intersectTriangle(e,n,r,i,s){JE.subVectors(n,e),Bb.subVectors(r,e),eA.crossVectors(JE,Bb);let o=this.direction.dot(eA),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Ku.subVectors(this.origin,e);const l=a*this.direction.dot(Bb.crossVectors(Ku,Bb));if(l<0)return null;const c=a*this.direction.dot(JE.cross(Ku));if(c<0||l+c>o)return null;const d=-a*Ku.dot(eA);return d<0?null:this.at(d/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Ct{constructor(e,n,r,i,s,o,a,l,c,d,f,m,y,x,S,_){Ct.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,n,r,i,s,o,a,l,c,d,f,m,y,x,S,_)}set(e,n,r,i,s,o,a,l,c,d,f,m,y,x,S,_){const w=this.elements;return w[0]=e,w[4]=n,w[8]=r,w[12]=i,w[1]=s,w[5]=o,w[9]=a,w[13]=l,w[2]=c,w[6]=d,w[10]=f,w[14]=m,w[3]=y,w[7]=x,w[11]=S,w[15]=_,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Ct().fromArray(this.elements)}copy(e){const n=this.elements,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],n[9]=r[9],n[10]=r[10],n[11]=r[11],n[12]=r[12],n[13]=r[13],n[14]=r[14],n[15]=r[15],this}copyPosition(e){const n=this.elements,r=e.elements;return n[12]=r[12],n[13]=r[13],n[14]=r[14],this}setFromMatrix3(e){const n=e.elements;return this.set(n[0],n[3],n[6],0,n[1],n[4],n[7],0,n[2],n[5],n[8],0,0,0,0,1),this}extractBasis(e,n,r){return e.setFromMatrixColumn(this,0),n.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this}makeBasis(e,n,r){return this.set(e.x,n.x,r.x,0,e.y,n.y,r.y,0,e.z,n.z,r.z,0,0,0,0,1),this}extractRotation(e){const n=this.elements,r=e.elements,i=1/vm.setFromMatrixColumn(e,0).length(),s=1/vm.setFromMatrixColumn(e,1).length(),o=1/vm.setFromMatrixColumn(e,2).length();return n[0]=r[0]*i,n[1]=r[1]*i,n[2]=r[2]*i,n[3]=0,n[4]=r[4]*s,n[5]=r[5]*s,n[6]=r[6]*s,n[7]=0,n[8]=r[8]*o,n[9]=r[9]*o,n[10]=r[10]*o,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(e){const n=this.elements,r=e.x,i=e.y,s=e.z,o=Math.cos(r),a=Math.sin(r),l=Math.cos(i),c=Math.sin(i),d=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const m=o*d,y=o*f,x=a*d,S=a*f;n[0]=l*d,n[4]=-l*f,n[8]=c,n[1]=y+x*c,n[5]=m-S*c,n[9]=-a*l,n[2]=S-m*c,n[6]=x+y*c,n[10]=o*l}else if(e.order==="YXZ"){const m=l*d,y=l*f,x=c*d,S=c*f;n[0]=m+S*a,n[4]=x*a-y,n[8]=o*c,n[1]=o*f,n[5]=o*d,n[9]=-a,n[2]=y*a-x,n[6]=S+m*a,n[10]=o*l}else if(e.order==="ZXY"){const m=l*d,y=l*f,x=c*d,S=c*f;n[0]=m-S*a,n[4]=-o*f,n[8]=x+y*a,n[1]=y+x*a,n[5]=o*d,n[9]=S-m*a,n[2]=-o*c,n[6]=a,n[10]=o*l}else if(e.order==="ZYX"){const m=o*d,y=o*f,x=a*d,S=a*f;n[0]=l*d,n[4]=x*c-y,n[8]=m*c+S,n[1]=l*f,n[5]=S*c+m,n[9]=y*c-x,n[2]=-c,n[6]=a*l,n[10]=o*l}else if(e.order==="YZX"){const m=o*l,y=o*c,x=a*l,S=a*c;n[0]=l*d,n[4]=S-m*f,n[8]=x*f+y,n[1]=f,n[5]=o*d,n[9]=-a*d,n[2]=-c*d,n[6]=y*f+x,n[10]=m-S*f}else if(e.order==="XZY"){const m=o*l,y=o*c,x=a*l,S=a*c;n[0]=l*d,n[4]=-f,n[8]=c*d,n[1]=m*f+S,n[5]=o*d,n[9]=y*f-x,n[2]=x*f-y,n[6]=a*d,n[10]=S*f+m}return n[3]=0,n[7]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromQuaternion(e){return this.compose(qhe,e,Khe)}lookAt(e,n,r){const i=this.elements;return ho.subVectors(e,n),ho.lengthSq()===0&&(ho.z=1),ho.normalize(),Yu.crossVectors(r,ho),Yu.lengthSq()===0&&(Math.abs(r.z)===1?ho.x+=1e-4:ho.z+=1e-4,ho.normalize(),Yu.crossVectors(r,ho)),Yu.normalize(),Hb.crossVectors(ho,Yu),i[0]=Yu.x,i[4]=Hb.x,i[8]=ho.x,i[1]=Yu.y,i[5]=Hb.y,i[9]=ho.y,i[2]=Yu.z,i[6]=Hb.z,i[10]=ho.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const r=e.elements,i=n.elements,s=this.elements,o=r[0],a=r[4],l=r[8],c=r[12],d=r[1],f=r[5],m=r[9],y=r[13],x=r[2],S=r[6],_=r[10],w=r[14],A=r[3],T=r[7],C=r[11],O=r[15],N=i[0],D=i[4],F=i[8],V=i[12],k=i[1],j=i[5],H=i[9],ne=i[13],te=i[2],pe=i[6],oe=i[10],ce=i[14],B=i[3],K=i[7],q=i[11],$=i[15];return s[0]=o*N+a*k+l*te+c*B,s[4]=o*D+a*j+l*pe+c*K,s[8]=o*F+a*H+l*oe+c*q,s[12]=o*V+a*ne+l*ce+c*$,s[1]=d*N+f*k+m*te+y*B,s[5]=d*D+f*j+m*pe+y*K,s[9]=d*F+f*H+m*oe+y*q,s[13]=d*V+f*ne+m*ce+y*$,s[2]=x*N+S*k+_*te+w*B,s[6]=x*D+S*j+_*pe+w*K,s[10]=x*F+S*H+_*oe+w*q,s[14]=x*V+S*ne+_*ce+w*$,s[3]=A*N+T*k+C*te+O*B,s[7]=A*D+T*j+C*pe+O*K,s[11]=A*F+T*H+C*oe+O*q,s[15]=A*V+T*ne+C*ce+O*$,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[4]*=e,n[8]*=e,n[12]*=e,n[1]*=e,n[5]*=e,n[9]*=e,n[13]*=e,n[2]*=e,n[6]*=e,n[10]*=e,n[14]*=e,n[3]*=e,n[7]*=e,n[11]*=e,n[15]*=e,this}determinant(){const e=this.elements,n=e[0],r=e[4],i=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],d=e[2],f=e[6],m=e[10],y=e[14],x=e[3],S=e[7],_=e[11],w=e[15];return x*(+s*l*f-i*c*f-s*a*m+r*c*m+i*a*y-r*l*y)+S*(+n*l*y-n*c*m+s*o*m-i*o*y+i*c*d-s*l*d)+_*(+n*c*f-n*a*y-s*o*f+r*o*y+s*a*d-r*c*d)+w*(-i*a*d-n*l*f+n*a*m+i*o*f-r*o*m+r*l*d)}transpose(){const e=this.elements;let n;return n=e[1],e[1]=e[4],e[4]=n,n=e[2],e[2]=e[8],e[8]=n,n=e[6],e[6]=e[9],e[9]=n,n=e[3],e[3]=e[12],e[12]=n,n=e[7],e[7]=e[13],e[13]=n,n=e[11],e[11]=e[14],e[14]=n,this}setPosition(e,n,r){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=n,i[14]=r),this}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],d=e[8],f=e[9],m=e[10],y=e[11],x=e[12],S=e[13],_=e[14],w=e[15],A=f*_*c-S*m*c+S*l*y-a*_*y-f*l*w+a*m*w,T=x*m*c-d*_*c-x*l*y+o*_*y+d*l*w-o*m*w,C=d*S*c-x*f*c+x*a*y-o*S*y-d*a*w+o*f*w,O=x*f*l-d*S*l-x*a*m+o*S*m+d*a*_-o*f*_,N=n*A+r*T+i*C+s*O;if(N===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const D=1/N;return e[0]=A*D,e[1]=(S*m*s-f*_*s-S*i*y+r*_*y+f*i*w-r*m*w)*D,e[2]=(a*_*s-S*l*s+S*i*c-r*_*c-a*i*w+r*l*w)*D,e[3]=(f*l*s-a*m*s-f*i*c+r*m*c+a*i*y-r*l*y)*D,e[4]=T*D,e[5]=(d*_*s-x*m*s+x*i*y-n*_*y-d*i*w+n*m*w)*D,e[6]=(x*l*s-o*_*s-x*i*c+n*_*c+o*i*w-n*l*w)*D,e[7]=(o*m*s-d*l*s+d*i*c-n*m*c-o*i*y+n*l*y)*D,e[8]=C*D,e[9]=(x*f*s-d*S*s-x*r*y+n*S*y+d*r*w-n*f*w)*D,e[10]=(o*S*s-x*a*s+x*r*c-n*S*c-o*r*w+n*a*w)*D,e[11]=(d*a*s-o*f*s-d*r*c+n*f*c+o*r*y-n*a*y)*D,e[12]=O*D,e[13]=(d*S*i-x*f*i+x*r*m-n*S*m-d*r*_+n*f*_)*D,e[14]=(x*a*i-o*S*i-x*r*l+n*S*l+o*r*_-n*a*_)*D,e[15]=(o*f*i-d*a*i+d*r*l-n*f*l-o*r*m+n*a*m)*D,this}scale(e){const n=this.elements,r=e.x,i=e.y,s=e.z;return n[0]*=r,n[4]*=i,n[8]*=s,n[1]*=r,n[5]*=i,n[9]*=s,n[2]*=r,n[6]*=i,n[10]*=s,n[3]*=r,n[7]*=i,n[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,n=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(n,r,i))}makeTranslation(e,n,r){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,n,0,0,1,r,0,0,0,1),this}makeRotationX(e){const n=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,n,-r,0,0,r,n,0,0,0,0,1),this}makeRotationY(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,0,r,0,0,1,0,0,-r,0,n,0,0,0,0,1),this}makeRotationZ(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,-r,0,0,r,n,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,n){const r=Math.cos(n),i=Math.sin(n),s=1-r,o=e.x,a=e.y,l=e.z,c=s*o,d=s*a;return this.set(c*o+r,c*a-i*l,c*l+i*a,0,c*a+i*l,d*a+r,d*l-i*o,0,c*l-i*a,d*l+i*o,s*l*l+r,0,0,0,0,1),this}makeScale(e,n,r){return this.set(e,0,0,0,0,n,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,n,r,i,s,o){return this.set(1,r,s,0,e,1,o,0,n,i,1,0,0,0,0,1),this}compose(e,n,r){const i=this.elements,s=n._x,o=n._y,a=n._z,l=n._w,c=s+s,d=o+o,f=a+a,m=s*c,y=s*d,x=s*f,S=o*d,_=o*f,w=a*f,A=l*c,T=l*d,C=l*f,O=r.x,N=r.y,D=r.z;return i[0]=(1-(S+w))*O,i[1]=(y+C)*O,i[2]=(x-T)*O,i[3]=0,i[4]=(y-C)*N,i[5]=(1-(m+w))*N,i[6]=(_+A)*N,i[7]=0,i[8]=(x+T)*D,i[9]=(_-A)*D,i[10]=(1-(m+S))*D,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,n,r){const i=this.elements;let s=vm.set(i[0],i[1],i[2]).length();const o=vm.set(i[4],i[5],i[6]).length(),a=vm.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],Ra.copy(this);const c=1/s,d=1/o,f=1/a;return Ra.elements[0]*=c,Ra.elements[1]*=c,Ra.elements[2]*=c,Ra.elements[4]*=d,Ra.elements[5]*=d,Ra.elements[6]*=d,Ra.elements[8]*=f,Ra.elements[9]*=f,Ra.elements[10]*=f,n.setFromRotationMatrix(Ra),r.x=s,r.y=o,r.z=a,this}makePerspective(e,n,r,i,s,o,a=Ml){const l=this.elements,c=2*s/(n-e),d=2*s/(r-i),f=(n+e)/(n-e),m=(r+i)/(r-i);let y,x;if(a===Ml)y=-(o+s)/(o-s),x=-2*o*s/(o-s);else if(a===Ny)y=-o/(o-s),x=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=f,l[12]=0,l[1]=0,l[5]=d,l[9]=m,l[13]=0,l[2]=0,l[6]=0,l[10]=y,l[14]=x,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,n,r,i,s,o,a=Ml){const l=this.elements,c=1/(n-e),d=1/(r-i),f=1/(o-s),m=(n+e)*c,y=(r+i)*d;let x,S;if(a===Ml)x=(o+s)*f,S=-2*f;else if(a===Ny)x=s*f,S=-1*f;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-m,l[1]=0,l[5]=2*d,l[9]=0,l[13]=-y,l[2]=0,l[6]=0,l[10]=S,l[14]=-x,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const n=this.elements,r=e.elements;for(let i=0;i<16;i++)if(n[i]!==r[i])return!1;return!0}fromArray(e,n=0){for(let r=0;r<16;r++)this.elements[r]=e[r+n];return this}toArray(e=[],n=0){const r=this.elements;return e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2],e[n+3]=r[3],e[n+4]=r[4],e[n+5]=r[5],e[n+6]=r[6],e[n+7]=r[7],e[n+8]=r[8],e[n+9]=r[9],e[n+10]=r[10],e[n+11]=r[11],e[n+12]=r[12],e[n+13]=r[13],e[n+14]=r[14],e[n+15]=r[15],e}}const vm=new X,Ra=new Ct,qhe=new X(0,0,0),Khe=new X(1,1,1),Yu=new X,Hb=new X,ho=new X,G3=new Ct,W3=new qt;class as{constructor(e=0,n=0,r=0,i=as.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=n,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,n,r,i=this._order){return this._x=e,this._y=n,this._z=r,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,n=this._order,r=!0){const i=e.elements,s=i[0],o=i[4],a=i[8],l=i[1],c=i[5],d=i[9],f=i[2],m=i[6],y=i[10];switch(n){case"XYZ":this._y=Math.asin(Ar(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-d,y),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(m,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Ar(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(a,y),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(Ar(m,-1,1)),Math.abs(m)<.9999999?(this._y=Math.atan2(-f,y),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Ar(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(m,y),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(Ar(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(a,y));break;case"XZY":this._z=Math.asin(-Ar(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(m,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-d,y),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,r){return G3.makeRotationFromQuaternion(e),this.setFromRotationMatrix(G3,n,r)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return W3.setFromEuler(this),this.setFromQuaternion(W3,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}as.DEFAULT_ORDER="XYZ";class Ah{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let Yhe=0;const $3=new X,ym=new qt,Mc=new Ct,Vb=new X,g0=new X,Zhe=new X,Qhe=new qt,X3=new X(1,0,0),q3=new X(0,1,0),K3=new X(0,0,1),Y3={type:"added"},Jhe={type:"removed"},xm={type:"childadded",child:null},tA={type:"childremoved",child:null};class mn extends Bl{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Yhe++}),this.uuid=So(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=mn.DEFAULT_UP.clone();const e=new X,n=new as,r=new qt,i=new X(1,1,1);function s(){r.setFromEuler(n,!1)}function o(){n.setFromQuaternion(r,void 0,!1)}n._onChange(s),r._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Ct},normalMatrix:{value:new Xt}}),this.matrix=new Ct,this.matrixWorld=new Ct,this.matrixAutoUpdate=mn.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=mn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Ah,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,n){this.quaternion.setFromAxisAngle(e,n)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,n){return ym.setFromAxisAngle(e,n),this.quaternion.multiply(ym),this}rotateOnWorldAxis(e,n){return ym.setFromAxisAngle(e,n),this.quaternion.premultiply(ym),this}rotateX(e){return this.rotateOnAxis(X3,e)}rotateY(e){return this.rotateOnAxis(q3,e)}rotateZ(e){return this.rotateOnAxis(K3,e)}translateOnAxis(e,n){return $3.copy(e).applyQuaternion(this.quaternion),this.position.add($3.multiplyScalar(n)),this}translateX(e){return this.translateOnAxis(X3,e)}translateY(e){return this.translateOnAxis(q3,e)}translateZ(e){return this.translateOnAxis(K3,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Mc.copy(this.matrixWorld).invert())}lookAt(e,n,r){e.isVector3?Vb.copy(e):Vb.set(e,n,r);const i=this.parent;this.updateWorldMatrix(!0,!1),g0.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Mc.lookAt(g0,Vb,this.up):Mc.lookAt(Vb,g0,this.up),this.quaternion.setFromRotationMatrix(Mc),i&&(Mc.extractRotation(i.matrixWorld),ym.setFromRotationMatrix(Mc),this.quaternion.premultiply(ym.invert()))}add(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.add(arguments[n]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Y3),xm.child=e,this.dispatchEvent(xm),xm.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let r=0;r<arguments.length;r++)this.remove(arguments[r]);return this}const n=this.children.indexOf(e);return n!==-1&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(Jhe),tA.child=e,this.dispatchEvent(tA),tA.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Mc.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Mc.multiply(e.parent.matrixWorld)),e.applyMatrix4(Mc),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Y3),xm.child=e,this.dispatchEvent(xm),xm.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,n){if(this[e]===n)return this;for(let r=0,i=this.children.length;r<i;r++){const o=this.children[r].getObjectByProperty(e,n);if(o!==void 0)return o}}getObjectsByProperty(e,n,r=[]){this[e]===n&&r.push(this);const i=this.children;for(let s=0,o=i.length;s<o;s++)i[s].getObjectsByProperty(e,n,r);return r}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(g0,e,Zhe),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(g0,Qhe,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const n=this.matrixWorld.elements;return e.set(n[8],n[9],n[10]).normalize()}raycast(){}traverse(e){e(this);const n=this.children;for(let r=0,i=n.length;r<i;r++)n[r].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const n=this.children;for(let r=0,i=n.length;r<i;r++)n[r].traverseVisible(e)}traverseAncestors(e){const n=this.parent;n!==null&&(e(n),n.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const n=this.children;for(let r=0,i=n.length;r<i;r++)n[r].updateMatrixWorld(e)}updateWorldMatrix(e,n){const r=this.parent;if(e===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),n===!0){const i=this.children;for(let s=0,o=i.length;s<o;s++)i[s].updateWorldMatrix(!1,!0)}}toJSON(e){const n=e===void 0||typeof e=="string",r={};n&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},r.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),this.boundingBox!==null&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()}));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,d=l.length;c<d;c++){const f=l[c];s(e.shapes,f)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(s(e.materials,this.material[l]));i.material=a}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let a=0;a<this.children.length;a++)i.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let a=0;a<this.animations.length;a++){const l=this.animations[a];i.animations.push(s(e.animations,l))}}if(n){const a=o(e.geometries),l=o(e.materials),c=o(e.textures),d=o(e.images),f=o(e.shapes),m=o(e.skeletons),y=o(e.animations),x=o(e.nodes);a.length>0&&(r.geometries=a),l.length>0&&(r.materials=l),c.length>0&&(r.textures=c),d.length>0&&(r.images=d),f.length>0&&(r.shapes=f),m.length>0&&(r.skeletons=m),y.length>0&&(r.animations=y),x.length>0&&(r.nodes=x)}return r.object=i,r;function o(a){const l=[];for(const c in a){const d=a[c];delete d.metadata,l.push(d)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,n=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),n===!0)for(let r=0;r<e.children.length;r++){const i=e.children[r];this.add(i.clone())}return this}}mn.DEFAULT_UP=new X(0,1,0);mn.DEFAULT_MATRIX_AUTO_UPDATE=!0;mn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Na=new X,Ec=new X,nA=new X,Ac=new X,bm=new X,_m=new X,Z3=new X,rA=new X,iA=new X,sA=new X,oA=new Ln,aA=new Ln,lA=new Ln;class qs{constructor(e=new X,n=new X,r=new X){this.a=e,this.b=n,this.c=r}static getNormal(e,n,r,i){i.subVectors(r,n),Na.subVectors(e,n),i.cross(Na);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,n,r,i,s){Na.subVectors(i,n),Ec.subVectors(r,n),nA.subVectors(e,n);const o=Na.dot(Na),a=Na.dot(Ec),l=Na.dot(nA),c=Ec.dot(Ec),d=Ec.dot(nA),f=o*c-a*a;if(f===0)return s.set(0,0,0),null;const m=1/f,y=(c*l-a*d)*m,x=(o*d-a*l)*m;return s.set(1-y-x,x,y)}static containsPoint(e,n,r,i){return this.getBarycoord(e,n,r,i,Ac)===null?!1:Ac.x>=0&&Ac.y>=0&&Ac.x+Ac.y<=1}static getInterpolation(e,n,r,i,s,o,a,l){return this.getBarycoord(e,n,r,i,Ac)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Ac.x),l.addScaledVector(o,Ac.y),l.addScaledVector(a,Ac.z),l)}static getInterpolatedAttribute(e,n,r,i,s,o){return oA.setScalar(0),aA.setScalar(0),lA.setScalar(0),oA.fromBufferAttribute(e,n),aA.fromBufferAttribute(e,r),lA.fromBufferAttribute(e,i),o.setScalar(0),o.addScaledVector(oA,s.x),o.addScaledVector(aA,s.y),o.addScaledVector(lA,s.z),o}static isFrontFacing(e,n,r,i){return Na.subVectors(r,n),Ec.subVectors(e,n),Na.cross(Ec).dot(i)<0}set(e,n,r){return this.a.copy(e),this.b.copy(n),this.c.copy(r),this}setFromPointsAndIndices(e,n,r,i){return this.a.copy(e[n]),this.b.copy(e[r]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,n,r,i){return this.a.fromBufferAttribute(e,n),this.b.fromBufferAttribute(e,r),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Na.subVectors(this.c,this.b),Ec.subVectors(this.a,this.b),Na.cross(Ec).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return qs.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return qs.getBarycoord(e,this.a,this.b,this.c,n)}getInterpolation(e,n,r,i,s){return qs.getInterpolation(e,this.a,this.b,this.c,n,r,i,s)}containsPoint(e){return qs.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return qs.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,n){const r=this.a,i=this.b,s=this.c;let o,a;bm.subVectors(i,r),_m.subVectors(s,r),rA.subVectors(e,r);const l=bm.dot(rA),c=_m.dot(rA);if(l<=0&&c<=0)return n.copy(r);iA.subVectors(e,i);const d=bm.dot(iA),f=_m.dot(iA);if(d>=0&&f<=d)return n.copy(i);const m=l*f-d*c;if(m<=0&&l>=0&&d<=0)return o=l/(l-d),n.copy(r).addScaledVector(bm,o);sA.subVectors(e,s);const y=bm.dot(sA),x=_m.dot(sA);if(x>=0&&y<=x)return n.copy(s);const S=y*c-l*x;if(S<=0&&c>=0&&x<=0)return a=c/(c-x),n.copy(r).addScaledVector(_m,a);const _=d*x-y*f;if(_<=0&&f-d>=0&&y-x>=0)return Z3.subVectors(s,i),a=(f-d)/(f-d+(y-x)),n.copy(i).addScaledVector(Z3,a);const w=1/(_+S+m);return o=S*w,a=m*w,n.copy(r).addScaledVector(bm,o).addScaledVector(_m,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const o6={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Zu={h:0,s:0,l:0},Gb={h:0,s:0,l:0};function cA(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*6*(2/3-n):t}class ot{constructor(e,n,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,r)}set(e,n,r){if(n===void 0&&r===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,n,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=ji){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,In.toWorkingColorSpace(this,n),this}setRGB(e,n,r,i=In.workingColorSpace){return this.r=e,this.g=n,this.b=r,In.toWorkingColorSpace(this,i),this}setHSL(e,n,r,i=In.workingColorSpace){if(e=_2(e,1),n=Ar(n,0,1),r=Ar(r,0,1),n===0)this.r=this.g=this.b=r;else{const s=r<=.5?r*(1+n):r+n-r*n,o=2*r-s;this.r=cA(o,s,e+1/3),this.g=cA(o,s,e),this.b=cA(o,s,e-1/3)}return In.toWorkingColorSpace(this,i),this}setStyle(e,n=ji){function r(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=i[1],a=i[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,n);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,n);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,n);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,n);if(o===6)return this.setHex(parseInt(s,16),n);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=ji){const r=o6[e.toLowerCase()];return r!==void 0?this.setHex(r,n):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=ng(e.r),this.g=ng(e.g),this.b=ng(e.b),this}copyLinearToSRGB(e){return this.r=XE(e.r),this.g=XE(e.g),this.b=XE(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=ji){return In.fromWorkingColorSpace(Ji.copy(this),e),Math.round(Ar(Ji.r*255,0,255))*65536+Math.round(Ar(Ji.g*255,0,255))*256+Math.round(Ar(Ji.b*255,0,255))}getHexString(e=ji){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=In.workingColorSpace){In.fromWorkingColorSpace(Ji.copy(this),n);const r=Ji.r,i=Ji.g,s=Ji.b,o=Math.max(r,i,s),a=Math.min(r,i,s);let l,c;const d=(a+o)/2;if(a===o)l=0,c=0;else{const f=o-a;switch(c=d<=.5?f/(o+a):f/(2-o-a),o){case r:l=(i-s)/f+(i<s?6:0);break;case i:l=(s-r)/f+2;break;case s:l=(r-i)/f+4;break}l/=6}return e.h=l,e.s=c,e.l=d,e}getRGB(e,n=In.workingColorSpace){return In.fromWorkingColorSpace(Ji.copy(this),n),e.r=Ji.r,e.g=Ji.g,e.b=Ji.b,e}getStyle(e=ji){In.fromWorkingColorSpace(Ji.copy(this),e);const n=Ji.r,r=Ji.g,i=Ji.b;return e!==ji?`color(${e} ${n.toFixed(3)} ${r.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(n*255)},${Math.round(r*255)},${Math.round(i*255)})`}offsetHSL(e,n,r){return this.getHSL(Zu),this.setHSL(Zu.h+e,Zu.s+n,Zu.l+r)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,n){return this.r=e.r+n.r,this.g=e.g+n.g,this.b=e.b+n.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,n){return this.r+=(e.r-this.r)*n,this.g+=(e.g-this.g)*n,this.b+=(e.b-this.b)*n,this}lerpColors(e,n,r){return this.r=e.r+(n.r-e.r)*r,this.g=e.g+(n.g-e.g)*r,this.b=e.b+(n.b-e.b)*r,this}lerpHSL(e,n){this.getHSL(Zu),e.getHSL(Gb);const r=Z0(Zu.h,Gb.h,n),i=Z0(Zu.s,Gb.s,n),s=Z0(Zu.l,Gb.l,n);return this.setHSL(r,i,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const n=this.r,r=this.g,i=this.b,s=e.elements;return this.r=s[0]*n+s[3]*r+s[6]*i,this.g=s[1]*n+s[4]*r+s[7]*i,this.b=s[2]*n+s[5]*r+s[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,n=0){return this.r=e[n],this.g=e[n+1],this.b=e[n+2],this}toArray(e=[],n=0){return e[n]=this.r,e[n+1]=this.g,e[n+2]=this.b,e}fromBufferAttribute(e,n){return this.r=e.getX(n),this.g=e.getY(n),this.b=e.getZ(n),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Ji=new ot;ot.NAMES=o6;let epe=0;class Gr extends Bl{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:epe++}),this.uuid=So(),this.name="",this.type="Material",this.blending=Sh,this.side=Dl,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Yw,this.blendDst=Zw,this.blendEquation=ud,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new ot(0,0,0),this.blendAlpha=0,this.depthFunc=Uh,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=VC,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Kf,this.stencilZFail=Kf,this.stencilZPass=Kf,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const n in e){const r=e[n];if(r===void 0){console.warn(`THREE.Material: parameter '${n}' has value of undefined.`);continue}const i=this[n];if(i===void 0){console.warn(`THREE.Material: '${n}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(r):i&&i.isVector3&&r&&r.isVector3?i.copy(r):this[n]=r}}toJSON(e){const n=e===void 0||typeof e=="string";n&&(e={textures:{},images:{}});const r={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),this.roughness!==void 0&&(r.roughness=this.roughness),this.metalness!==void 0&&(r.metalness=this.metalness),this.sheen!==void 0&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(r.shininess=this.shininess),this.clearcoat!==void 0&&(r.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(r.dispersion=this.dispersion),this.iridescence!==void 0&&(r.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(r.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(r.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(r.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(r.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapRotation!==void 0&&(r.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(r.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(r.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(r.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(r.size=this.size),this.shadowSide!==null&&(r.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==Sh&&(r.blending=this.blending),this.side!==Dl&&(r.side=this.side),this.vertexColors===!0&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=!0),this.blendSrc!==Yw&&(r.blendSrc=this.blendSrc),this.blendDst!==Zw&&(r.blendDst=this.blendDst),this.blendEquation!==ud&&(r.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(r.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(r.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(r.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(r.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(r.blendAlpha=this.blendAlpha),this.depthFunc!==Uh&&(r.depthFunc=this.depthFunc),this.depthTest===!1&&(r.depthTest=this.depthTest),this.depthWrite===!1&&(r.depthWrite=this.depthWrite),this.colorWrite===!1&&(r.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(r.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==VC&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Kf&&(r.stencilFail=this.stencilFail),this.stencilZFail!==Kf&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==Kf&&(r.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(r.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaHash===!0&&(r.alphaHash=!0),this.alphaToCoverage===!0&&(r.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=!0),this.forceSinglePass===!0&&(r.forceSinglePass=!0),this.wireframe===!0&&(r.wireframe=!0),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=!0),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),this.fog===!1&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData);function i(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(n){const s=i(e.textures),o=i(e.images);s.length>0&&(r.textures=s),o.length>0&&(r.images=o)}return r}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const n=e.clippingPlanes;let r=null;if(n!==null){const i=n.length;r=new Array(i);for(let s=0;s!==i;++s)r[s]=n[s].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class As extends Gr{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ot(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new as,this.combine=ox,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Dc=tpe();function tpe(){const t=new ArrayBuffer(4),e=new Float32Array(t),n=new Uint32Array(t),r=new Uint32Array(512),i=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(r[l]=0,r[l|256]=32768,i[l]=24,i[l|256]=24):c<-14?(r[l]=1024>>-c-14,r[l|256]=1024>>-c-14|32768,i[l]=-c-1,i[l|256]=-c-1):c<=15?(r[l]=c+15<<10,r[l|256]=c+15<<10|32768,i[l]=13,i[l|256]=13):c<128?(r[l]=31744,r[l|256]=64512,i[l]=24,i[l|256]=24):(r[l]=31744,r[l|256]=64512,i[l]=13,i[l|256]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,d=0;for(;(c&8388608)===0;)c<<=1,d-=8388608;c&=-8388609,d+=947912704,s[l]=c|d}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:n,baseTable:r,shiftTable:i,mantissaTable:s,exponentTable:o,offsetTable:a}}function Ws(t){Math.abs(t)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),t=Ar(t,-65504,65504),Dc.floatView[0]=t;const e=Dc.uint32View[0],n=e>>23&511;return Dc.baseTable[n]+((e&8388607)>>Dc.shiftTable[n])}function j0(t){const e=t>>10;return Dc.uint32View[0]=Dc.mantissaTable[Dc.offsetTable[e]+(t&1023)]+Dc.exponentTable[e],Dc.floatView[0]}const npe={toHalfFloat:Ws,fromHalfFloat:j0},Hr=new X,Wb=new Ve;class Qt{constructor(e,n,r=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=r,this.usage=Ry,this.updateRanges=[],this.gpuType=Zs,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,n,r){e*=this.itemSize,r*=n.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[e+i]=n.array[r+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let n=0,r=this.count;n<r;n++)Wb.fromBufferAttribute(this,n),Wb.applyMatrix3(e),this.setXY(n,Wb.x,Wb.y);else if(this.itemSize===3)for(let n=0,r=this.count;n<r;n++)Hr.fromBufferAttribute(this,n),Hr.applyMatrix3(e),this.setXYZ(n,Hr.x,Hr.y,Hr.z);return this}applyMatrix4(e){for(let n=0,r=this.count;n<r;n++)Hr.fromBufferAttribute(this,n),Hr.applyMatrix4(e),this.setXYZ(n,Hr.x,Hr.y,Hr.z);return this}applyNormalMatrix(e){for(let n=0,r=this.count;n<r;n++)Hr.fromBufferAttribute(this,n),Hr.applyNormalMatrix(e),this.setXYZ(n,Hr.x,Hr.y,Hr.z);return this}transformDirection(e){for(let n=0,r=this.count;n<r;n++)Hr.fromBufferAttribute(this,n),Hr.transformDirection(e),this.setXYZ(n,Hr.x,Hr.y,Hr.z);return this}set(e,n=0){return this.array.set(e,n),this}getComponent(e,n){let r=this.array[e*this.itemSize+n];return this.normalized&&(r=Ss(r,this.array)),r}setComponent(e,n,r){return this.normalized&&(r=cn(r,this.array)),this.array[e*this.itemSize+n]=r,this}getX(e){let n=this.array[e*this.itemSize];return this.normalized&&(n=Ss(n,this.array)),n}setX(e,n){return this.normalized&&(n=cn(n,this.array)),this.array[e*this.itemSize]=n,this}getY(e){let n=this.array[e*this.itemSize+1];return this.normalized&&(n=Ss(n,this.array)),n}setY(e,n){return this.normalized&&(n=cn(n,this.array)),this.array[e*this.itemSize+1]=n,this}getZ(e){let n=this.array[e*this.itemSize+2];return this.normalized&&(n=Ss(n,this.array)),n}setZ(e,n){return this.normalized&&(n=cn(n,this.array)),this.array[e*this.itemSize+2]=n,this}getW(e){let n=this.array[e*this.itemSize+3];return this.normalized&&(n=Ss(n,this.array)),n}setW(e,n){return this.normalized&&(n=cn(n,this.array)),this.array[e*this.itemSize+3]=n,this}setXY(e,n,r){return e*=this.itemSize,this.normalized&&(n=cn(n,this.array),r=cn(r,this.array)),this.array[e+0]=n,this.array[e+1]=r,this}setXYZ(e,n,r,i){return e*=this.itemSize,this.normalized&&(n=cn(n,this.array),r=cn(r,this.array),i=cn(i,this.array)),this.array[e+0]=n,this.array[e+1]=r,this.array[e+2]=i,this}setXYZW(e,n,r,i,s){return e*=this.itemSize,this.normalized&&(n=cn(n,this.array),r=cn(r,this.array),i=cn(i,this.array),s=cn(s,this.array)),this.array[e+0]=n,this.array[e+1]=r,this.array[e+2]=i,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Ry&&(e.usage=this.usage),e}}class rpe extends Qt{constructor(e,n,r){super(new Int8Array(e),n,r)}}class ipe extends Qt{constructor(e,n,r){super(new Uint8Array(e),n,r)}}class spe extends Qt{constructor(e,n,r){super(new Uint8ClampedArray(e),n,r)}}class ope extends Qt{constructor(e,n,r){super(new Int16Array(e),n,r)}}class S2 extends Qt{constructor(e,n,r){super(new Uint16Array(e),n,r)}}class ape extends Qt{constructor(e,n,r){super(new Int32Array(e),n,r)}}class M2 extends Qt{constructor(e,n,r){super(new Uint32Array(e),n,r)}}class lpe extends Qt{constructor(e,n,r){super(new Uint16Array(e),n,r),this.isFloat16BufferAttribute=!0}getX(e){let n=j0(this.array[e*this.itemSize]);return this.normalized&&(n=Ss(n,this.array)),n}setX(e,n){return this.normalized&&(n=cn(n,this.array)),this.array[e*this.itemSize]=Ws(n),this}getY(e){let n=j0(this.array[e*this.itemSize+1]);return this.normalized&&(n=Ss(n,this.array)),n}setY(e,n){return this.normalized&&(n=cn(n,this.array)),this.array[e*this.itemSize+1]=Ws(n),this}getZ(e){let n=j0(this.array[e*this.itemSize+2]);return this.normalized&&(n=Ss(n,this.array)),n}setZ(e,n){return this.normalized&&(n=cn(n,this.array)),this.array[e*this.itemSize+2]=Ws(n),this}getW(e){let n=j0(this.array[e*this.itemSize+3]);return this.normalized&&(n=Ss(n,this.array)),n}setW(e,n){return this.normalized&&(n=cn(n,this.array)),this.array[e*this.itemSize+3]=Ws(n),this}setXY(e,n,r){return e*=this.itemSize,this.normalized&&(n=cn(n,this.array),r=cn(r,this.array)),this.array[e+0]=Ws(n),this.array[e+1]=Ws(r),this}setXYZ(e,n,r,i){return e*=this.itemSize,this.normalized&&(n=cn(n,this.array),r=cn(r,this.array),i=cn(i,this.array)),this.array[e+0]=Ws(n),this.array[e+1]=Ws(r),this.array[e+2]=Ws(i),this}setXYZW(e,n,r,i,s){return e*=this.itemSize,this.normalized&&(n=cn(n,this.array),r=cn(r,this.array),i=cn(i,this.array),s=cn(s,this.array)),this.array[e+0]=Ws(n),this.array[e+1]=Ws(r),this.array[e+2]=Ws(i),this.array[e+3]=Ws(s),this}}class kt extends Qt{constructor(e,n,r){super(new Float32Array(e),n,r)}}let cpe=0;const jo=new Ct,uA=new mn,wm=new X,po=new os,v0=new os,mi=new X;class Zt extends Bl{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:cpe++}),this.uuid=So(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(n6(e)?M2:S2)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,n){return this.attributes[e]=n,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,n,r=0){this.groups.push({start:e,count:n,materialIndex:r})}clearGroups(){this.groups=[]}setDrawRange(e,n){this.drawRange.start=e,this.drawRange.count=n}applyMatrix4(e){const n=this.attributes.position;n!==void 0&&(n.applyMatrix4(e),n.needsUpdate=!0);const r=this.attributes.normal;if(r!==void 0){const s=new Xt().getNormalMatrix(e);r.applyNormalMatrix(s),r.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return jo.makeRotationFromQuaternion(e),this.applyMatrix4(jo),this}rotateX(e){return jo.makeRotationX(e),this.applyMatrix4(jo),this}rotateY(e){return jo.makeRotationY(e),this.applyMatrix4(jo),this}rotateZ(e){return jo.makeRotationZ(e),this.applyMatrix4(jo),this}translate(e,n,r){return jo.makeTranslation(e,n,r),this.applyMatrix4(jo),this}scale(e,n,r){return jo.makeScale(e,n,r),this.applyMatrix4(jo),this}lookAt(e){return uA.lookAt(e),uA.updateMatrix(),this.applyMatrix4(uA.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(wm).negate(),this.translate(wm.x,wm.y,wm.z),this}setFromPoints(e){const n=[];for(let r=0,i=e.length;r<i;r++){const s=e[r];n.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new kt(n,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new os);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new X(-1/0,-1/0,-1/0),new X(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),n)for(let r=0,i=n.length;r<i;r++){const s=n[r];po.setFromBufferAttribute(s),this.morphTargetsRelative?(mi.addVectors(this.boundingBox.min,po.min),this.boundingBox.expandByPoint(mi),mi.addVectors(this.boundingBox.max,po.max),this.boundingBox.expandByPoint(mi)):(this.boundingBox.expandByPoint(po.min),this.boundingBox.expandByPoint(po.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Bi);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new X,1/0);return}if(e){const r=this.boundingSphere.center;if(po.setFromBufferAttribute(e),n)for(let s=0,o=n.length;s<o;s++){const a=n[s];v0.setFromBufferAttribute(a),this.morphTargetsRelative?(mi.addVectors(po.min,v0.min),po.expandByPoint(mi),mi.addVectors(po.max,v0.max),po.expandByPoint(mi)):(po.expandByPoint(v0.min),po.expandByPoint(v0.max))}po.getCenter(r);let i=0;for(let s=0,o=e.count;s<o;s++)mi.fromBufferAttribute(e,s),i=Math.max(i,r.distanceToSquared(mi));if(n)for(let s=0,o=n.length;s<o;s++){const a=n[s],l=this.morphTargetsRelative;for(let c=0,d=a.count;c<d;c++)mi.fromBufferAttribute(a,c),l&&(wm.fromBufferAttribute(e,c),mi.add(wm)),i=Math.max(i,r.distanceToSquared(mi))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,n=this.attributes;if(e===null||n.position===void 0||n.normal===void 0||n.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const r=n.position,i=n.normal,s=n.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Qt(new Float32Array(4*r.count),4));const o=this.getAttribute("tangent"),a=[],l=[];for(let F=0;F<r.count;F++)a[F]=new X,l[F]=new X;const c=new X,d=new X,f=new X,m=new Ve,y=new Ve,x=new Ve,S=new X,_=new X;function w(F,V,k){c.fromBufferAttribute(r,F),d.fromBufferAttribute(r,V),f.fromBufferAttribute(r,k),m.fromBufferAttribute(s,F),y.fromBufferAttribute(s,V),x.fromBufferAttribute(s,k),d.sub(c),f.sub(c),y.sub(m),x.sub(m);const j=1/(y.x*x.y-x.x*y.y);isFinite(j)&&(S.copy(d).multiplyScalar(x.y).addScaledVector(f,-y.y).multiplyScalar(j),_.copy(f).multiplyScalar(y.x).addScaledVector(d,-x.x).multiplyScalar(j),a[F].add(S),a[V].add(S),a[k].add(S),l[F].add(_),l[V].add(_),l[k].add(_))}let A=this.groups;A.length===0&&(A=[{start:0,count:e.count}]);for(let F=0,V=A.length;F<V;++F){const k=A[F],j=k.start,H=k.count;for(let ne=j,te=j+H;ne<te;ne+=3)w(e.getX(ne+0),e.getX(ne+1),e.getX(ne+2))}const T=new X,C=new X,O=new X,N=new X;function D(F){O.fromBufferAttribute(i,F),N.copy(O);const V=a[F];T.copy(V),T.sub(O.multiplyScalar(O.dot(V))).normalize(),C.crossVectors(N,V);const j=C.dot(l[F])<0?-1:1;o.setXYZW(F,T.x,T.y,T.z,j)}for(let F=0,V=A.length;F<V;++F){const k=A[F],j=k.start,H=k.count;for(let ne=j,te=j+H;ne<te;ne+=3)D(e.getX(ne+0)),D(e.getX(ne+1)),D(e.getX(ne+2))}}computeVertexNormals(){const e=this.index,n=this.getAttribute("position");if(n!==void 0){let r=this.getAttribute("normal");if(r===void 0)r=new Qt(new Float32Array(n.count*3),3),this.setAttribute("normal",r);else for(let m=0,y=r.count;m<y;m++)r.setXYZ(m,0,0,0);const i=new X,s=new X,o=new X,a=new X,l=new X,c=new X,d=new X,f=new X;if(e)for(let m=0,y=e.count;m<y;m+=3){const x=e.getX(m+0),S=e.getX(m+1),_=e.getX(m+2);i.fromBufferAttribute(n,x),s.fromBufferAttribute(n,S),o.fromBufferAttribute(n,_),d.subVectors(o,s),f.subVectors(i,s),d.cross(f),a.fromBufferAttribute(r,x),l.fromBufferAttribute(r,S),c.fromBufferAttribute(r,_),a.add(d),l.add(d),c.add(d),r.setXYZ(x,a.x,a.y,a.z),r.setXYZ(S,l.x,l.y,l.z),r.setXYZ(_,c.x,c.y,c.z)}else for(let m=0,y=n.count;m<y;m+=3)i.fromBufferAttribute(n,m+0),s.fromBufferAttribute(n,m+1),o.fromBufferAttribute(n,m+2),d.subVectors(o,s),f.subVectors(i,s),d.cross(f),r.setXYZ(m+0,d.x,d.y,d.z),r.setXYZ(m+1,d.x,d.y,d.z),r.setXYZ(m+2,d.x,d.y,d.z);this.normalizeNormals(),r.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let n=0,r=e.count;n<r;n++)mi.fromBufferAttribute(e,n),mi.normalize(),e.setXYZ(n,mi.x,mi.y,mi.z)}toNonIndexed(){function e(a,l){const c=a.array,d=a.itemSize,f=a.normalized,m=new c.constructor(l.length*d);let y=0,x=0;for(let S=0,_=l.length;S<_;S++){a.isInterleavedBufferAttribute?y=l[S]*a.data.stride+a.offset:y=l[S]*d;for(let w=0;w<d;w++)m[x++]=c[y++]}return new Qt(m,d,f)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const n=new Zt,r=this.index.array,i=this.attributes;for(const a in i){const l=i[a],c=e(l,r);n.setAttribute(a,c)}const s=this.morphAttributes;for(const a in s){const l=[],c=s[a];for(let d=0,f=c.length;d<f;d++){const m=c[d],y=e(m,r);l.push(y)}n.morphAttributes[a]=l}n.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,l=o.length;a<l;a++){const c=o[a];n.addGroup(c.start,c.count,c.materialIndex)}return n}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const n=this.index;n!==null&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});const r=this.attributes;for(const l in r){const c=r[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],d=[];for(let f=0,m=c.length;f<m;f++){const y=c[f];d.push(y.toJSON(e.data))}d.length>0&&(i[l]=d,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const n={};this.name=e.name;const r=e.index;r!==null&&this.setIndex(r.clone(n));const i=e.attributes;for(const c in i){const d=i[c];this.setAttribute(c,d.clone(n))}const s=e.morphAttributes;for(const c in s){const d=[],f=s[c];for(let m=0,y=f.length;m<y;m++)d.push(f[m].clone(n));this.morphAttributes[c]=d}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let c=0,d=o.length;c<d;c++){const f=o[c];this.addGroup(f.start,f.count,f.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Q3=new Ct,Pf=new Jh,$b=new Bi,J3=new X,Xb=new X,qb=new X,Kb=new X,dA=new X,Yb=new X,eD=new X,Zb=new X;class yr extends mn{constructor(e=new Zt,n=new As){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=n,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const n=this.geometry.morphAttributes,r=Object.keys(n);if(r.length>0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,n){const r=this.geometry,i=r.attributes.position,s=r.morphAttributes.position,o=r.morphTargetsRelative;n.fromBufferAttribute(i,e);const a=this.morphTargetInfluences;if(s&&a){Yb.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const d=a[l],f=s[l];d!==0&&(dA.fromBufferAttribute(f,e),o?Yb.addScaledVector(dA,d):Yb.addScaledVector(dA.sub(n),d))}n.add(Yb)}return n}raycast(e,n){const r=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(r.boundingSphere===null&&r.computeBoundingSphere(),$b.copy(r.boundingSphere),$b.applyMatrix4(s),Pf.copy(e.ray).recast(e.near),!($b.containsPoint(Pf.origin)===!1&&(Pf.intersectSphere($b,J3)===null||Pf.origin.distanceToSquared(J3)>(e.far-e.near)**2))&&(Q3.copy(s).invert(),Pf.copy(e.ray).applyMatrix4(Q3),!(r.boundingBox!==null&&Pf.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,n,Pf)))}_computeIntersections(e,n,r){let i;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,d=s.attributes.uv1,f=s.attributes.normal,m=s.groups,y=s.drawRange;if(a!==null)if(Array.isArray(o))for(let x=0,S=m.length;x<S;x++){const _=m[x],w=o[_.materialIndex],A=Math.max(_.start,y.start),T=Math.min(a.count,Math.min(_.start+_.count,y.start+y.count));for(let C=A,O=T;C<O;C+=3){const N=a.getX(C),D=a.getX(C+1),F=a.getX(C+2);i=Qb(this,w,e,r,c,d,f,N,D,F),i&&(i.faceIndex=Math.floor(C/3),i.face.materialIndex=_.materialIndex,n.push(i))}}else{const x=Math.max(0,y.start),S=Math.min(a.count,y.start+y.count);for(let _=x,w=S;_<w;_+=3){const A=a.getX(_),T=a.getX(_+1),C=a.getX(_+2);i=Qb(this,o,e,r,c,d,f,A,T,C),i&&(i.faceIndex=Math.floor(_/3),n.push(i))}}else if(l!==void 0)if(Array.isArray(o))for(let x=0,S=m.length;x<S;x++){const _=m[x],w=o[_.materialIndex],A=Math.max(_.start,y.start),T=Math.min(l.count,Math.min(_.start+_.count,y.start+y.count));for(let C=A,O=T;C<O;C+=3){const N=C,D=C+1,F=C+2;i=Qb(this,w,e,r,c,d,f,N,D,F),i&&(i.faceIndex=Math.floor(C/3),i.face.materialIndex=_.materialIndex,n.push(i))}}else{const x=Math.max(0,y.start),S=Math.min(l.count,y.start+y.count);for(let _=x,w=S;_<w;_+=3){const A=_,T=_+1,C=_+2;i=Qb(this,o,e,r,c,d,f,A,T,C),i&&(i.faceIndex=Math.floor(_/3),n.push(i))}}}}function upe(t,e,n,r,i,s,o,a){let l;if(e.side===ss?l=r.intersectTriangle(o,s,i,!0,a):l=r.intersectTriangle(i,s,o,e.side===Dl,a),l===null)return null;Zb.copy(a),Zb.applyMatrix4(t.matrixWorld);const c=n.ray.origin.distanceTo(Zb);return c<n.near||c>n.far?null:{distance:c,point:Zb.clone(),object:t}}function Qb(t,e,n,r,i,s,o,a,l,c){t.getVertexPosition(a,Xb),t.getVertexPosition(l,qb),t.getVertexPosition(c,Kb);const d=upe(t,e,n,r,Xb,qb,Kb,eD);if(d){const f=new X;qs.getBarycoord(eD,Xb,qb,Kb,f),i&&(d.uv=qs.getInterpolatedAttribute(i,a,l,c,f,new Ve)),s&&(d.uv1=qs.getInterpolatedAttribute(s,a,l,c,f,new Ve)),o&&(d.normal=qs.getInterpolatedAttribute(o,a,l,c,f,new X),d.normal.dot(r.direction)>0&&d.normal.multiplyScalar(-1));const m={a,b:l,c,normal:new X,materialIndex:0};qs.getNormal(Xb,qb,Kb,m.normal),d.face=m,d.barycoord=f}return d}class ep extends Zt{constructor(e=1,n=1,r=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:r,widthSegments:i,heightSegments:s,depthSegments:o};const a=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],d=[],f=[];let m=0,y=0;x("z","y","x",-1,-1,r,n,e,o,s,0),x("z","y","x",1,-1,r,n,-e,o,s,1),x("x","z","y",1,1,e,r,n,i,o,2),x("x","z","y",1,-1,e,r,-n,i,o,3),x("x","y","z",1,-1,e,n,r,i,s,4),x("x","y","z",-1,-1,e,n,-r,i,s,5),this.setIndex(l),this.setAttribute("position",new kt(c,3)),this.setAttribute("normal",new kt(d,3)),this.setAttribute("uv",new kt(f,2));function x(S,_,w,A,T,C,O,N,D,F,V){const k=C/D,j=O/F,H=C/2,ne=O/2,te=N/2,pe=D+1,oe=F+1;let ce=0,B=0;const K=new X;for(let q=0;q<oe;q++){const $=q*j-ne;for(let Z=0;Z<pe;Z++){const ge=Z*k-H;K[S]=ge*A,K[_]=$*T,K[w]=te,c.push(K.x,K.y,K.z),K[S]=0,K[_]=0,K[w]=N>0?1:-1,d.push(K.x,K.y,K.z),f.push(Z/D),f.push(1-q/F),ce+=1}}for(let q=0;q<F;q++)for(let $=0;$<D;$++){const Z=m+$+pe*q,ge=m+$+pe*(q+1),ae=m+($+1)+pe*(q+1),fe=m+($+1)+pe*q;l.push(Z,ge,fe),l.push(ge,ae,fe),B+=6}a.addGroup(y,B,V),y+=B,m+=ce}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ep(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Lg(t){const e={};for(const n in t){e[n]={};for(const r in t[n]){const i=t[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[n][r]=null):e[n][r]=i.clone():Array.isArray(i)?e[n][r]=i.slice():e[n][r]=i}}return e}function _s(t){const e={};for(let n=0;n<t.length;n++){const r=Lg(t[n]);for(const i in r)e[i]=r[i]}return e}function dpe(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}function a6(t){const e=t.getRenderTarget();return e===null?t.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:In.workingColorSpace}const E2={clone:Lg,merge:_s};var fpe=`void main() {
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
}`,hpe=`void main() {
|
||
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
||
}`;class Qo extends Gr{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=fpe,this.fragmentShader=hpe,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Lg(e.uniforms),this.uniformsGroups=dpe(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const n=super.toJSON(e);n.glslVersion=this.glslVersion,n.uniforms={};for(const i in this.uniforms){const o=this.uniforms[i].value;o&&o.isTexture?n.uniforms[i]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?n.uniforms[i]={type:"c",value:o.getHex()}:o&&o.isVector2?n.uniforms[i]={type:"v2",value:o.toArray()}:o&&o.isVector3?n.uniforms[i]={type:"v3",value:o.toArray()}:o&&o.isVector4?n.uniforms[i]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?n.uniforms[i]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?n.uniforms[i]={type:"m4",value:o.toArray()}:n.uniforms[i]={value:o}}Object.keys(this.defines).length>0&&(n.defines=this.defines),n.vertexShader=this.vertexShader,n.fragmentShader=this.fragmentShader,n.lights=this.lights,n.clipping=this.clipping;const r={};for(const i in this.extensions)this.extensions[i]===!0&&(r[i]=!0);return Object.keys(r).length>0&&(n.extensions=r),n}}class cx extends mn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ct,this.projectionMatrix=new Ct,this.projectionMatrixInverse=new Ct,this.coordinateSystem=Ml}copy(e,n){return super.copy(e,n),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,n){super.updateWorldMatrix(e,n),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Qu=new X,tD=new Ve,nD=new Ve;class Tr extends cx{constructor(e=50,n=1,r=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=r,this.far=i,this.focus=10,this.aspect=n,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const n=.5*this.getFilmHeight()/e;this.fov=Og*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Eh*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Og*2*Math.atan(Math.tan(Eh*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,n,r){Qu.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Qu.x,Qu.y).multiplyScalar(-e/Qu.z),Qu.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),r.set(Qu.x,Qu.y).multiplyScalar(-e/Qu.z)}getViewSize(e,n){return this.getViewBounds(e,tD,nD),n.subVectors(nD,tD)}setViewOffset(e,n,r,i,s,o){this.aspect=e/n,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let n=e*Math.tan(Eh*.5*this.fov)/this.zoom,r=2*n,i=this.aspect*r,s=-.5*i;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*i/l,n-=o.offsetY*r/c,i*=o.width/l,r*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,n,n-r,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.fov=this.fov,n.object.zoom=this.zoom,n.object.near=this.near,n.object.far=this.far,n.object.focus=this.focus,n.object.aspect=this.aspect,this.view!==null&&(n.object.view=Object.assign({},this.view)),n.object.filmGauge=this.filmGauge,n.object.filmOffset=this.filmOffset,n}}const Sm=-90,Mm=1;class l6 extends mn{constructor(e,n,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Tr(Sm,Mm,e,n);i.layers=this.layers,this.add(i);const s=new Tr(Sm,Mm,e,n);s.layers=this.layers,this.add(s);const o=new Tr(Sm,Mm,e,n);o.layers=this.layers,this.add(o);const a=new Tr(Sm,Mm,e,n);a.layers=this.layers,this.add(a);const l=new Tr(Sm,Mm,e,n);l.layers=this.layers,this.add(l);const c=new Tr(Sm,Mm,e,n);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,n=this.children.concat(),[r,i,s,o,a,l]=n;for(const c of n)this.remove(c);if(e===Ml)r.up.set(0,1,0),r.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===Ny)r.up.set(0,-1,0),r.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of n)this.add(c),c.updateMatrixWorld()}update(e,n){this.parent===null&&this.updateMatrixWorld();const{renderTarget:r,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,l,c,d]=this.children,f=e.getRenderTarget(),m=e.getActiveCubeFace(),y=e.getActiveMipmapLevel(),x=e.xr.enabled;e.xr.enabled=!1;const S=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0,i),e.render(n,s),e.setRenderTarget(r,1,i),e.render(n,o),e.setRenderTarget(r,2,i),e.render(n,a),e.setRenderTarget(r,3,i),e.render(n,l),e.setRenderTarget(r,4,i),e.render(n,c),r.texture.generateMipmaps=S,e.setRenderTarget(r,5,i),e.render(n,d),e.setRenderTarget(f,m,y),e.xr.enabled=x,r.texture.needsPMREMUpdate=!0}}class ux extends dr{constructor(e,n,r,i,s,o,a,l,c,d){e=e!==void 0?e:[],n=n!==void 0?n:Jc,super(e,n,r,i,s,o,a,l,c,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class c6 extends Va{constructor(e=1,n={}){super(e,e,n),this.isWebGLCubeRenderTarget=!0;const r={width:e,height:e,depth:1},i=[r,r,r,r,r,r];this.texture=new ux(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:Cr}fromEquirectangularTexture(e,n){this.texture.type=n.type,this.texture.colorSpace=n.colorSpace,this.texture.generateMipmaps=n.generateMipmaps,this.texture.minFilter=n.minFilter,this.texture.magFilter=n.magFilter;const r={uniforms:{tEquirect:{value:null}},vertexShader:`
|
||
|
||
varying vec3 vWorldDirection;
|
||
|
||
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
|
||
|
||
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
|
||
|
||
}
|
||
|
||
void main() {
|
||
|
||
vWorldDirection = transformDirection( position, modelMatrix );
|
||
|
||
#include <begin_vertex>
|
||
#include <project_vertex>
|
||
|
||
}
|
||
`,fragmentShader:`
|
||
|
||
uniform sampler2D tEquirect;
|
||
|
||
varying vec3 vWorldDirection;
|
||
|
||
#include <common>
|
||
|
||
void main() {
|
||
|
||
vec3 direction = normalize( vWorldDirection );
|
||
|
||
vec2 sampleUV = equirectUv( direction );
|
||
|
||
gl_FragColor = texture2D( tEquirect, sampleUV );
|
||
|
||
}
|
||
`},i=new ep(5,5,5),s=new Qo({name:"CubemapFromEquirect",uniforms:Lg(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:ss,blending:Wc});s.uniforms.tEquirect.value=n;const o=new yr(i,s),a=n.minFilter;return n.minFilter===qo&&(n.minFilter=Cr),new l6(1,10,this).update(e,o),n.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,n,r,i){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(n,r,i);e.setRenderTarget(s)}}const fA=new X,ppe=new X,mpe=new Xt;class Nc{constructor(e=new X(1,0,0),n=0){this.isPlane=!0,this.normal=e,this.constant=n}set(e,n){return this.normal.copy(e),this.constant=n,this}setComponents(e,n,r,i){return this.normal.set(e,n,r),this.constant=i,this}setFromNormalAndCoplanarPoint(e,n){return this.normal.copy(e),this.constant=-n.dot(this.normal),this}setFromCoplanarPoints(e,n,r){const i=fA.subVectors(r,n).cross(ppe.subVectors(e,n)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,n){return n.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,n){const r=e.delta(fA),i=this.normal.dot(r);if(i===0)return this.distanceToPoint(e.start)===0?n.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:n.copy(e.start).addScaledVector(r,s)}intersectsLine(e){const n=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return n<0&&r>0||r<0&&n>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,n){const r=n||mpe.getNormalMatrix(e),i=this.coplanarPoint(fA).applyMatrix4(e),s=this.normal.applyMatrix3(r).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Rf=new Bi,Jb=new X;class dx{constructor(e=new Nc,n=new Nc,r=new Nc,i=new Nc,s=new Nc,o=new Nc){this.planes=[e,n,r,i,s,o]}set(e,n,r,i,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(n),a[2].copy(r),a[3].copy(i),a[4].copy(s),a[5].copy(o),this}copy(e){const n=this.planes;for(let r=0;r<6;r++)n[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e,n=Ml){const r=this.planes,i=e.elements,s=i[0],o=i[1],a=i[2],l=i[3],c=i[4],d=i[5],f=i[6],m=i[7],y=i[8],x=i[9],S=i[10],_=i[11],w=i[12],A=i[13],T=i[14],C=i[15];if(r[0].setComponents(l-s,m-c,_-y,C-w).normalize(),r[1].setComponents(l+s,m+c,_+y,C+w).normalize(),r[2].setComponents(l+o,m+d,_+x,C+A).normalize(),r[3].setComponents(l-o,m-d,_-x,C-A).normalize(),r[4].setComponents(l-a,m-f,_-S,C-T).normalize(),n===Ml)r[5].setComponents(l+a,m+f,_+S,C+T).normalize();else if(n===Ny)r[5].setComponents(a,f,S,T).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+n);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Rf.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),Rf.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Rf)}intersectsSprite(e){return Rf.center.set(0,0,0),Rf.radius=.7071067811865476,Rf.applyMatrix4(e.matrixWorld),this.intersectsSphere(Rf)}intersectsSphere(e){const n=this.planes,r=e.center,i=-e.radius;for(let s=0;s<6;s++)if(n[s].distanceToPoint(r)<i)return!1;return!0}intersectsBox(e){const n=this.planes;for(let r=0;r<6;r++){const i=n[r];if(Jb.x=i.normal.x>0?e.max.x:e.min.x,Jb.y=i.normal.y>0?e.max.y:e.min.y,Jb.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Jb)<0)return!1}return!0}containsPoint(e){const n=this.planes;for(let r=0;r<6;r++)if(n[r].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function u6(){let t=null,e=!1,n=null,r=null;function i(s,o){n(s,o),r=t.requestAnimationFrame(i)}return{start:function(){e!==!0&&n!==null&&(r=t.requestAnimationFrame(i),e=!0)},stop:function(){t.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(s){n=s},setContext:function(s){t=s}}}function gpe(t){const e=new WeakMap;function n(a,l){const c=a.array,d=a.usage,f=c.byteLength,m=t.createBuffer();t.bindBuffer(l,m),t.bufferData(l,c,d),a.onUploadCallback();let y;if(c instanceof Float32Array)y=t.FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?y=t.HALF_FLOAT:y=t.UNSIGNED_SHORT;else if(c instanceof Int16Array)y=t.SHORT;else if(c instanceof Uint32Array)y=t.UNSIGNED_INT;else if(c instanceof Int32Array)y=t.INT;else if(c instanceof Int8Array)y=t.BYTE;else if(c instanceof Uint8Array)y=t.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)y=t.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:m,type:y,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:f}}function r(a,l,c){const d=l.array,f=l.updateRanges;if(t.bindBuffer(c,a),f.length===0)t.bufferSubData(c,0,d);else{f.sort((y,x)=>y.start-x.start);let m=0;for(let y=1;y<f.length;y++){const x=f[m],S=f[y];S.start<=x.start+x.count+1?x.count=Math.max(x.count,S.start+S.count-x.start):(++m,f[m]=S)}f.length=m+1;for(let y=0,x=f.length;y<x;y++){const S=f[y];t.bufferSubData(c,S.start*d.BYTES_PER_ELEMENT,d,S.start,S.count)}l.clearUpdateRanges()}l.onUploadCallback()}function i(a){return a.isInterleavedBufferAttribute&&(a=a.data),e.get(a)}function s(a){a.isInterleavedBufferAttribute&&(a=a.data);const l=e.get(a);l&&(t.deleteBuffer(l.buffer),e.delete(a))}function o(a,l){if(a.isInterleavedBufferAttribute&&(a=a.data),a.isGLBufferAttribute){const d=e.get(a);(!d||d.version<a.version)&&e.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}const c=e.get(a);if(c===void 0)e.set(a,n(a,l));else if(c.version<a.version){if(c.size!==a.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");r(c.buffer,a,l),c.version=a.version}}return{get:i,remove:s,update:o}}class tv extends Zt{constructor(e=1,n=1,r=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:n,widthSegments:r,heightSegments:i};const s=e/2,o=n/2,a=Math.floor(r),l=Math.floor(i),c=a+1,d=l+1,f=e/a,m=n/l,y=[],x=[],S=[],_=[];for(let w=0;w<d;w++){const A=w*m-o;for(let T=0;T<c;T++){const C=T*f-s;x.push(C,-A,0),S.push(0,0,1),_.push(T/a),_.push(1-w/l)}}for(let w=0;w<l;w++)for(let A=0;A<a;A++){const T=A+c*w,C=A+c*(w+1),O=A+1+c*(w+1),N=A+1+c*w;y.push(T,C,N),y.push(C,O,N)}this.setIndex(y),this.setAttribute("position",new kt(x,3)),this.setAttribute("normal",new kt(S,3)),this.setAttribute("uv",new kt(_,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new tv(e.width,e.height,e.widthSegments,e.heightSegments)}}var vpe=`#ifdef USE_ALPHAHASH
|
||
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
|
||
#endif`,ype=`#ifdef USE_ALPHAHASH
|
||
const float ALPHA_HASH_SCALE = 0.05;
|
||
float hash2D( vec2 value ) {
|
||
return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
|
||
}
|
||
float hash3D( vec3 value ) {
|
||
return hash2D( vec2( hash2D( value.xy ), value.z ) );
|
||
}
|
||
float getAlphaHashThreshold( vec3 position ) {
|
||
float maxDeriv = max(
|
||
length( dFdx( position.xyz ) ),
|
||
length( dFdy( position.xyz ) )
|
||
);
|
||
float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
|
||
vec2 pixScales = vec2(
|
||
exp2( floor( log2( pixScale ) ) ),
|
||
exp2( ceil( log2( pixScale ) ) )
|
||
);
|
||
vec2 alpha = vec2(
|
||
hash3D( floor( pixScales.x * position.xyz ) ),
|
||
hash3D( floor( pixScales.y * position.xyz ) )
|
||
);
|
||
float lerpFactor = fract( log2( pixScale ) );
|
||
float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
|
||
float a = min( lerpFactor, 1.0 - lerpFactor );
|
||
vec3 cases = vec3(
|
||
x * x / ( 2.0 * a * ( 1.0 - a ) ),
|
||
( x - 0.5 * a ) / ( 1.0 - a ),
|
||
1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
|
||
);
|
||
float threshold = ( x < ( 1.0 - a ) )
|
||
? ( ( x < a ) ? cases.x : cases.y )
|
||
: cases.z;
|
||
return clamp( threshold , 1.0e-6, 1.0 );
|
||
}
|
||
#endif`,xpe=`#ifdef USE_ALPHAMAP
|
||
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
|
||
#endif`,bpe=`#ifdef USE_ALPHAMAP
|
||
uniform sampler2D alphaMap;
|
||
#endif`,_pe=`#ifdef USE_ALPHATEST
|
||
#ifdef ALPHA_TO_COVERAGE
|
||
diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
|
||
if ( diffuseColor.a == 0.0 ) discard;
|
||
#else
|
||
if ( diffuseColor.a < alphaTest ) discard;
|
||
#endif
|
||
#endif`,wpe=`#ifdef USE_ALPHATEST
|
||
uniform float alphaTest;
|
||
#endif`,Spe=`#ifdef USE_AOMAP
|
||
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
|
||
reflectedLight.indirectDiffuse *= ambientOcclusion;
|
||
#if defined( USE_CLEARCOAT )
|
||
clearcoatSpecularIndirect *= ambientOcclusion;
|
||
#endif
|
||
#if defined( USE_SHEEN )
|
||
sheenSpecularIndirect *= ambientOcclusion;
|
||
#endif
|
||
#if defined( USE_ENVMAP ) && defined( STANDARD )
|
||
float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
|
||
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
|
||
#endif
|
||
#endif`,Mpe=`#ifdef USE_AOMAP
|
||
uniform sampler2D aoMap;
|
||
uniform float aoMapIntensity;
|
||
#endif`,Epe=`#ifdef USE_BATCHING
|
||
#if ! defined( GL_ANGLE_multi_draw )
|
||
#define gl_DrawID _gl_DrawID
|
||
uniform int _gl_DrawID;
|
||
#endif
|
||
uniform highp sampler2D batchingTexture;
|
||
uniform highp usampler2D batchingIdTexture;
|
||
mat4 getBatchingMatrix( const in float i ) {
|
||
int size = textureSize( batchingTexture, 0 ).x;
|
||
int j = int( i ) * 4;
|
||
int x = j % size;
|
||
int y = j / size;
|
||
vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
|
||
vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
|
||
vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
|
||
vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
|
||
return mat4( v1, v2, v3, v4 );
|
||
}
|
||
float getIndirectIndex( const in int i ) {
|
||
int size = textureSize( batchingIdTexture, 0 ).x;
|
||
int x = i % size;
|
||
int y = i / size;
|
||
return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
|
||
}
|
||
#endif
|
||
#ifdef USE_BATCHING_COLOR
|
||
uniform sampler2D batchingColorTexture;
|
||
vec3 getBatchingColor( const in float i ) {
|
||
int size = textureSize( batchingColorTexture, 0 ).x;
|
||
int j = int( i );
|
||
int x = j % size;
|
||
int y = j / size;
|
||
return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
|
||
}
|
||
#endif`,Ape=`#ifdef USE_BATCHING
|
||
mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
|
||
#endif`,Tpe=`vec3 transformed = vec3( position );
|
||
#ifdef USE_ALPHAHASH
|
||
vPosition = vec3( position );
|
||
#endif`,Cpe=`vec3 objectNormal = vec3( normal );
|
||
#ifdef USE_TANGENT
|
||
vec3 objectTangent = vec3( tangent.xyz );
|
||
#endif`,Ppe=`float G_BlinnPhong_Implicit( ) {
|
||
return 0.25;
|
||
}
|
||
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
|
||
return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
|
||
}
|
||
vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
|
||
vec3 halfDir = normalize( lightDir + viewDir );
|
||
float dotNH = saturate( dot( normal, halfDir ) );
|
||
float dotVH = saturate( dot( viewDir, halfDir ) );
|
||
vec3 F = F_Schlick( specularColor, 1.0, dotVH );
|
||
float G = G_BlinnPhong_Implicit( );
|
||
float D = D_BlinnPhong( shininess, dotNH );
|
||
return F * ( G * D );
|
||
} // validated`,Rpe=`#ifdef USE_IRIDESCENCE
|
||
const mat3 XYZ_TO_REC709 = mat3(
|
||
3.2404542, -0.9692660, 0.0556434,
|
||
-1.5371385, 1.8760108, -0.2040259,
|
||
-0.4985314, 0.0415560, 1.0572252
|
||
);
|
||
vec3 Fresnel0ToIor( vec3 fresnel0 ) {
|
||
vec3 sqrtF0 = sqrt( fresnel0 );
|
||
return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
|
||
}
|
||
vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
|
||
return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
|
||
}
|
||
float IorToFresnel0( float transmittedIor, float incidentIor ) {
|
||
return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
|
||
}
|
||
vec3 evalSensitivity( float OPD, vec3 shift ) {
|
||
float phase = 2.0 * PI * OPD * 1.0e-9;
|
||
vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
|
||
vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
|
||
vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
|
||
vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
|
||
xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
|
||
xyz /= 1.0685e-7;
|
||
vec3 rgb = XYZ_TO_REC709 * xyz;
|
||
return rgb;
|
||
}
|
||
vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
|
||
vec3 I;
|
||
float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
|
||
float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
|
||
float cosTheta2Sq = 1.0 - sinTheta2Sq;
|
||
if ( cosTheta2Sq < 0.0 ) {
|
||
return vec3( 1.0 );
|
||
}
|
||
float cosTheta2 = sqrt( cosTheta2Sq );
|
||
float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
|
||
float R12 = F_Schlick( R0, 1.0, cosTheta1 );
|
||
float T121 = 1.0 - R12;
|
||
float phi12 = 0.0;
|
||
if ( iridescenceIOR < outsideIOR ) phi12 = PI;
|
||
float phi21 = PI - phi12;
|
||
vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
|
||
vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
|
||
vec3 phi23 = vec3( 0.0 );
|
||
if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
|
||
if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
|
||
if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
|
||
float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
|
||
vec3 phi = vec3( phi21 ) + phi23;
|
||
vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
|
||
vec3 r123 = sqrt( R123 );
|
||
vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
|
||
vec3 C0 = R12 + Rs;
|
||
I = C0;
|
||
vec3 Cm = Rs - T121;
|
||
for ( int m = 1; m <= 2; ++ m ) {
|
||
Cm *= r123;
|
||
vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
|
||
I += Cm * Sm;
|
||
}
|
||
return max( I, vec3( 0.0 ) );
|
||
}
|
||
#endif`,Npe=`#ifdef USE_BUMPMAP
|
||
uniform sampler2D bumpMap;
|
||
uniform float bumpScale;
|
||
vec2 dHdxy_fwd() {
|
||
vec2 dSTdx = dFdx( vBumpMapUv );
|
||
vec2 dSTdy = dFdy( vBumpMapUv );
|
||
float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
|
||
float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
|
||
float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
|
||
return vec2( dBx, dBy );
|
||
}
|
||
vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
|
||
vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
|
||
vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
|
||
vec3 vN = surf_norm;
|
||
vec3 R1 = cross( vSigmaY, vN );
|
||
vec3 R2 = cross( vN, vSigmaX );
|
||
float fDet = dot( vSigmaX, R1 ) * faceDirection;
|
||
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
|
||
return normalize( abs( fDet ) * surf_norm - vGrad );
|
||
}
|
||
#endif`,Ipe=`#if NUM_CLIPPING_PLANES > 0
|
||
vec4 plane;
|
||
#ifdef ALPHA_TO_COVERAGE
|
||
float distanceToPlane, distanceGradient;
|
||
float clipOpacity = 1.0;
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
|
||
plane = clippingPlanes[ i ];
|
||
distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
|
||
distanceGradient = fwidth( distanceToPlane ) / 2.0;
|
||
clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
|
||
if ( clipOpacity == 0.0 ) discard;
|
||
}
|
||
#pragma unroll_loop_end
|
||
#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
|
||
float unionClipOpacity = 1.0;
|
||
#pragma unroll_loop_start
|
||
for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
|
||
plane = clippingPlanes[ i ];
|
||
distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
|
||
distanceGradient = fwidth( distanceToPlane ) / 2.0;
|
||
unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
|
||
}
|
||
#pragma unroll_loop_end
|
||
clipOpacity *= 1.0 - unionClipOpacity;
|
||
#endif
|
||
diffuseColor.a *= clipOpacity;
|
||
if ( diffuseColor.a == 0.0 ) discard;
|
||
#else
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
|
||
plane = clippingPlanes[ i ];
|
||
if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
|
||
}
|
||
#pragma unroll_loop_end
|
||
#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
|
||
bool clipped = true;
|
||
#pragma unroll_loop_start
|
||
for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
|
||
plane = clippingPlanes[ i ];
|
||
clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
|
||
}
|
||
#pragma unroll_loop_end
|
||
if ( clipped ) discard;
|
||
#endif
|
||
#endif
|
||
#endif`,kpe=`#if NUM_CLIPPING_PLANES > 0
|
||
varying vec3 vClipPosition;
|
||
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
|
||
#endif`,Ope=`#if NUM_CLIPPING_PLANES > 0
|
||
varying vec3 vClipPosition;
|
||
#endif`,Lpe=`#if NUM_CLIPPING_PLANES > 0
|
||
vClipPosition = - mvPosition.xyz;
|
||
#endif`,Dpe=`#if defined( USE_COLOR_ALPHA )
|
||
diffuseColor *= vColor;
|
||
#elif defined( USE_COLOR )
|
||
diffuseColor.rgb *= vColor;
|
||
#endif`,Upe=`#if defined( USE_COLOR_ALPHA )
|
||
varying vec4 vColor;
|
||
#elif defined( USE_COLOR )
|
||
varying vec3 vColor;
|
||
#endif`,jpe=`#if defined( USE_COLOR_ALPHA )
|
||
varying vec4 vColor;
|
||
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
|
||
varying vec3 vColor;
|
||
#endif`,Fpe=`#if defined( USE_COLOR_ALPHA )
|
||
vColor = vec4( 1.0 );
|
||
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
|
||
vColor = vec3( 1.0 );
|
||
#endif
|
||
#ifdef USE_COLOR
|
||
vColor *= color;
|
||
#endif
|
||
#ifdef USE_INSTANCING_COLOR
|
||
vColor.xyz *= instanceColor.xyz;
|
||
#endif
|
||
#ifdef USE_BATCHING_COLOR
|
||
vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
|
||
vColor.xyz *= batchingColor.xyz;
|
||
#endif`,zpe=`#define PI 3.141592653589793
|
||
#define PI2 6.283185307179586
|
||
#define PI_HALF 1.5707963267948966
|
||
#define RECIPROCAL_PI 0.3183098861837907
|
||
#define RECIPROCAL_PI2 0.15915494309189535
|
||
#define EPSILON 1e-6
|
||
#ifndef saturate
|
||
#define saturate( a ) clamp( a, 0.0, 1.0 )
|
||
#endif
|
||
#define whiteComplement( a ) ( 1.0 - saturate( a ) )
|
||
float pow2( const in float x ) { return x*x; }
|
||
vec3 pow2( const in vec3 x ) { return x*x; }
|
||
float pow3( const in float x ) { return x*x*x; }
|
||
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
|
||
float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
|
||
float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
|
||
highp float rand( const in vec2 uv ) {
|
||
const highp float a = 12.9898, b = 78.233, c = 43758.5453;
|
||
highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
|
||
return fract( sin( sn ) * c );
|
||
}
|
||
#ifdef HIGH_PRECISION
|
||
float precisionSafeLength( vec3 v ) { return length( v ); }
|
||
#else
|
||
float precisionSafeLength( vec3 v ) {
|
||
float maxComponent = max3( abs( v ) );
|
||
return length( v / maxComponent ) * maxComponent;
|
||
}
|
||
#endif
|
||
struct IncidentLight {
|
||
vec3 color;
|
||
vec3 direction;
|
||
bool visible;
|
||
};
|
||
struct ReflectedLight {
|
||
vec3 directDiffuse;
|
||
vec3 directSpecular;
|
||
vec3 indirectDiffuse;
|
||
vec3 indirectSpecular;
|
||
};
|
||
#ifdef USE_ALPHAHASH
|
||
varying vec3 vPosition;
|
||
#endif
|
||
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
|
||
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
|
||
}
|
||
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
|
||
return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
|
||
}
|
||
mat3 transposeMat3( const in mat3 m ) {
|
||
mat3 tmp;
|
||
tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
|
||
tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
|
||
tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
|
||
return tmp;
|
||
}
|
||
bool isPerspectiveMatrix( mat4 m ) {
|
||
return m[ 2 ][ 3 ] == - 1.0;
|
||
}
|
||
vec2 equirectUv( in vec3 dir ) {
|
||
float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
|
||
float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
|
||
return vec2( u, v );
|
||
}
|
||
vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
|
||
return RECIPROCAL_PI * diffuseColor;
|
||
}
|
||
vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
|
||
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
|
||
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
|
||
}
|
||
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
|
||
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
|
||
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
|
||
} // validated`,Bpe=`#ifdef ENVMAP_TYPE_CUBE_UV
|
||
#define cubeUV_minMipLevel 4.0
|
||
#define cubeUV_minTileSize 16.0
|
||
float getFace( vec3 direction ) {
|
||
vec3 absDirection = abs( direction );
|
||
float face = - 1.0;
|
||
if ( absDirection.x > absDirection.z ) {
|
||
if ( absDirection.x > absDirection.y )
|
||
face = direction.x > 0.0 ? 0.0 : 3.0;
|
||
else
|
||
face = direction.y > 0.0 ? 1.0 : 4.0;
|
||
} else {
|
||
if ( absDirection.z > absDirection.y )
|
||
face = direction.z > 0.0 ? 2.0 : 5.0;
|
||
else
|
||
face = direction.y > 0.0 ? 1.0 : 4.0;
|
||
}
|
||
return face;
|
||
}
|
||
vec2 getUV( vec3 direction, float face ) {
|
||
vec2 uv;
|
||
if ( face == 0.0 ) {
|
||
uv = vec2( direction.z, direction.y ) / abs( direction.x );
|
||
} else if ( face == 1.0 ) {
|
||
uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
|
||
} else if ( face == 2.0 ) {
|
||
uv = vec2( - direction.x, direction.y ) / abs( direction.z );
|
||
} else if ( face == 3.0 ) {
|
||
uv = vec2( - direction.z, direction.y ) / abs( direction.x );
|
||
} else if ( face == 4.0 ) {
|
||
uv = vec2( - direction.x, direction.z ) / abs( direction.y );
|
||
} else {
|
||
uv = vec2( direction.x, direction.y ) / abs( direction.z );
|
||
}
|
||
return 0.5 * ( uv + 1.0 );
|
||
}
|
||
vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
|
||
float face = getFace( direction );
|
||
float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
|
||
mipInt = max( mipInt, cubeUV_minMipLevel );
|
||
float faceSize = exp2( mipInt );
|
||
highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
|
||
if ( face > 2.0 ) {
|
||
uv.y += faceSize;
|
||
face -= 3.0;
|
||
}
|
||
uv.x += face * faceSize;
|
||
uv.x += filterInt * 3.0 * cubeUV_minTileSize;
|
||
uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
|
||
uv.x *= CUBEUV_TEXEL_WIDTH;
|
||
uv.y *= CUBEUV_TEXEL_HEIGHT;
|
||
#ifdef texture2DGradEXT
|
||
return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
|
||
#else
|
||
return texture2D( envMap, uv ).rgb;
|
||
#endif
|
||
}
|
||
#define cubeUV_r0 1.0
|
||
#define cubeUV_m0 - 2.0
|
||
#define cubeUV_r1 0.8
|
||
#define cubeUV_m1 - 1.0
|
||
#define cubeUV_r4 0.4
|
||
#define cubeUV_m4 2.0
|
||
#define cubeUV_r5 0.305
|
||
#define cubeUV_m5 3.0
|
||
#define cubeUV_r6 0.21
|
||
#define cubeUV_m6 4.0
|
||
float roughnessToMip( float roughness ) {
|
||
float mip = 0.0;
|
||
if ( roughness >= cubeUV_r1 ) {
|
||
mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
|
||
} else if ( roughness >= cubeUV_r4 ) {
|
||
mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
|
||
} else if ( roughness >= cubeUV_r5 ) {
|
||
mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
|
||
} else if ( roughness >= cubeUV_r6 ) {
|
||
mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
|
||
} else {
|
||
mip = - 2.0 * log2( 1.16 * roughness ); }
|
||
return mip;
|
||
}
|
||
vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
|
||
float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
|
||
float mipF = fract( mip );
|
||
float mipInt = floor( mip );
|
||
vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
|
||
if ( mipF == 0.0 ) {
|
||
return vec4( color0, 1.0 );
|
||
} else {
|
||
vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
|
||
return vec4( mix( color0, color1, mipF ), 1.0 );
|
||
}
|
||
}
|
||
#endif`,Hpe=`vec3 transformedNormal = objectNormal;
|
||
#ifdef USE_TANGENT
|
||
vec3 transformedTangent = objectTangent;
|
||
#endif
|
||
#ifdef USE_BATCHING
|
||
mat3 bm = mat3( batchingMatrix );
|
||
transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
|
||
transformedNormal = bm * transformedNormal;
|
||
#ifdef USE_TANGENT
|
||
transformedTangent = bm * transformedTangent;
|
||
#endif
|
||
#endif
|
||
#ifdef USE_INSTANCING
|
||
mat3 im = mat3( instanceMatrix );
|
||
transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
|
||
transformedNormal = im * transformedNormal;
|
||
#ifdef USE_TANGENT
|
||
transformedTangent = im * transformedTangent;
|
||
#endif
|
||
#endif
|
||
transformedNormal = normalMatrix * transformedNormal;
|
||
#ifdef FLIP_SIDED
|
||
transformedNormal = - transformedNormal;
|
||
#endif
|
||
#ifdef USE_TANGENT
|
||
transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
|
||
#ifdef FLIP_SIDED
|
||
transformedTangent = - transformedTangent;
|
||
#endif
|
||
#endif`,Vpe=`#ifdef USE_DISPLACEMENTMAP
|
||
uniform sampler2D displacementMap;
|
||
uniform float displacementScale;
|
||
uniform float displacementBias;
|
||
#endif`,Gpe=`#ifdef USE_DISPLACEMENTMAP
|
||
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
|
||
#endif`,Wpe=`#ifdef USE_EMISSIVEMAP
|
||
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
|
||
totalEmissiveRadiance *= emissiveColor.rgb;
|
||
#endif`,$pe=`#ifdef USE_EMISSIVEMAP
|
||
uniform sampler2D emissiveMap;
|
||
#endif`,Xpe="gl_FragColor = linearToOutputTexel( gl_FragColor );",qpe=`
|
||
const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(
|
||
vec3( 0.8224621, 0.177538, 0.0 ),
|
||
vec3( 0.0331941, 0.9668058, 0.0 ),
|
||
vec3( 0.0170827, 0.0723974, 0.9105199 )
|
||
);
|
||
const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(
|
||
vec3( 1.2249401, - 0.2249404, 0.0 ),
|
||
vec3( - 0.0420569, 1.0420571, 0.0 ),
|
||
vec3( - 0.0196376, - 0.0786361, 1.0982735 )
|
||
);
|
||
vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {
|
||
return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );
|
||
}
|
||
vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {
|
||
return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );
|
||
}
|
||
vec4 LinearTransferOETF( in vec4 value ) {
|
||
return value;
|
||
}
|
||
vec4 sRGBTransferOETF( in vec4 value ) {
|
||
return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
|
||
}`,Kpe=`#ifdef USE_ENVMAP
|
||
#ifdef ENV_WORLDPOS
|
||
vec3 cameraToFrag;
|
||
if ( isOrthographic ) {
|
||
cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
|
||
} else {
|
||
cameraToFrag = normalize( vWorldPosition - cameraPosition );
|
||
}
|
||
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
||
#ifdef ENVMAP_MODE_REFLECTION
|
||
vec3 reflectVec = reflect( cameraToFrag, worldNormal );
|
||
#else
|
||
vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
|
||
#endif
|
||
#else
|
||
vec3 reflectVec = vReflect;
|
||
#endif
|
||
#ifdef ENVMAP_TYPE_CUBE
|
||
vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
|
||
#else
|
||
vec4 envColor = vec4( 0.0 );
|
||
#endif
|
||
#ifdef ENVMAP_BLENDING_MULTIPLY
|
||
outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
|
||
#elif defined( ENVMAP_BLENDING_MIX )
|
||
outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
|
||
#elif defined( ENVMAP_BLENDING_ADD )
|
||
outgoingLight += envColor.xyz * specularStrength * reflectivity;
|
||
#endif
|
||
#endif`,Ype=`#ifdef USE_ENVMAP
|
||
uniform float envMapIntensity;
|
||
uniform float flipEnvMap;
|
||
uniform mat3 envMapRotation;
|
||
#ifdef ENVMAP_TYPE_CUBE
|
||
uniform samplerCube envMap;
|
||
#else
|
||
uniform sampler2D envMap;
|
||
#endif
|
||
|
||
#endif`,Zpe=`#ifdef USE_ENVMAP
|
||
uniform float reflectivity;
|
||
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
|
||
#define ENV_WORLDPOS
|
||
#endif
|
||
#ifdef ENV_WORLDPOS
|
||
varying vec3 vWorldPosition;
|
||
uniform float refractionRatio;
|
||
#else
|
||
varying vec3 vReflect;
|
||
#endif
|
||
#endif`,Qpe=`#ifdef USE_ENVMAP
|
||
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
|
||
#define ENV_WORLDPOS
|
||
#endif
|
||
#ifdef ENV_WORLDPOS
|
||
|
||
varying vec3 vWorldPosition;
|
||
#else
|
||
varying vec3 vReflect;
|
||
uniform float refractionRatio;
|
||
#endif
|
||
#endif`,Jpe=`#ifdef USE_ENVMAP
|
||
#ifdef ENV_WORLDPOS
|
||
vWorldPosition = worldPosition.xyz;
|
||
#else
|
||
vec3 cameraToVertex;
|
||
if ( isOrthographic ) {
|
||
cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
|
||
} else {
|
||
cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
|
||
}
|
||
vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
|
||
#ifdef ENVMAP_MODE_REFLECTION
|
||
vReflect = reflect( cameraToVertex, worldNormal );
|
||
#else
|
||
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
|
||
#endif
|
||
#endif
|
||
#endif`,eme=`#ifdef USE_FOG
|
||
vFogDepth = - mvPosition.z;
|
||
#endif`,tme=`#ifdef USE_FOG
|
||
varying float vFogDepth;
|
||
#endif`,nme=`#ifdef USE_FOG
|
||
#ifdef FOG_EXP2
|
||
float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
|
||
#else
|
||
float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
|
||
#endif
|
||
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
|
||
#endif`,rme=`#ifdef USE_FOG
|
||
uniform vec3 fogColor;
|
||
varying float vFogDepth;
|
||
#ifdef FOG_EXP2
|
||
uniform float fogDensity;
|
||
#else
|
||
uniform float fogNear;
|
||
uniform float fogFar;
|
||
#endif
|
||
#endif`,ime=`#ifdef USE_GRADIENTMAP
|
||
uniform sampler2D gradientMap;
|
||
#endif
|
||
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
|
||
float dotNL = dot( normal, lightDirection );
|
||
vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
|
||
#ifdef USE_GRADIENTMAP
|
||
return vec3( texture2D( gradientMap, coord ).r );
|
||
#else
|
||
vec2 fw = fwidth( coord ) * 0.5;
|
||
return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
|
||
#endif
|
||
}`,sme=`#ifdef USE_LIGHTMAP
|
||
uniform sampler2D lightMap;
|
||
uniform float lightMapIntensity;
|
||
#endif`,ome=`LambertMaterial material;
|
||
material.diffuseColor = diffuseColor.rgb;
|
||
material.specularStrength = specularStrength;`,ame=`varying vec3 vViewPosition;
|
||
struct LambertMaterial {
|
||
vec3 diffuseColor;
|
||
float specularStrength;
|
||
};
|
||
void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
|
||
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
|
||
vec3 irradiance = dotNL * directLight.color;
|
||
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
||
}
|
||
void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
|
||
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
||
}
|
||
#define RE_Direct RE_Direct_Lambert
|
||
#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,lme=`uniform bool receiveShadow;
|
||
uniform vec3 ambientLightColor;
|
||
#if defined( USE_LIGHT_PROBES )
|
||
uniform vec3 lightProbe[ 9 ];
|
||
#endif
|
||
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
|
||
float x = normal.x, y = normal.y, z = normal.z;
|
||
vec3 result = shCoefficients[ 0 ] * 0.886227;
|
||
result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
|
||
result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
|
||
result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
|
||
result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
|
||
result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
|
||
result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
|
||
result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
|
||
result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
|
||
return result;
|
||
}
|
||
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
|
||
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
||
vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
|
||
return irradiance;
|
||
}
|
||
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
|
||
vec3 irradiance = ambientLightColor;
|
||
return irradiance;
|
||
}
|
||
float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
|
||
float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
|
||
if ( cutoffDistance > 0.0 ) {
|
||
distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
|
||
}
|
||
return distanceFalloff;
|
||
}
|
||
float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
|
||
return smoothstep( coneCosine, penumbraCosine, angleCosine );
|
||
}
|
||
#if NUM_DIR_LIGHTS > 0
|
||
struct DirectionalLight {
|
||
vec3 direction;
|
||
vec3 color;
|
||
};
|
||
uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
|
||
void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
|
||
light.color = directionalLight.color;
|
||
light.direction = directionalLight.direction;
|
||
light.visible = true;
|
||
}
|
||
#endif
|
||
#if NUM_POINT_LIGHTS > 0
|
||
struct PointLight {
|
||
vec3 position;
|
||
vec3 color;
|
||
float distance;
|
||
float decay;
|
||
};
|
||
uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
|
||
void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
|
||
vec3 lVector = pointLight.position - geometryPosition;
|
||
light.direction = normalize( lVector );
|
||
float lightDistance = length( lVector );
|
||
light.color = pointLight.color;
|
||
light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
|
||
light.visible = ( light.color != vec3( 0.0 ) );
|
||
}
|
||
#endif
|
||
#if NUM_SPOT_LIGHTS > 0
|
||
struct SpotLight {
|
||
vec3 position;
|
||
vec3 direction;
|
||
vec3 color;
|
||
float distance;
|
||
float decay;
|
||
float coneCos;
|
||
float penumbraCos;
|
||
};
|
||
uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
|
||
void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
|
||
vec3 lVector = spotLight.position - geometryPosition;
|
||
light.direction = normalize( lVector );
|
||
float angleCos = dot( light.direction, spotLight.direction );
|
||
float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
|
||
if ( spotAttenuation > 0.0 ) {
|
||
float lightDistance = length( lVector );
|
||
light.color = spotLight.color * spotAttenuation;
|
||
light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
|
||
light.visible = ( light.color != vec3( 0.0 ) );
|
||
} else {
|
||
light.color = vec3( 0.0 );
|
||
light.visible = false;
|
||
}
|
||
}
|
||
#endif
|
||
#if NUM_RECT_AREA_LIGHTS > 0
|
||
struct RectAreaLight {
|
||
vec3 color;
|
||
vec3 position;
|
||
vec3 halfWidth;
|
||
vec3 halfHeight;
|
||
};
|
||
uniform sampler2D ltc_1; uniform sampler2D ltc_2;
|
||
uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
|
||
#endif
|
||
#if NUM_HEMI_LIGHTS > 0
|
||
struct HemisphereLight {
|
||
vec3 direction;
|
||
vec3 skyColor;
|
||
vec3 groundColor;
|
||
};
|
||
uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
|
||
vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
|
||
float dotNL = dot( normal, hemiLight.direction );
|
||
float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
|
||
vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
|
||
return irradiance;
|
||
}
|
||
#endif`,cme=`#ifdef USE_ENVMAP
|
||
vec3 getIBLIrradiance( const in vec3 normal ) {
|
||
#ifdef ENVMAP_TYPE_CUBE_UV
|
||
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
||
vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
|
||
return PI * envMapColor.rgb * envMapIntensity;
|
||
#else
|
||
return vec3( 0.0 );
|
||
#endif
|
||
}
|
||
vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
|
||
#ifdef ENVMAP_TYPE_CUBE_UV
|
||
vec3 reflectVec = reflect( - viewDir, normal );
|
||
reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
|
||
reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
|
||
vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
|
||
return envMapColor.rgb * envMapIntensity;
|
||
#else
|
||
return vec3( 0.0 );
|
||
#endif
|
||
}
|
||
#ifdef USE_ANISOTROPY
|
||
vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
|
||
#ifdef ENVMAP_TYPE_CUBE_UV
|
||
vec3 bentNormal = cross( bitangent, viewDir );
|
||
bentNormal = normalize( cross( bentNormal, bitangent ) );
|
||
bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
|
||
return getIBLRadiance( viewDir, bentNormal, roughness );
|
||
#else
|
||
return vec3( 0.0 );
|
||
#endif
|
||
}
|
||
#endif
|
||
#endif`,ume=`ToonMaterial material;
|
||
material.diffuseColor = diffuseColor.rgb;`,dme=`varying vec3 vViewPosition;
|
||
struct ToonMaterial {
|
||
vec3 diffuseColor;
|
||
};
|
||
void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
|
||
vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
|
||
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
||
}
|
||
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
|
||
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
||
}
|
||
#define RE_Direct RE_Direct_Toon
|
||
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,fme=`BlinnPhongMaterial material;
|
||
material.diffuseColor = diffuseColor.rgb;
|
||
material.specularColor = specular;
|
||
material.specularShininess = shininess;
|
||
material.specularStrength = specularStrength;`,hme=`varying vec3 vViewPosition;
|
||
struct BlinnPhongMaterial {
|
||
vec3 diffuseColor;
|
||
vec3 specularColor;
|
||
float specularShininess;
|
||
float specularStrength;
|
||
};
|
||
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
|
||
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
|
||
vec3 irradiance = dotNL * directLight.color;
|
||
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
||
reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
|
||
}
|
||
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
|
||
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
||
}
|
||
#define RE_Direct RE_Direct_BlinnPhong
|
||
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,pme=`PhysicalMaterial material;
|
||
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
|
||
vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
|
||
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
|
||
material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
|
||
material.roughness = min( material.roughness, 1.0 );
|
||
#ifdef IOR
|
||
material.ior = ior;
|
||
#ifdef USE_SPECULAR
|
||
float specularIntensityFactor = specularIntensity;
|
||
vec3 specularColorFactor = specularColor;
|
||
#ifdef USE_SPECULAR_COLORMAP
|
||
specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
|
||
#endif
|
||
#ifdef USE_SPECULAR_INTENSITYMAP
|
||
specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
|
||
#endif
|
||
material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
|
||
#else
|
||
float specularIntensityFactor = 1.0;
|
||
vec3 specularColorFactor = vec3( 1.0 );
|
||
material.specularF90 = 1.0;
|
||
#endif
|
||
material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
|
||
#else
|
||
material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
|
||
material.specularF90 = 1.0;
|
||
#endif
|
||
#ifdef USE_CLEARCOAT
|
||
material.clearcoat = clearcoat;
|
||
material.clearcoatRoughness = clearcoatRoughness;
|
||
material.clearcoatF0 = vec3( 0.04 );
|
||
material.clearcoatF90 = 1.0;
|
||
#ifdef USE_CLEARCOATMAP
|
||
material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
|
||
#endif
|
||
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
||
material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
|
||
#endif
|
||
material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
|
||
material.clearcoatRoughness += geometryRoughness;
|
||
material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
|
||
#endif
|
||
#ifdef USE_DISPERSION
|
||
material.dispersion = dispersion;
|
||
#endif
|
||
#ifdef USE_IRIDESCENCE
|
||
material.iridescence = iridescence;
|
||
material.iridescenceIOR = iridescenceIOR;
|
||
#ifdef USE_IRIDESCENCEMAP
|
||
material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
|
||
#endif
|
||
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
||
material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
|
||
#else
|
||
material.iridescenceThickness = iridescenceThicknessMaximum;
|
||
#endif
|
||
#endif
|
||
#ifdef USE_SHEEN
|
||
material.sheenColor = sheenColor;
|
||
#ifdef USE_SHEEN_COLORMAP
|
||
material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
|
||
#endif
|
||
material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
|
||
#ifdef USE_SHEEN_ROUGHNESSMAP
|
||
material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
|
||
#endif
|
||
#endif
|
||
#ifdef USE_ANISOTROPY
|
||
#ifdef USE_ANISOTROPYMAP
|
||
mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
|
||
vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
|
||
vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
|
||
#else
|
||
vec2 anisotropyV = anisotropyVector;
|
||
#endif
|
||
material.anisotropy = length( anisotropyV );
|
||
if( material.anisotropy == 0.0 ) {
|
||
anisotropyV = vec2( 1.0, 0.0 );
|
||
} else {
|
||
anisotropyV /= material.anisotropy;
|
||
material.anisotropy = saturate( material.anisotropy );
|
||
}
|
||
material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
|
||
material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
|
||
material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
|
||
#endif`,mme=`struct PhysicalMaterial {
|
||
vec3 diffuseColor;
|
||
float roughness;
|
||
vec3 specularColor;
|
||
float specularF90;
|
||
float dispersion;
|
||
#ifdef USE_CLEARCOAT
|
||
float clearcoat;
|
||
float clearcoatRoughness;
|
||
vec3 clearcoatF0;
|
||
float clearcoatF90;
|
||
#endif
|
||
#ifdef USE_IRIDESCENCE
|
||
float iridescence;
|
||
float iridescenceIOR;
|
||
float iridescenceThickness;
|
||
vec3 iridescenceFresnel;
|
||
vec3 iridescenceF0;
|
||
#endif
|
||
#ifdef USE_SHEEN
|
||
vec3 sheenColor;
|
||
float sheenRoughness;
|
||
#endif
|
||
#ifdef IOR
|
||
float ior;
|
||
#endif
|
||
#ifdef USE_TRANSMISSION
|
||
float transmission;
|
||
float transmissionAlpha;
|
||
float thickness;
|
||
float attenuationDistance;
|
||
vec3 attenuationColor;
|
||
#endif
|
||
#ifdef USE_ANISOTROPY
|
||
float anisotropy;
|
||
float alphaT;
|
||
vec3 anisotropyT;
|
||
vec3 anisotropyB;
|
||
#endif
|
||
};
|
||
vec3 clearcoatSpecularDirect = vec3( 0.0 );
|
||
vec3 clearcoatSpecularIndirect = vec3( 0.0 );
|
||
vec3 sheenSpecularDirect = vec3( 0.0 );
|
||
vec3 sheenSpecularIndirect = vec3(0.0 );
|
||
vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
|
||
float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
|
||
float x2 = x * x;
|
||
float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
|
||
return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
|
||
}
|
||
float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
|
||
float a2 = pow2( alpha );
|
||
float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
|
||
float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
|
||
return 0.5 / max( gv + gl, EPSILON );
|
||
}
|
||
float D_GGX( const in float alpha, const in float dotNH ) {
|
||
float a2 = pow2( alpha );
|
||
float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
|
||
return RECIPROCAL_PI * a2 / pow2( denom );
|
||
}
|
||
#ifdef USE_ANISOTROPY
|
||
float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
|
||
float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
|
||
float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
|
||
float v = 0.5 / ( gv + gl );
|
||
return saturate(v);
|
||
}
|
||
float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
|
||
float a2 = alphaT * alphaB;
|
||
highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
|
||
highp float v2 = dot( v, v );
|
||
float w2 = a2 / v2;
|
||
return RECIPROCAL_PI * a2 * pow2 ( w2 );
|
||
}
|
||
#endif
|
||
#ifdef USE_CLEARCOAT
|
||
vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
|
||
vec3 f0 = material.clearcoatF0;
|
||
float f90 = material.clearcoatF90;
|
||
float roughness = material.clearcoatRoughness;
|
||
float alpha = pow2( roughness );
|
||
vec3 halfDir = normalize( lightDir + viewDir );
|
||
float dotNL = saturate( dot( normal, lightDir ) );
|
||
float dotNV = saturate( dot( normal, viewDir ) );
|
||
float dotNH = saturate( dot( normal, halfDir ) );
|
||
float dotVH = saturate( dot( viewDir, halfDir ) );
|
||
vec3 F = F_Schlick( f0, f90, dotVH );
|
||
float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
|
||
float D = D_GGX( alpha, dotNH );
|
||
return F * ( V * D );
|
||
}
|
||
#endif
|
||
vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
|
||
vec3 f0 = material.specularColor;
|
||
float f90 = material.specularF90;
|
||
float roughness = material.roughness;
|
||
float alpha = pow2( roughness );
|
||
vec3 halfDir = normalize( lightDir + viewDir );
|
||
float dotNL = saturate( dot( normal, lightDir ) );
|
||
float dotNV = saturate( dot( normal, viewDir ) );
|
||
float dotNH = saturate( dot( normal, halfDir ) );
|
||
float dotVH = saturate( dot( viewDir, halfDir ) );
|
||
vec3 F = F_Schlick( f0, f90, dotVH );
|
||
#ifdef USE_IRIDESCENCE
|
||
F = mix( F, material.iridescenceFresnel, material.iridescence );
|
||
#endif
|
||
#ifdef USE_ANISOTROPY
|
||
float dotTL = dot( material.anisotropyT, lightDir );
|
||
float dotTV = dot( material.anisotropyT, viewDir );
|
||
float dotTH = dot( material.anisotropyT, halfDir );
|
||
float dotBL = dot( material.anisotropyB, lightDir );
|
||
float dotBV = dot( material.anisotropyB, viewDir );
|
||
float dotBH = dot( material.anisotropyB, halfDir );
|
||
float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
|
||
float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
|
||
#else
|
||
float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
|
||
float D = D_GGX( alpha, dotNH );
|
||
#endif
|
||
return F * ( V * D );
|
||
}
|
||
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
|
||
const float LUT_SIZE = 64.0;
|
||
const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
|
||
const float LUT_BIAS = 0.5 / LUT_SIZE;
|
||
float dotNV = saturate( dot( N, V ) );
|
||
vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
|
||
uv = uv * LUT_SCALE + LUT_BIAS;
|
||
return uv;
|
||
}
|
||
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
|
||
float l = length( f );
|
||
return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
|
||
}
|
||
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
|
||
float x = dot( v1, v2 );
|
||
float y = abs( x );
|
||
float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
|
||
float b = 3.4175940 + ( 4.1616724 + y ) * y;
|
||
float v = a / b;
|
||
float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
|
||
return cross( v1, v2 ) * theta_sintheta;
|
||
}
|
||
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
|
||
vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
|
||
vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
|
||
vec3 lightNormal = cross( v1, v2 );
|
||
if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
|
||
vec3 T1, T2;
|
||
T1 = normalize( V - N * dot( V, N ) );
|
||
T2 = - cross( N, T1 );
|
||
mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
|
||
vec3 coords[ 4 ];
|
||
coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
|
||
coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
|
||
coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
|
||
coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
|
||
coords[ 0 ] = normalize( coords[ 0 ] );
|
||
coords[ 1 ] = normalize( coords[ 1 ] );
|
||
coords[ 2 ] = normalize( coords[ 2 ] );
|
||
coords[ 3 ] = normalize( coords[ 3 ] );
|
||
vec3 vectorFormFactor = vec3( 0.0 );
|
||
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
|
||
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
|
||
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
|
||
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
|
||
float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
|
||
return vec3( result );
|
||
}
|
||
#if defined( USE_SHEEN )
|
||
float D_Charlie( float roughness, float dotNH ) {
|
||
float alpha = pow2( roughness );
|
||
float invAlpha = 1.0 / alpha;
|
||
float cos2h = dotNH * dotNH;
|
||
float sin2h = max( 1.0 - cos2h, 0.0078125 );
|
||
return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
|
||
}
|
||
float V_Neubelt( float dotNV, float dotNL ) {
|
||
return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
|
||
}
|
||
vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
|
||
vec3 halfDir = normalize( lightDir + viewDir );
|
||
float dotNL = saturate( dot( normal, lightDir ) );
|
||
float dotNV = saturate( dot( normal, viewDir ) );
|
||
float dotNH = saturate( dot( normal, halfDir ) );
|
||
float D = D_Charlie( sheenRoughness, dotNH );
|
||
float V = V_Neubelt( dotNV, dotNL );
|
||
return sheenColor * ( D * V );
|
||
}
|
||
#endif
|
||
float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
|
||
float dotNV = saturate( dot( normal, viewDir ) );
|
||
float r2 = roughness * roughness;
|
||
float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
|
||
float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
|
||
float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
|
||
return saturate( DG * RECIPROCAL_PI );
|
||
}
|
||
vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
|
||
float dotNV = saturate( dot( normal, viewDir ) );
|
||
const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
|
||
const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
|
||
vec4 r = roughness * c0 + c1;
|
||
float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
|
||
vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
|
||
return fab;
|
||
}
|
||
vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
|
||
vec2 fab = DFGApprox( normal, viewDir, roughness );
|
||
return specularColor * fab.x + specularF90 * fab.y;
|
||
}
|
||
#ifdef USE_IRIDESCENCE
|
||
void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
|
||
#else
|
||
void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
|
||
#endif
|
||
vec2 fab = DFGApprox( normal, viewDir, roughness );
|
||
#ifdef USE_IRIDESCENCE
|
||
vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
|
||
#else
|
||
vec3 Fr = specularColor;
|
||
#endif
|
||
vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
|
||
float Ess = fab.x + fab.y;
|
||
float Ems = 1.0 - Ess;
|
||
vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
|
||
singleScatter += FssEss;
|
||
multiScatter += Fms * Ems;
|
||
}
|
||
#if NUM_RECT_AREA_LIGHTS > 0
|
||
void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
|
||
vec3 normal = geometryNormal;
|
||
vec3 viewDir = geometryViewDir;
|
||
vec3 position = geometryPosition;
|
||
vec3 lightPos = rectAreaLight.position;
|
||
vec3 halfWidth = rectAreaLight.halfWidth;
|
||
vec3 halfHeight = rectAreaLight.halfHeight;
|
||
vec3 lightColor = rectAreaLight.color;
|
||
float roughness = material.roughness;
|
||
vec3 rectCoords[ 4 ];
|
||
rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
|
||
rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
|
||
rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
|
||
vec2 uv = LTC_Uv( normal, viewDir, roughness );
|
||
vec4 t1 = texture2D( ltc_1, uv );
|
||
vec4 t2 = texture2D( ltc_2, uv );
|
||
mat3 mInv = mat3(
|
||
vec3( t1.x, 0, t1.y ),
|
||
vec3( 0, 1, 0 ),
|
||
vec3( t1.z, 0, t1.w )
|
||
);
|
||
vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
|
||
reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
|
||
reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
|
||
}
|
||
#endif
|
||
void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
|
||
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
|
||
vec3 irradiance = dotNL * directLight.color;
|
||
#ifdef USE_CLEARCOAT
|
||
float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
|
||
vec3 ccIrradiance = dotNLcc * directLight.color;
|
||
clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
|
||
#endif
|
||
#ifdef USE_SHEEN
|
||
sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
|
||
#endif
|
||
reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
|
||
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
||
}
|
||
void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
|
||
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
||
}
|
||
void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
|
||
#ifdef USE_CLEARCOAT
|
||
clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
|
||
#endif
|
||
#ifdef USE_SHEEN
|
||
sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
|
||
#endif
|
||
vec3 singleScattering = vec3( 0.0 );
|
||
vec3 multiScattering = vec3( 0.0 );
|
||
vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
|
||
#ifdef USE_IRIDESCENCE
|
||
computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
|
||
#else
|
||
computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
|
||
#endif
|
||
vec3 totalScattering = singleScattering + multiScattering;
|
||
vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
|
||
reflectedLight.indirectSpecular += radiance * singleScattering;
|
||
reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
|
||
reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
|
||
}
|
||
#define RE_Direct RE_Direct_Physical
|
||
#define RE_Direct_RectArea RE_Direct_RectArea_Physical
|
||
#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
|
||
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
|
||
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
|
||
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
|
||
}`,gme=`
|
||
vec3 geometryPosition = - vViewPosition;
|
||
vec3 geometryNormal = normal;
|
||
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
|
||
vec3 geometryClearcoatNormal = vec3( 0.0 );
|
||
#ifdef USE_CLEARCOAT
|
||
geometryClearcoatNormal = clearcoatNormal;
|
||
#endif
|
||
#ifdef USE_IRIDESCENCE
|
||
float dotNVi = saturate( dot( normal, geometryViewDir ) );
|
||
if ( material.iridescenceThickness == 0.0 ) {
|
||
material.iridescence = 0.0;
|
||
} else {
|
||
material.iridescence = saturate( material.iridescence );
|
||
}
|
||
if ( material.iridescence > 0.0 ) {
|
||
material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
|
||
material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
|
||
}
|
||
#endif
|
||
IncidentLight directLight;
|
||
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
|
||
PointLight pointLight;
|
||
#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
|
||
PointLightShadow pointLightShadow;
|
||
#endif
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
|
||
pointLight = pointLights[ i ];
|
||
getPointLightInfo( pointLight, geometryPosition, directLight );
|
||
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
|
||
pointLightShadow = pointLightShadows[ i ];
|
||
directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
|
||
#endif
|
||
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
|
||
SpotLight spotLight;
|
||
vec4 spotColor;
|
||
vec3 spotLightCoord;
|
||
bool inSpotLightMap;
|
||
#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
|
||
SpotLightShadow spotLightShadow;
|
||
#endif
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
|
||
spotLight = spotLights[ i ];
|
||
getSpotLightInfo( spotLight, geometryPosition, directLight );
|
||
#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
|
||
#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
|
||
#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
|
||
#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
|
||
#else
|
||
#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
|
||
#endif
|
||
#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
|
||
spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
|
||
inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
|
||
spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
|
||
directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
|
||
#endif
|
||
#undef SPOT_LIGHT_MAP_INDEX
|
||
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
|
||
spotLightShadow = spotLightShadows[ i ];
|
||
directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
|
||
#endif
|
||
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
|
||
DirectionalLight directionalLight;
|
||
#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
|
||
DirectionalLightShadow directionalLightShadow;
|
||
#endif
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
|
||
directionalLight = directionalLights[ i ];
|
||
getDirectionalLightInfo( directionalLight, directLight );
|
||
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
|
||
directionalLightShadow = directionalLightShadows[ i ];
|
||
directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
|
||
#endif
|
||
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
|
||
RectAreaLight rectAreaLight;
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
|
||
rectAreaLight = rectAreaLights[ i ];
|
||
RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#if defined( RE_IndirectDiffuse )
|
||
vec3 iblIrradiance = vec3( 0.0 );
|
||
vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
|
||
#if defined( USE_LIGHT_PROBES )
|
||
irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
|
||
#endif
|
||
#if ( NUM_HEMI_LIGHTS > 0 )
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
|
||
irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#endif
|
||
#if defined( RE_IndirectSpecular )
|
||
vec3 radiance = vec3( 0.0 );
|
||
vec3 clearcoatRadiance = vec3( 0.0 );
|
||
#endif`,vme=`#if defined( RE_IndirectDiffuse )
|
||
#ifdef USE_LIGHTMAP
|
||
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
|
||
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
|
||
irradiance += lightMapIrradiance;
|
||
#endif
|
||
#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
|
||
iblIrradiance += getIBLIrradiance( geometryNormal );
|
||
#endif
|
||
#endif
|
||
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
|
||
#ifdef USE_ANISOTROPY
|
||
radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
|
||
#else
|
||
radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
|
||
#endif
|
||
#ifdef USE_CLEARCOAT
|
||
clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
|
||
#endif
|
||
#endif`,yme=`#if defined( RE_IndirectDiffuse )
|
||
RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
||
#endif
|
||
#if defined( RE_IndirectSpecular )
|
||
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
||
#endif`,xme=`#if defined( USE_LOGDEPTHBUF )
|
||
gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
|
||
#endif`,bme=`#if defined( USE_LOGDEPTHBUF )
|
||
uniform float logDepthBufFC;
|
||
varying float vFragDepth;
|
||
varying float vIsPerspective;
|
||
#endif`,_me=`#ifdef USE_LOGDEPTHBUF
|
||
varying float vFragDepth;
|
||
varying float vIsPerspective;
|
||
#endif`,wme=`#ifdef USE_LOGDEPTHBUF
|
||
vFragDepth = 1.0 + gl_Position.w;
|
||
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
|
||
#endif`,Sme=`#ifdef USE_MAP
|
||
vec4 sampledDiffuseColor = texture2D( map, vMapUv );
|
||
#ifdef DECODE_VIDEO_TEXTURE
|
||
sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );
|
||
|
||
#endif
|
||
diffuseColor *= sampledDiffuseColor;
|
||
#endif`,Mme=`#ifdef USE_MAP
|
||
uniform sampler2D map;
|
||
#endif`,Eme=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
||
#if defined( USE_POINTS_UV )
|
||
vec2 uv = vUv;
|
||
#else
|
||
vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
|
||
#endif
|
||
#endif
|
||
#ifdef USE_MAP
|
||
diffuseColor *= texture2D( map, uv );
|
||
#endif
|
||
#ifdef USE_ALPHAMAP
|
||
diffuseColor.a *= texture2D( alphaMap, uv ).g;
|
||
#endif`,Ame=`#if defined( USE_POINTS_UV )
|
||
varying vec2 vUv;
|
||
#else
|
||
#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
||
uniform mat3 uvTransform;
|
||
#endif
|
||
#endif
|
||
#ifdef USE_MAP
|
||
uniform sampler2D map;
|
||
#endif
|
||
#ifdef USE_ALPHAMAP
|
||
uniform sampler2D alphaMap;
|
||
#endif`,Tme=`float metalnessFactor = metalness;
|
||
#ifdef USE_METALNESSMAP
|
||
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
|
||
metalnessFactor *= texelMetalness.b;
|
||
#endif`,Cme=`#ifdef USE_METALNESSMAP
|
||
uniform sampler2D metalnessMap;
|
||
#endif`,Pme=`#ifdef USE_INSTANCING_MORPH
|
||
float morphTargetInfluences[ MORPHTARGETS_COUNT ];
|
||
float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
|
||
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
||
morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
|
||
}
|
||
#endif`,Rme=`#if defined( USE_MORPHCOLORS )
|
||
vColor *= morphTargetBaseInfluence;
|
||
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
||
#if defined( USE_COLOR_ALPHA )
|
||
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
|
||
#elif defined( USE_COLOR )
|
||
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
|
||
#endif
|
||
}
|
||
#endif`,Nme=`#ifdef USE_MORPHNORMALS
|
||
objectNormal *= morphTargetBaseInfluence;
|
||
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
||
if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
|
||
}
|
||
#endif`,Ime=`#ifdef USE_MORPHTARGETS
|
||
#ifndef USE_INSTANCING_MORPH
|
||
uniform float morphTargetBaseInfluence;
|
||
uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
|
||
#endif
|
||
uniform sampler2DArray morphTargetsTexture;
|
||
uniform ivec2 morphTargetsTextureSize;
|
||
vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
|
||
int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
|
||
int y = texelIndex / morphTargetsTextureSize.x;
|
||
int x = texelIndex - y * morphTargetsTextureSize.x;
|
||
ivec3 morphUV = ivec3( x, y, morphTargetIndex );
|
||
return texelFetch( morphTargetsTexture, morphUV, 0 );
|
||
}
|
||
#endif`,kme=`#ifdef USE_MORPHTARGETS
|
||
transformed *= morphTargetBaseInfluence;
|
||
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
||
if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
|
||
}
|
||
#endif`,Ome=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
|
||
#ifdef FLAT_SHADED
|
||
vec3 fdx = dFdx( vViewPosition );
|
||
vec3 fdy = dFdy( vViewPosition );
|
||
vec3 normal = normalize( cross( fdx, fdy ) );
|
||
#else
|
||
vec3 normal = normalize( vNormal );
|
||
#ifdef DOUBLE_SIDED
|
||
normal *= faceDirection;
|
||
#endif
|
||
#endif
|
||
#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
|
||
#ifdef USE_TANGENT
|
||
mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
|
||
#else
|
||
mat3 tbn = getTangentFrame( - vViewPosition, normal,
|
||
#if defined( USE_NORMALMAP )
|
||
vNormalMapUv
|
||
#elif defined( USE_CLEARCOAT_NORMALMAP )
|
||
vClearcoatNormalMapUv
|
||
#else
|
||
vUv
|
||
#endif
|
||
);
|
||
#endif
|
||
#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
|
||
tbn[0] *= faceDirection;
|
||
tbn[1] *= faceDirection;
|
||
#endif
|
||
#endif
|
||
#ifdef USE_CLEARCOAT_NORMALMAP
|
||
#ifdef USE_TANGENT
|
||
mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
|
||
#else
|
||
mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
|
||
#endif
|
||
#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
|
||
tbn2[0] *= faceDirection;
|
||
tbn2[1] *= faceDirection;
|
||
#endif
|
||
#endif
|
||
vec3 nonPerturbedNormal = normal;`,Lme=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
||
normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
|
||
#ifdef FLIP_SIDED
|
||
normal = - normal;
|
||
#endif
|
||
#ifdef DOUBLE_SIDED
|
||
normal = normal * faceDirection;
|
||
#endif
|
||
normal = normalize( normalMatrix * normal );
|
||
#elif defined( USE_NORMALMAP_TANGENTSPACE )
|
||
vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
|
||
mapN.xy *= normalScale;
|
||
normal = normalize( tbn * mapN );
|
||
#elif defined( USE_BUMPMAP )
|
||
normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
|
||
#endif`,Dme=`#ifndef FLAT_SHADED
|
||
varying vec3 vNormal;
|
||
#ifdef USE_TANGENT
|
||
varying vec3 vTangent;
|
||
varying vec3 vBitangent;
|
||
#endif
|
||
#endif`,Ume=`#ifndef FLAT_SHADED
|
||
varying vec3 vNormal;
|
||
#ifdef USE_TANGENT
|
||
varying vec3 vTangent;
|
||
varying vec3 vBitangent;
|
||
#endif
|
||
#endif`,jme=`#ifndef FLAT_SHADED
|
||
vNormal = normalize( transformedNormal );
|
||
#ifdef USE_TANGENT
|
||
vTangent = normalize( transformedTangent );
|
||
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
|
||
#endif
|
||
#endif`,Fme=`#ifdef USE_NORMALMAP
|
||
uniform sampler2D normalMap;
|
||
uniform vec2 normalScale;
|
||
#endif
|
||
#ifdef USE_NORMALMAP_OBJECTSPACE
|
||
uniform mat3 normalMatrix;
|
||
#endif
|
||
#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
|
||
mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
|
||
vec3 q0 = dFdx( eye_pos.xyz );
|
||
vec3 q1 = dFdy( eye_pos.xyz );
|
||
vec2 st0 = dFdx( uv.st );
|
||
vec2 st1 = dFdy( uv.st );
|
||
vec3 N = surf_norm;
|
||
vec3 q1perp = cross( q1, N );
|
||
vec3 q0perp = cross( N, q0 );
|
||
vec3 T = q1perp * st0.x + q0perp * st1.x;
|
||
vec3 B = q1perp * st0.y + q0perp * st1.y;
|
||
float det = max( dot( T, T ), dot( B, B ) );
|
||
float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
|
||
return mat3( T * scale, B * scale, N );
|
||
}
|
||
#endif`,zme=`#ifdef USE_CLEARCOAT
|
||
vec3 clearcoatNormal = nonPerturbedNormal;
|
||
#endif`,Bme=`#ifdef USE_CLEARCOAT_NORMALMAP
|
||
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
|
||
clearcoatMapN.xy *= clearcoatNormalScale;
|
||
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
|
||
#endif`,Hme=`#ifdef USE_CLEARCOATMAP
|
||
uniform sampler2D clearcoatMap;
|
||
#endif
|
||
#ifdef USE_CLEARCOAT_NORMALMAP
|
||
uniform sampler2D clearcoatNormalMap;
|
||
uniform vec2 clearcoatNormalScale;
|
||
#endif
|
||
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
||
uniform sampler2D clearcoatRoughnessMap;
|
||
#endif`,Vme=`#ifdef USE_IRIDESCENCEMAP
|
||
uniform sampler2D iridescenceMap;
|
||
#endif
|
||
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
||
uniform sampler2D iridescenceThicknessMap;
|
||
#endif`,Gme=`#ifdef OPAQUE
|
||
diffuseColor.a = 1.0;
|
||
#endif
|
||
#ifdef USE_TRANSMISSION
|
||
diffuseColor.a *= material.transmissionAlpha;
|
||
#endif
|
||
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Wme=`vec3 packNormalToRGB( const in vec3 normal ) {
|
||
return normalize( normal ) * 0.5 + 0.5;
|
||
}
|
||
vec3 unpackRGBToNormal( const in vec3 rgb ) {
|
||
return 2.0 * rgb.xyz - 1.0;
|
||
}
|
||
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
|
||
const float Inv255 = 1. / 255.;
|
||
const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
|
||
const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
|
||
const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
|
||
const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
|
||
vec4 packDepthToRGBA( const in float v ) {
|
||
if( v <= 0.0 )
|
||
return vec4( 0., 0., 0., 0. );
|
||
if( v >= 1.0 )
|
||
return vec4( 1., 1., 1., 1. );
|
||
float vuf;
|
||
float af = modf( v * PackFactors.a, vuf );
|
||
float bf = modf( vuf * ShiftRight8, vuf );
|
||
float gf = modf( vuf * ShiftRight8, vuf );
|
||
return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
|
||
}
|
||
vec3 packDepthToRGB( const in float v ) {
|
||
if( v <= 0.0 )
|
||
return vec3( 0., 0., 0. );
|
||
if( v >= 1.0 )
|
||
return vec3( 1., 1., 1. );
|
||
float vuf;
|
||
float bf = modf( v * PackFactors.b, vuf );
|
||
float gf = modf( vuf * ShiftRight8, vuf );
|
||
return vec3( vuf * Inv255, gf * PackUpscale, bf );
|
||
}
|
||
vec2 packDepthToRG( const in float v ) {
|
||
if( v <= 0.0 )
|
||
return vec2( 0., 0. );
|
||
if( v >= 1.0 )
|
||
return vec2( 1., 1. );
|
||
float vuf;
|
||
float gf = modf( v * 256., vuf );
|
||
return vec2( vuf * Inv255, gf );
|
||
}
|
||
float unpackRGBAToDepth( const in vec4 v ) {
|
||
return dot( v, UnpackFactors4 );
|
||
}
|
||
float unpackRGBToDepth( const in vec3 v ) {
|
||
return dot( v, UnpackFactors3 );
|
||
}
|
||
float unpackRGToDepth( const in vec2 v ) {
|
||
return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
|
||
}
|
||
vec4 pack2HalfToRGBA( const in vec2 v ) {
|
||
vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
|
||
return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
|
||
}
|
||
vec2 unpackRGBATo2Half( const in vec4 v ) {
|
||
return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
|
||
}
|
||
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
|
||
return ( viewZ + near ) / ( near - far );
|
||
}
|
||
float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
|
||
return depth * ( near - far ) - near;
|
||
}
|
||
float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
|
||
return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
|
||
}
|
||
float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
|
||
return ( near * far ) / ( ( far - near ) * depth - far );
|
||
}`,$me=`#ifdef PREMULTIPLIED_ALPHA
|
||
gl_FragColor.rgb *= gl_FragColor.a;
|
||
#endif`,Xme=`vec4 mvPosition = vec4( transformed, 1.0 );
|
||
#ifdef USE_BATCHING
|
||
mvPosition = batchingMatrix * mvPosition;
|
||
#endif
|
||
#ifdef USE_INSTANCING
|
||
mvPosition = instanceMatrix * mvPosition;
|
||
#endif
|
||
mvPosition = modelViewMatrix * mvPosition;
|
||
gl_Position = projectionMatrix * mvPosition;`,qme=`#ifdef DITHERING
|
||
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
|
||
#endif`,Kme=`#ifdef DITHERING
|
||
vec3 dithering( vec3 color ) {
|
||
float grid_position = rand( gl_FragCoord.xy );
|
||
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
|
||
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
|
||
return color + dither_shift_RGB;
|
||
}
|
||
#endif`,Yme=`float roughnessFactor = roughness;
|
||
#ifdef USE_ROUGHNESSMAP
|
||
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
|
||
roughnessFactor *= texelRoughness.g;
|
||
#endif`,Zme=`#ifdef USE_ROUGHNESSMAP
|
||
uniform sampler2D roughnessMap;
|
||
#endif`,Qme=`#if NUM_SPOT_LIGHT_COORDS > 0
|
||
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
|
||
#endif
|
||
#if NUM_SPOT_LIGHT_MAPS > 0
|
||
uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
|
||
#endif
|
||
#ifdef USE_SHADOWMAP
|
||
#if NUM_DIR_LIGHT_SHADOWS > 0
|
||
uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
|
||
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
|
||
struct DirectionalLightShadow {
|
||
float shadowIntensity;
|
||
float shadowBias;
|
||
float shadowNormalBias;
|
||
float shadowRadius;
|
||
vec2 shadowMapSize;
|
||
};
|
||
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
|
||
#endif
|
||
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
||
uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
|
||
struct SpotLightShadow {
|
||
float shadowIntensity;
|
||
float shadowBias;
|
||
float shadowNormalBias;
|
||
float shadowRadius;
|
||
vec2 shadowMapSize;
|
||
};
|
||
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
|
||
#endif
|
||
#if NUM_POINT_LIGHT_SHADOWS > 0
|
||
uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
|
||
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
|
||
struct PointLightShadow {
|
||
float shadowIntensity;
|
||
float shadowBias;
|
||
float shadowNormalBias;
|
||
float shadowRadius;
|
||
vec2 shadowMapSize;
|
||
float shadowCameraNear;
|
||
float shadowCameraFar;
|
||
};
|
||
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
|
||
#endif
|
||
float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
|
||
return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
|
||
}
|
||
vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
|
||
return unpackRGBATo2Half( texture2D( shadow, uv ) );
|
||
}
|
||
float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
|
||
float occlusion = 1.0;
|
||
vec2 distribution = texture2DDistribution( shadow, uv );
|
||
float hard_shadow = step( compare , distribution.x );
|
||
if (hard_shadow != 1.0 ) {
|
||
float distance = compare - distribution.x ;
|
||
float variance = max( 0.00000, distribution.y * distribution.y );
|
||
float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
|
||
}
|
||
return occlusion;
|
||
}
|
||
float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
|
||
float shadow = 1.0;
|
||
shadowCoord.xyz /= shadowCoord.w;
|
||
shadowCoord.z += shadowBias;
|
||
bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
|
||
bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
|
||
if ( frustumTest ) {
|
||
#if defined( SHADOWMAP_TYPE_PCF )
|
||
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
|
||
float dx0 = - texelSize.x * shadowRadius;
|
||
float dy0 = - texelSize.y * shadowRadius;
|
||
float dx1 = + texelSize.x * shadowRadius;
|
||
float dy1 = + texelSize.y * shadowRadius;
|
||
float dx2 = dx0 / 2.0;
|
||
float dy2 = dy0 / 2.0;
|
||
float dx3 = dx1 / 2.0;
|
||
float dy3 = dy1 / 2.0;
|
||
shadow = (
|
||
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
|
||
) * ( 1.0 / 17.0 );
|
||
#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
|
||
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
|
||
float dx = texelSize.x;
|
||
float dy = texelSize.y;
|
||
vec2 uv = shadowCoord.xy;
|
||
vec2 f = fract( uv * shadowMapSize + 0.5 );
|
||
uv -= f * texelSize;
|
||
shadow = (
|
||
texture2DCompare( shadowMap, uv, shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
|
||
mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
|
||
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
|
||
f.x ) +
|
||
mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
|
||
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
|
||
f.x ) +
|
||
mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
|
||
texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
|
||
f.y ) +
|
||
mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
|
||
texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
|
||
f.y ) +
|
||
mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
|
||
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
|
||
f.x ),
|
||
mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
|
||
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
|
||
f.x ),
|
||
f.y )
|
||
) * ( 1.0 / 9.0 );
|
||
#elif defined( SHADOWMAP_TYPE_VSM )
|
||
shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
|
||
#else
|
||
shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
|
||
#endif
|
||
}
|
||
return mix( 1.0, shadow, shadowIntensity );
|
||
}
|
||
vec2 cubeToUV( vec3 v, float texelSizeY ) {
|
||
vec3 absV = abs( v );
|
||
float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
|
||
absV *= scaleToCube;
|
||
v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
|
||
vec2 planar = v.xy;
|
||
float almostATexel = 1.5 * texelSizeY;
|
||
float almostOne = 1.0 - almostATexel;
|
||
if ( absV.z >= almostOne ) {
|
||
if ( v.z > 0.0 )
|
||
planar.x = 4.0 - v.x;
|
||
} else if ( absV.x >= almostOne ) {
|
||
float signX = sign( v.x );
|
||
planar.x = v.z * signX + 2.0 * signX;
|
||
} else if ( absV.y >= almostOne ) {
|
||
float signY = sign( v.y );
|
||
planar.x = v.x + 2.0 * signY + 2.0;
|
||
planar.y = v.z * signY - 2.0;
|
||
}
|
||
return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
|
||
}
|
||
float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
|
||
float shadow = 1.0;
|
||
vec3 lightToPosition = shadowCoord.xyz;
|
||
|
||
float lightToPositionLength = length( lightToPosition );
|
||
if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {
|
||
float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;
|
||
vec3 bd3D = normalize( lightToPosition );
|
||
vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
|
||
#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
|
||
vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
|
||
shadow = (
|
||
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
|
||
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
|
||
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
|
||
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
|
||
texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
|
||
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
|
||
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
|
||
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
|
||
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
|
||
) * ( 1.0 / 9.0 );
|
||
#else
|
||
shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
|
||
#endif
|
||
}
|
||
return mix( 1.0, shadow, shadowIntensity );
|
||
}
|
||
#endif`,Jme=`#if NUM_SPOT_LIGHT_COORDS > 0
|
||
uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
|
||
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
|
||
#endif
|
||
#ifdef USE_SHADOWMAP
|
||
#if NUM_DIR_LIGHT_SHADOWS > 0
|
||
uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
|
||
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
|
||
struct DirectionalLightShadow {
|
||
float shadowIntensity;
|
||
float shadowBias;
|
||
float shadowNormalBias;
|
||
float shadowRadius;
|
||
vec2 shadowMapSize;
|
||
};
|
||
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
|
||
#endif
|
||
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
||
struct SpotLightShadow {
|
||
float shadowIntensity;
|
||
float shadowBias;
|
||
float shadowNormalBias;
|
||
float shadowRadius;
|
||
vec2 shadowMapSize;
|
||
};
|
||
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
|
||
#endif
|
||
#if NUM_POINT_LIGHT_SHADOWS > 0
|
||
uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
|
||
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
|
||
struct PointLightShadow {
|
||
float shadowIntensity;
|
||
float shadowBias;
|
||
float shadowNormalBias;
|
||
float shadowRadius;
|
||
vec2 shadowMapSize;
|
||
float shadowCameraNear;
|
||
float shadowCameraFar;
|
||
};
|
||
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
|
||
#endif
|
||
#endif`,ege=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
|
||
vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
|
||
vec4 shadowWorldPosition;
|
||
#endif
|
||
#if defined( USE_SHADOWMAP )
|
||
#if NUM_DIR_LIGHT_SHADOWS > 0
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
|
||
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
|
||
vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#if NUM_POINT_LIGHT_SHADOWS > 0
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
|
||
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
|
||
vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#endif
|
||
#if NUM_SPOT_LIGHT_COORDS > 0
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
|
||
shadowWorldPosition = worldPosition;
|
||
#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
|
||
shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
|
||
#endif
|
||
vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif`,tge=`float getShadowMask() {
|
||
float shadow = 1.0;
|
||
#ifdef USE_SHADOWMAP
|
||
#if NUM_DIR_LIGHT_SHADOWS > 0
|
||
DirectionalLightShadow directionalLight;
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
|
||
directionalLight = directionalLightShadows[ i ];
|
||
shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
||
SpotLightShadow spotLight;
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
|
||
spotLight = spotLightShadows[ i ];
|
||
shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#if NUM_POINT_LIGHT_SHADOWS > 0
|
||
PointLightShadow pointLight;
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
|
||
pointLight = pointLightShadows[ i ];
|
||
shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#endif
|
||
return shadow;
|
||
}`,nge=`#ifdef USE_SKINNING
|
||
mat4 boneMatX = getBoneMatrix( skinIndex.x );
|
||
mat4 boneMatY = getBoneMatrix( skinIndex.y );
|
||
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
|
||
mat4 boneMatW = getBoneMatrix( skinIndex.w );
|
||
#endif`,rge=`#ifdef USE_SKINNING
|
||
uniform mat4 bindMatrix;
|
||
uniform mat4 bindMatrixInverse;
|
||
uniform highp sampler2D boneTexture;
|
||
mat4 getBoneMatrix( const in float i ) {
|
||
int size = textureSize( boneTexture, 0 ).x;
|
||
int j = int( i ) * 4;
|
||
int x = j % size;
|
||
int y = j / size;
|
||
vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
|
||
vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
|
||
vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
|
||
vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
|
||
return mat4( v1, v2, v3, v4 );
|
||
}
|
||
#endif`,ige=`#ifdef USE_SKINNING
|
||
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
|
||
vec4 skinned = vec4( 0.0 );
|
||
skinned += boneMatX * skinVertex * skinWeight.x;
|
||
skinned += boneMatY * skinVertex * skinWeight.y;
|
||
skinned += boneMatZ * skinVertex * skinWeight.z;
|
||
skinned += boneMatW * skinVertex * skinWeight.w;
|
||
transformed = ( bindMatrixInverse * skinned ).xyz;
|
||
#endif`,sge=`#ifdef USE_SKINNING
|
||
mat4 skinMatrix = mat4( 0.0 );
|
||
skinMatrix += skinWeight.x * boneMatX;
|
||
skinMatrix += skinWeight.y * boneMatY;
|
||
skinMatrix += skinWeight.z * boneMatZ;
|
||
skinMatrix += skinWeight.w * boneMatW;
|
||
skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
|
||
objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
|
||
#ifdef USE_TANGENT
|
||
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
|
||
#endif
|
||
#endif`,oge=`float specularStrength;
|
||
#ifdef USE_SPECULARMAP
|
||
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
|
||
specularStrength = texelSpecular.r;
|
||
#else
|
||
specularStrength = 1.0;
|
||
#endif`,age=`#ifdef USE_SPECULARMAP
|
||
uniform sampler2D specularMap;
|
||
#endif`,lge=`#if defined( TONE_MAPPING )
|
||
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
|
||
#endif`,cge=`#ifndef saturate
|
||
#define saturate( a ) clamp( a, 0.0, 1.0 )
|
||
#endif
|
||
uniform float toneMappingExposure;
|
||
vec3 LinearToneMapping( vec3 color ) {
|
||
return saturate( toneMappingExposure * color );
|
||
}
|
||
vec3 ReinhardToneMapping( vec3 color ) {
|
||
color *= toneMappingExposure;
|
||
return saturate( color / ( vec3( 1.0 ) + color ) );
|
||
}
|
||
vec3 CineonToneMapping( vec3 color ) {
|
||
color *= toneMappingExposure;
|
||
color = max( vec3( 0.0 ), color - 0.004 );
|
||
return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
|
||
}
|
||
vec3 RRTAndODTFit( vec3 v ) {
|
||
vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
|
||
vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
|
||
return a / b;
|
||
}
|
||
vec3 ACESFilmicToneMapping( vec3 color ) {
|
||
const mat3 ACESInputMat = mat3(
|
||
vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
|
||
vec3( 0.04823, 0.01566, 0.83777 )
|
||
);
|
||
const mat3 ACESOutputMat = mat3(
|
||
vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
|
||
vec3( -0.07367, -0.00605, 1.07602 )
|
||
);
|
||
color *= toneMappingExposure / 0.6;
|
||
color = ACESInputMat * color;
|
||
color = RRTAndODTFit( color );
|
||
color = ACESOutputMat * color;
|
||
return saturate( color );
|
||
}
|
||
const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
|
||
vec3( 1.6605, - 0.1246, - 0.0182 ),
|
||
vec3( - 0.5876, 1.1329, - 0.1006 ),
|
||
vec3( - 0.0728, - 0.0083, 1.1187 )
|
||
);
|
||
const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
|
||
vec3( 0.6274, 0.0691, 0.0164 ),
|
||
vec3( 0.3293, 0.9195, 0.0880 ),
|
||
vec3( 0.0433, 0.0113, 0.8956 )
|
||
);
|
||
vec3 agxDefaultContrastApprox( vec3 x ) {
|
||
vec3 x2 = x * x;
|
||
vec3 x4 = x2 * x2;
|
||
return + 15.5 * x4 * x2
|
||
- 40.14 * x4 * x
|
||
+ 31.96 * x4
|
||
- 6.868 * x2 * x
|
||
+ 0.4298 * x2
|
||
+ 0.1191 * x
|
||
- 0.00232;
|
||
}
|
||
vec3 AgXToneMapping( vec3 color ) {
|
||
const mat3 AgXInsetMatrix = mat3(
|
||
vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
|
||
vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
|
||
vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
|
||
);
|
||
const mat3 AgXOutsetMatrix = mat3(
|
||
vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
|
||
vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
|
||
vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
|
||
);
|
||
const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;
|
||
color *= toneMappingExposure;
|
||
color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
|
||
color = AgXInsetMatrix * color;
|
||
color = max( color, 1e-10 ); color = log2( color );
|
||
color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
|
||
color = clamp( color, 0.0, 1.0 );
|
||
color = agxDefaultContrastApprox( color );
|
||
color = AgXOutsetMatrix * color;
|
||
color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
|
||
color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
|
||
color = clamp( color, 0.0, 1.0 );
|
||
return color;
|
||
}
|
||
vec3 NeutralToneMapping( vec3 color ) {
|
||
const float StartCompression = 0.8 - 0.04;
|
||
const float Desaturation = 0.15;
|
||
color *= toneMappingExposure;
|
||
float x = min( color.r, min( color.g, color.b ) );
|
||
float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
|
||
color -= offset;
|
||
float peak = max( color.r, max( color.g, color.b ) );
|
||
if ( peak < StartCompression ) return color;
|
||
float d = 1. - StartCompression;
|
||
float newPeak = 1. - d * d / ( peak + d - StartCompression );
|
||
color *= newPeak / peak;
|
||
float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
|
||
return mix( color, vec3( newPeak ), g );
|
||
}
|
||
vec3 CustomToneMapping( vec3 color ) { return color; }`,uge=`#ifdef USE_TRANSMISSION
|
||
material.transmission = transmission;
|
||
material.transmissionAlpha = 1.0;
|
||
material.thickness = thickness;
|
||
material.attenuationDistance = attenuationDistance;
|
||
material.attenuationColor = attenuationColor;
|
||
#ifdef USE_TRANSMISSIONMAP
|
||
material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
|
||
#endif
|
||
#ifdef USE_THICKNESSMAP
|
||
material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
|
||
#endif
|
||
vec3 pos = vWorldPosition;
|
||
vec3 v = normalize( cameraPosition - pos );
|
||
vec3 n = inverseTransformDirection( normal, viewMatrix );
|
||
vec4 transmitted = getIBLVolumeRefraction(
|
||
n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
|
||
pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
|
||
material.attenuationColor, material.attenuationDistance );
|
||
material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
|
||
totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
|
||
#endif`,dge=`#ifdef USE_TRANSMISSION
|
||
uniform float transmission;
|
||
uniform float thickness;
|
||
uniform float attenuationDistance;
|
||
uniform vec3 attenuationColor;
|
||
#ifdef USE_TRANSMISSIONMAP
|
||
uniform sampler2D transmissionMap;
|
||
#endif
|
||
#ifdef USE_THICKNESSMAP
|
||
uniform sampler2D thicknessMap;
|
||
#endif
|
||
uniform vec2 transmissionSamplerSize;
|
||
uniform sampler2D transmissionSamplerMap;
|
||
uniform mat4 modelMatrix;
|
||
uniform mat4 projectionMatrix;
|
||
varying vec3 vWorldPosition;
|
||
float w0( float a ) {
|
||
return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
|
||
}
|
||
float w1( float a ) {
|
||
return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );
|
||
}
|
||
float w2( float a ){
|
||
return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
|
||
}
|
||
float w3( float a ) {
|
||
return ( 1.0 / 6.0 ) * ( a * a * a );
|
||
}
|
||
float g0( float a ) {
|
||
return w0( a ) + w1( a );
|
||
}
|
||
float g1( float a ) {
|
||
return w2( a ) + w3( a );
|
||
}
|
||
float h0( float a ) {
|
||
return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
|
||
}
|
||
float h1( float a ) {
|
||
return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
|
||
}
|
||
vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
|
||
uv = uv * texelSize.zw + 0.5;
|
||
vec2 iuv = floor( uv );
|
||
vec2 fuv = fract( uv );
|
||
float g0x = g0( fuv.x );
|
||
float g1x = g1( fuv.x );
|
||
float h0x = h0( fuv.x );
|
||
float h1x = h1( fuv.x );
|
||
float h0y = h0( fuv.y );
|
||
float h1y = h1( fuv.y );
|
||
vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
|
||
vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
|
||
vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
|
||
vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
|
||
return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
|
||
g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
|
||
}
|
||
vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
|
||
vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
|
||
vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
|
||
vec2 fLodSizeInv = 1.0 / fLodSize;
|
||
vec2 cLodSizeInv = 1.0 / cLodSize;
|
||
vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
|
||
vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
|
||
return mix( fSample, cSample, fract( lod ) );
|
||
}
|
||
vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
|
||
vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
|
||
vec3 modelScale;
|
||
modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
|
||
modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
|
||
modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
|
||
return normalize( refractionVector ) * thickness * modelScale;
|
||
}
|
||
float applyIorToRoughness( const in float roughness, const in float ior ) {
|
||
return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
|
||
}
|
||
vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
|
||
float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
|
||
return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
|
||
}
|
||
vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
|
||
if ( isinf( attenuationDistance ) ) {
|
||
return vec3( 1.0 );
|
||
} else {
|
||
vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
|
||
vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;
|
||
}
|
||
}
|
||
vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
|
||
const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
|
||
const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
|
||
const in vec3 attenuationColor, const in float attenuationDistance ) {
|
||
vec4 transmittedLight;
|
||
vec3 transmittance;
|
||
#ifdef USE_DISPERSION
|
||
float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
|
||
vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
|
||
for ( int i = 0; i < 3; i ++ ) {
|
||
vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
|
||
vec3 refractedRayExit = position + transmissionRay;
|
||
|
||
vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
|
||
vec2 refractionCoords = ndcPos.xy / ndcPos.w;
|
||
refractionCoords += 1.0;
|
||
refractionCoords /= 2.0;
|
||
|
||
vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
|
||
transmittedLight[ i ] = transmissionSample[ i ];
|
||
transmittedLight.a += transmissionSample.a;
|
||
transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
|
||
}
|
||
transmittedLight.a /= 3.0;
|
||
|
||
#else
|
||
|
||
vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
|
||
vec3 refractedRayExit = position + transmissionRay;
|
||
vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
|
||
vec2 refractionCoords = ndcPos.xy / ndcPos.w;
|
||
refractionCoords += 1.0;
|
||
refractionCoords /= 2.0;
|
||
transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
|
||
transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
|
||
|
||
#endif
|
||
vec3 attenuatedColor = transmittance * transmittedLight.rgb;
|
||
vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
|
||
float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
|
||
return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
|
||
}
|
||
#endif`,fge=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
||
varying vec2 vUv;
|
||
#endif
|
||
#ifdef USE_MAP
|
||
varying vec2 vMapUv;
|
||
#endif
|
||
#ifdef USE_ALPHAMAP
|
||
varying vec2 vAlphaMapUv;
|
||
#endif
|
||
#ifdef USE_LIGHTMAP
|
||
varying vec2 vLightMapUv;
|
||
#endif
|
||
#ifdef USE_AOMAP
|
||
varying vec2 vAoMapUv;
|
||
#endif
|
||
#ifdef USE_BUMPMAP
|
||
varying vec2 vBumpMapUv;
|
||
#endif
|
||
#ifdef USE_NORMALMAP
|
||
varying vec2 vNormalMapUv;
|
||
#endif
|
||
#ifdef USE_EMISSIVEMAP
|
||
varying vec2 vEmissiveMapUv;
|
||
#endif
|
||
#ifdef USE_METALNESSMAP
|
||
varying vec2 vMetalnessMapUv;
|
||
#endif
|
||
#ifdef USE_ROUGHNESSMAP
|
||
varying vec2 vRoughnessMapUv;
|
||
#endif
|
||
#ifdef USE_ANISOTROPYMAP
|
||
varying vec2 vAnisotropyMapUv;
|
||
#endif
|
||
#ifdef USE_CLEARCOATMAP
|
||
varying vec2 vClearcoatMapUv;
|
||
#endif
|
||
#ifdef USE_CLEARCOAT_NORMALMAP
|
||
varying vec2 vClearcoatNormalMapUv;
|
||
#endif
|
||
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
||
varying vec2 vClearcoatRoughnessMapUv;
|
||
#endif
|
||
#ifdef USE_IRIDESCENCEMAP
|
||
varying vec2 vIridescenceMapUv;
|
||
#endif
|
||
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
||
varying vec2 vIridescenceThicknessMapUv;
|
||
#endif
|
||
#ifdef USE_SHEEN_COLORMAP
|
||
varying vec2 vSheenColorMapUv;
|
||
#endif
|
||
#ifdef USE_SHEEN_ROUGHNESSMAP
|
||
varying vec2 vSheenRoughnessMapUv;
|
||
#endif
|
||
#ifdef USE_SPECULARMAP
|
||
varying vec2 vSpecularMapUv;
|
||
#endif
|
||
#ifdef USE_SPECULAR_COLORMAP
|
||
varying vec2 vSpecularColorMapUv;
|
||
#endif
|
||
#ifdef USE_SPECULAR_INTENSITYMAP
|
||
varying vec2 vSpecularIntensityMapUv;
|
||
#endif
|
||
#ifdef USE_TRANSMISSIONMAP
|
||
uniform mat3 transmissionMapTransform;
|
||
varying vec2 vTransmissionMapUv;
|
||
#endif
|
||
#ifdef USE_THICKNESSMAP
|
||
uniform mat3 thicknessMapTransform;
|
||
varying vec2 vThicknessMapUv;
|
||
#endif`,hge=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
||
varying vec2 vUv;
|
||
#endif
|
||
#ifdef USE_MAP
|
||
uniform mat3 mapTransform;
|
||
varying vec2 vMapUv;
|
||
#endif
|
||
#ifdef USE_ALPHAMAP
|
||
uniform mat3 alphaMapTransform;
|
||
varying vec2 vAlphaMapUv;
|
||
#endif
|
||
#ifdef USE_LIGHTMAP
|
||
uniform mat3 lightMapTransform;
|
||
varying vec2 vLightMapUv;
|
||
#endif
|
||
#ifdef USE_AOMAP
|
||
uniform mat3 aoMapTransform;
|
||
varying vec2 vAoMapUv;
|
||
#endif
|
||
#ifdef USE_BUMPMAP
|
||
uniform mat3 bumpMapTransform;
|
||
varying vec2 vBumpMapUv;
|
||
#endif
|
||
#ifdef USE_NORMALMAP
|
||
uniform mat3 normalMapTransform;
|
||
varying vec2 vNormalMapUv;
|
||
#endif
|
||
#ifdef USE_DISPLACEMENTMAP
|
||
uniform mat3 displacementMapTransform;
|
||
varying vec2 vDisplacementMapUv;
|
||
#endif
|
||
#ifdef USE_EMISSIVEMAP
|
||
uniform mat3 emissiveMapTransform;
|
||
varying vec2 vEmissiveMapUv;
|
||
#endif
|
||
#ifdef USE_METALNESSMAP
|
||
uniform mat3 metalnessMapTransform;
|
||
varying vec2 vMetalnessMapUv;
|
||
#endif
|
||
#ifdef USE_ROUGHNESSMAP
|
||
uniform mat3 roughnessMapTransform;
|
||
varying vec2 vRoughnessMapUv;
|
||
#endif
|
||
#ifdef USE_ANISOTROPYMAP
|
||
uniform mat3 anisotropyMapTransform;
|
||
varying vec2 vAnisotropyMapUv;
|
||
#endif
|
||
#ifdef USE_CLEARCOATMAP
|
||
uniform mat3 clearcoatMapTransform;
|
||
varying vec2 vClearcoatMapUv;
|
||
#endif
|
||
#ifdef USE_CLEARCOAT_NORMALMAP
|
||
uniform mat3 clearcoatNormalMapTransform;
|
||
varying vec2 vClearcoatNormalMapUv;
|
||
#endif
|
||
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
||
uniform mat3 clearcoatRoughnessMapTransform;
|
||
varying vec2 vClearcoatRoughnessMapUv;
|
||
#endif
|
||
#ifdef USE_SHEEN_COLORMAP
|
||
uniform mat3 sheenColorMapTransform;
|
||
varying vec2 vSheenColorMapUv;
|
||
#endif
|
||
#ifdef USE_SHEEN_ROUGHNESSMAP
|
||
uniform mat3 sheenRoughnessMapTransform;
|
||
varying vec2 vSheenRoughnessMapUv;
|
||
#endif
|
||
#ifdef USE_IRIDESCENCEMAP
|
||
uniform mat3 iridescenceMapTransform;
|
||
varying vec2 vIridescenceMapUv;
|
||
#endif
|
||
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
||
uniform mat3 iridescenceThicknessMapTransform;
|
||
varying vec2 vIridescenceThicknessMapUv;
|
||
#endif
|
||
#ifdef USE_SPECULARMAP
|
||
uniform mat3 specularMapTransform;
|
||
varying vec2 vSpecularMapUv;
|
||
#endif
|
||
#ifdef USE_SPECULAR_COLORMAP
|
||
uniform mat3 specularColorMapTransform;
|
||
varying vec2 vSpecularColorMapUv;
|
||
#endif
|
||
#ifdef USE_SPECULAR_INTENSITYMAP
|
||
uniform mat3 specularIntensityMapTransform;
|
||
varying vec2 vSpecularIntensityMapUv;
|
||
#endif
|
||
#ifdef USE_TRANSMISSIONMAP
|
||
uniform mat3 transmissionMapTransform;
|
||
varying vec2 vTransmissionMapUv;
|
||
#endif
|
||
#ifdef USE_THICKNESSMAP
|
||
uniform mat3 thicknessMapTransform;
|
||
varying vec2 vThicknessMapUv;
|
||
#endif`,pge=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
||
vUv = vec3( uv, 1 ).xy;
|
||
#endif
|
||
#ifdef USE_MAP
|
||
vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_ALPHAMAP
|
||
vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_LIGHTMAP
|
||
vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_AOMAP
|
||
vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_BUMPMAP
|
||
vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_NORMALMAP
|
||
vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_DISPLACEMENTMAP
|
||
vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_EMISSIVEMAP
|
||
vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_METALNESSMAP
|
||
vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_ROUGHNESSMAP
|
||
vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_ANISOTROPYMAP
|
||
vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_CLEARCOATMAP
|
||
vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_CLEARCOAT_NORMALMAP
|
||
vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
||
vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_IRIDESCENCEMAP
|
||
vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
||
vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_SHEEN_COLORMAP
|
||
vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_SHEEN_ROUGHNESSMAP
|
||
vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_SPECULARMAP
|
||
vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_SPECULAR_COLORMAP
|
||
vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_SPECULAR_INTENSITYMAP
|
||
vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_TRANSMISSIONMAP
|
||
vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_THICKNESSMAP
|
||
vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
|
||
#endif`,mge=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
|
||
vec4 worldPosition = vec4( transformed, 1.0 );
|
||
#ifdef USE_BATCHING
|
||
worldPosition = batchingMatrix * worldPosition;
|
||
#endif
|
||
#ifdef USE_INSTANCING
|
||
worldPosition = instanceMatrix * worldPosition;
|
||
#endif
|
||
worldPosition = modelMatrix * worldPosition;
|
||
#endif`;const gge=`varying vec2 vUv;
|
||
uniform mat3 uvTransform;
|
||
void main() {
|
||
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
||
gl_Position = vec4( position.xy, 1.0, 1.0 );
|
||
}`,vge=`uniform sampler2D t2D;
|
||
uniform float backgroundIntensity;
|
||
varying vec2 vUv;
|
||
void main() {
|
||
vec4 texColor = texture2D( t2D, vUv );
|
||
#ifdef DECODE_VIDEO_TEXTURE
|
||
texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
|
||
#endif
|
||
texColor.rgb *= backgroundIntensity;
|
||
gl_FragColor = texColor;
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
}`,yge=`varying vec3 vWorldDirection;
|
||
#include <common>
|
||
void main() {
|
||
vWorldDirection = transformDirection( position, modelMatrix );
|
||
#include <begin_vertex>
|
||
#include <project_vertex>
|
||
gl_Position.z = gl_Position.w;
|
||
}`,xge=`#ifdef ENVMAP_TYPE_CUBE
|
||
uniform samplerCube envMap;
|
||
#elif defined( ENVMAP_TYPE_CUBE_UV )
|
||
uniform sampler2D envMap;
|
||
#endif
|
||
uniform float flipEnvMap;
|
||
uniform float backgroundBlurriness;
|
||
uniform float backgroundIntensity;
|
||
uniform mat3 backgroundRotation;
|
||
varying vec3 vWorldDirection;
|
||
#include <cube_uv_reflection_fragment>
|
||
void main() {
|
||
#ifdef ENVMAP_TYPE_CUBE
|
||
vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
|
||
#elif defined( ENVMAP_TYPE_CUBE_UV )
|
||
vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
|
||
#else
|
||
vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
|
||
#endif
|
||
texColor.rgb *= backgroundIntensity;
|
||
gl_FragColor = texColor;
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
}`,bge=`varying vec3 vWorldDirection;
|
||
#include <common>
|
||
void main() {
|
||
vWorldDirection = transformDirection( position, modelMatrix );
|
||
#include <begin_vertex>
|
||
#include <project_vertex>
|
||
gl_Position.z = gl_Position.w;
|
||
}`,_ge=`uniform samplerCube tCube;
|
||
uniform float tFlip;
|
||
uniform float opacity;
|
||
varying vec3 vWorldDirection;
|
||
void main() {
|
||
vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
|
||
gl_FragColor = texColor;
|
||
gl_FragColor.a *= opacity;
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
}`,wge=`#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <uv_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
varying vec2 vHighPrecisionZW;
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <batching_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <morphinstance_vertex>
|
||
#ifdef USE_DISPLACEMENTMAP
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinnormal_vertex>
|
||
#endif
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
vHighPrecisionZW = gl_Position.zw;
|
||
}`,Sge=`#if DEPTH_PACKING == 3200
|
||
uniform float opacity;
|
||
#endif
|
||
#include <common>
|
||
#include <packing>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
varying vec2 vHighPrecisionZW;
|
||
void main() {
|
||
vec4 diffuseColor = vec4( 1.0 );
|
||
#include <clipping_planes_fragment>
|
||
#if DEPTH_PACKING == 3200
|
||
diffuseColor.a = opacity;
|
||
#endif
|
||
#include <map_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
#include <logdepthbuf_fragment>
|
||
float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
|
||
#if DEPTH_PACKING == 3200
|
||
gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
|
||
#elif DEPTH_PACKING == 3201
|
||
gl_FragColor = packDepthToRGBA( fragCoordZ );
|
||
#elif DEPTH_PACKING == 3202
|
||
gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
|
||
#elif DEPTH_PACKING == 3203
|
||
gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
|
||
#endif
|
||
}`,Mge=`#define DISTANCE
|
||
varying vec3 vWorldPosition;
|
||
#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <uv_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <batching_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <morphinstance_vertex>
|
||
#ifdef USE_DISPLACEMENTMAP
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinnormal_vertex>
|
||
#endif
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <worldpos_vertex>
|
||
#include <clipping_planes_vertex>
|
||
vWorldPosition = worldPosition.xyz;
|
||
}`,Ege=`#define DISTANCE
|
||
uniform vec3 referencePosition;
|
||
uniform float nearDistance;
|
||
uniform float farDistance;
|
||
varying vec3 vWorldPosition;
|
||
#include <common>
|
||
#include <packing>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main () {
|
||
vec4 diffuseColor = vec4( 1.0 );
|
||
#include <clipping_planes_fragment>
|
||
#include <map_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
float dist = length( vWorldPosition - referencePosition );
|
||
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
|
||
dist = saturate( dist );
|
||
gl_FragColor = packDepthToRGBA( dist );
|
||
}`,Age=`varying vec3 vWorldDirection;
|
||
#include <common>
|
||
void main() {
|
||
vWorldDirection = transformDirection( position, modelMatrix );
|
||
#include <begin_vertex>
|
||
#include <project_vertex>
|
||
}`,Tge=`uniform sampler2D tEquirect;
|
||
varying vec3 vWorldDirection;
|
||
#include <common>
|
||
void main() {
|
||
vec3 direction = normalize( vWorldDirection );
|
||
vec2 sampleUV = equirectUv( direction );
|
||
gl_FragColor = texture2D( tEquirect, sampleUV );
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
}`,Cge=`uniform float scale;
|
||
attribute float lineDistance;
|
||
varying float vLineDistance;
|
||
#include <common>
|
||
#include <uv_pars_vertex>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
vLineDistance = scale * lineDistance;
|
||
#include <uv_vertex>
|
||
#include <color_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
#include <fog_vertex>
|
||
}`,Pge=`uniform vec3 diffuse;
|
||
uniform float opacity;
|
||
uniform float dashSize;
|
||
uniform float totalSize;
|
||
varying float vLineDistance;
|
||
#include <common>
|
||
#include <color_pars_fragment>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <clipping_planes_fragment>
|
||
if ( mod( vLineDistance, totalSize ) > dashSize ) {
|
||
discard;
|
||
}
|
||
vec3 outgoingLight = vec3( 0.0 );
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <color_fragment>
|
||
outgoingLight = diffuseColor.rgb;
|
||
#include <opaque_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
}`,Rge=`#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <uv_pars_vertex>
|
||
#include <envmap_pars_vertex>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <color_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <batching_vertex>
|
||
#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#endif
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
#include <worldpos_vertex>
|
||
#include <envmap_vertex>
|
||
#include <fog_vertex>
|
||
}`,Nge=`uniform vec3 diffuse;
|
||
uniform float opacity;
|
||
#ifndef FLAT_SHADED
|
||
varying vec3 vNormal;
|
||
#endif
|
||
#include <common>
|
||
#include <dithering_pars_fragment>
|
||
#include <color_pars_fragment>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <aomap_pars_fragment>
|
||
#include <lightmap_pars_fragment>
|
||
#include <envmap_common_pars_fragment>
|
||
#include <envmap_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <specularmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <clipping_planes_fragment>
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <color_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
#include <specularmap_fragment>
|
||
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
||
#ifdef USE_LIGHTMAP
|
||
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
|
||
reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
|
||
#else
|
||
reflectedLight.indirectDiffuse += vec3( 1.0 );
|
||
#endif
|
||
#include <aomap_fragment>
|
||
reflectedLight.indirectDiffuse *= diffuseColor.rgb;
|
||
vec3 outgoingLight = reflectedLight.indirectDiffuse;
|
||
#include <envmap_fragment>
|
||
#include <opaque_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
#include <dithering_fragment>
|
||
}`,Ige=`#define LAMBERT
|
||
varying vec3 vViewPosition;
|
||
#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <uv_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <envmap_pars_vertex>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <normal_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <shadowmap_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <color_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <batching_vertex>
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#include <normal_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
vViewPosition = - mvPosition.xyz;
|
||
#include <worldpos_vertex>
|
||
#include <envmap_vertex>
|
||
#include <shadowmap_vertex>
|
||
#include <fog_vertex>
|
||
}`,kge=`#define LAMBERT
|
||
uniform vec3 diffuse;
|
||
uniform vec3 emissive;
|
||
uniform float opacity;
|
||
#include <common>
|
||
#include <packing>
|
||
#include <dithering_pars_fragment>
|
||
#include <color_pars_fragment>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <aomap_pars_fragment>
|
||
#include <lightmap_pars_fragment>
|
||
#include <emissivemap_pars_fragment>
|
||
#include <envmap_common_pars_fragment>
|
||
#include <envmap_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <bsdfs>
|
||
#include <lights_pars_begin>
|
||
#include <normal_pars_fragment>
|
||
#include <lights_lambert_pars_fragment>
|
||
#include <shadowmap_pars_fragment>
|
||
#include <bumpmap_pars_fragment>
|
||
#include <normalmap_pars_fragment>
|
||
#include <specularmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <clipping_planes_fragment>
|
||
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
||
vec3 totalEmissiveRadiance = emissive;
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <color_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
#include <specularmap_fragment>
|
||
#include <normal_fragment_begin>
|
||
#include <normal_fragment_maps>
|
||
#include <emissivemap_fragment>
|
||
#include <lights_lambert_fragment>
|
||
#include <lights_fragment_begin>
|
||
#include <lights_fragment_maps>
|
||
#include <lights_fragment_end>
|
||
#include <aomap_fragment>
|
||
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
|
||
#include <envmap_fragment>
|
||
#include <opaque_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
#include <dithering_fragment>
|
||
}`,Oge=`#define MATCAP
|
||
varying vec3 vViewPosition;
|
||
#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <uv_pars_vertex>
|
||
#include <color_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <normal_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <color_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <batching_vertex>
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#include <normal_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
#include <fog_vertex>
|
||
vViewPosition = - mvPosition.xyz;
|
||
}`,Lge=`#define MATCAP
|
||
uniform vec3 diffuse;
|
||
uniform float opacity;
|
||
uniform sampler2D matcap;
|
||
varying vec3 vViewPosition;
|
||
#include <common>
|
||
#include <dithering_pars_fragment>
|
||
#include <color_pars_fragment>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <normal_pars_fragment>
|
||
#include <bumpmap_pars_fragment>
|
||
#include <normalmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <clipping_planes_fragment>
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <color_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
#include <normal_fragment_begin>
|
||
#include <normal_fragment_maps>
|
||
vec3 viewDir = normalize( vViewPosition );
|
||
vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
|
||
vec3 y = cross( viewDir, x );
|
||
vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
|
||
#ifdef USE_MATCAP
|
||
vec4 matcapColor = texture2D( matcap, uv );
|
||
#else
|
||
vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
|
||
#endif
|
||
vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
|
||
#include <opaque_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
#include <dithering_fragment>
|
||
}`,Dge=`#define NORMAL
|
||
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
||
varying vec3 vViewPosition;
|
||
#endif
|
||
#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <uv_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <normal_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <batching_vertex>
|
||
#include <beginnormal_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#include <normal_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
||
vViewPosition = - mvPosition.xyz;
|
||
#endif
|
||
}`,Uge=`#define NORMAL
|
||
uniform float opacity;
|
||
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
||
varying vec3 vViewPosition;
|
||
#endif
|
||
#include <packing>
|
||
#include <uv_pars_fragment>
|
||
#include <normal_pars_fragment>
|
||
#include <bumpmap_pars_fragment>
|
||
#include <normalmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
|
||
#include <clipping_planes_fragment>
|
||
#include <logdepthbuf_fragment>
|
||
#include <normal_fragment_begin>
|
||
#include <normal_fragment_maps>
|
||
gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
|
||
#ifdef OPAQUE
|
||
gl_FragColor.a = 1.0;
|
||
#endif
|
||
}`,jge=`#define PHONG
|
||
varying vec3 vViewPosition;
|
||
#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <uv_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <envmap_pars_vertex>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <normal_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <shadowmap_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <color_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <batching_vertex>
|
||
#include <beginnormal_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#include <normal_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
vViewPosition = - mvPosition.xyz;
|
||
#include <worldpos_vertex>
|
||
#include <envmap_vertex>
|
||
#include <shadowmap_vertex>
|
||
#include <fog_vertex>
|
||
}`,Fge=`#define PHONG
|
||
uniform vec3 diffuse;
|
||
uniform vec3 emissive;
|
||
uniform vec3 specular;
|
||
uniform float shininess;
|
||
uniform float opacity;
|
||
#include <common>
|
||
#include <packing>
|
||
#include <dithering_pars_fragment>
|
||
#include <color_pars_fragment>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <aomap_pars_fragment>
|
||
#include <lightmap_pars_fragment>
|
||
#include <emissivemap_pars_fragment>
|
||
#include <envmap_common_pars_fragment>
|
||
#include <envmap_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <bsdfs>
|
||
#include <lights_pars_begin>
|
||
#include <normal_pars_fragment>
|
||
#include <lights_phong_pars_fragment>
|
||
#include <shadowmap_pars_fragment>
|
||
#include <bumpmap_pars_fragment>
|
||
#include <normalmap_pars_fragment>
|
||
#include <specularmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <clipping_planes_fragment>
|
||
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
||
vec3 totalEmissiveRadiance = emissive;
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <color_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
#include <specularmap_fragment>
|
||
#include <normal_fragment_begin>
|
||
#include <normal_fragment_maps>
|
||
#include <emissivemap_fragment>
|
||
#include <lights_phong_fragment>
|
||
#include <lights_fragment_begin>
|
||
#include <lights_fragment_maps>
|
||
#include <lights_fragment_end>
|
||
#include <aomap_fragment>
|
||
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
|
||
#include <envmap_fragment>
|
||
#include <opaque_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
#include <dithering_fragment>
|
||
}`,zge=`#define STANDARD
|
||
varying vec3 vViewPosition;
|
||
#ifdef USE_TRANSMISSION
|
||
varying vec3 vWorldPosition;
|
||
#endif
|
||
#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <uv_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <normal_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <shadowmap_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <color_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <batching_vertex>
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#include <normal_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
vViewPosition = - mvPosition.xyz;
|
||
#include <worldpos_vertex>
|
||
#include <shadowmap_vertex>
|
||
#include <fog_vertex>
|
||
#ifdef USE_TRANSMISSION
|
||
vWorldPosition = worldPosition.xyz;
|
||
#endif
|
||
}`,Bge=`#define STANDARD
|
||
#ifdef PHYSICAL
|
||
#define IOR
|
||
#define USE_SPECULAR
|
||
#endif
|
||
uniform vec3 diffuse;
|
||
uniform vec3 emissive;
|
||
uniform float roughness;
|
||
uniform float metalness;
|
||
uniform float opacity;
|
||
#ifdef IOR
|
||
uniform float ior;
|
||
#endif
|
||
#ifdef USE_SPECULAR
|
||
uniform float specularIntensity;
|
||
uniform vec3 specularColor;
|
||
#ifdef USE_SPECULAR_COLORMAP
|
||
uniform sampler2D specularColorMap;
|
||
#endif
|
||
#ifdef USE_SPECULAR_INTENSITYMAP
|
||
uniform sampler2D specularIntensityMap;
|
||
#endif
|
||
#endif
|
||
#ifdef USE_CLEARCOAT
|
||
uniform float clearcoat;
|
||
uniform float clearcoatRoughness;
|
||
#endif
|
||
#ifdef USE_DISPERSION
|
||
uniform float dispersion;
|
||
#endif
|
||
#ifdef USE_IRIDESCENCE
|
||
uniform float iridescence;
|
||
uniform float iridescenceIOR;
|
||
uniform float iridescenceThicknessMinimum;
|
||
uniform float iridescenceThicknessMaximum;
|
||
#endif
|
||
#ifdef USE_SHEEN
|
||
uniform vec3 sheenColor;
|
||
uniform float sheenRoughness;
|
||
#ifdef USE_SHEEN_COLORMAP
|
||
uniform sampler2D sheenColorMap;
|
||
#endif
|
||
#ifdef USE_SHEEN_ROUGHNESSMAP
|
||
uniform sampler2D sheenRoughnessMap;
|
||
#endif
|
||
#endif
|
||
#ifdef USE_ANISOTROPY
|
||
uniform vec2 anisotropyVector;
|
||
#ifdef USE_ANISOTROPYMAP
|
||
uniform sampler2D anisotropyMap;
|
||
#endif
|
||
#endif
|
||
varying vec3 vViewPosition;
|
||
#include <common>
|
||
#include <packing>
|
||
#include <dithering_pars_fragment>
|
||
#include <color_pars_fragment>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <aomap_pars_fragment>
|
||
#include <lightmap_pars_fragment>
|
||
#include <emissivemap_pars_fragment>
|
||
#include <iridescence_fragment>
|
||
#include <cube_uv_reflection_fragment>
|
||
#include <envmap_common_pars_fragment>
|
||
#include <envmap_physical_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <lights_pars_begin>
|
||
#include <normal_pars_fragment>
|
||
#include <lights_physical_pars_fragment>
|
||
#include <transmission_pars_fragment>
|
||
#include <shadowmap_pars_fragment>
|
||
#include <bumpmap_pars_fragment>
|
||
#include <normalmap_pars_fragment>
|
||
#include <clearcoat_pars_fragment>
|
||
#include <iridescence_pars_fragment>
|
||
#include <roughnessmap_pars_fragment>
|
||
#include <metalnessmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <clipping_planes_fragment>
|
||
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
||
vec3 totalEmissiveRadiance = emissive;
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <color_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
#include <roughnessmap_fragment>
|
||
#include <metalnessmap_fragment>
|
||
#include <normal_fragment_begin>
|
||
#include <normal_fragment_maps>
|
||
#include <clearcoat_normal_fragment_begin>
|
||
#include <clearcoat_normal_fragment_maps>
|
||
#include <emissivemap_fragment>
|
||
#include <lights_physical_fragment>
|
||
#include <lights_fragment_begin>
|
||
#include <lights_fragment_maps>
|
||
#include <lights_fragment_end>
|
||
#include <aomap_fragment>
|
||
vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
|
||
vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
|
||
#include <transmission_fragment>
|
||
vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
|
||
#ifdef USE_SHEEN
|
||
float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
|
||
outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
|
||
#endif
|
||
#ifdef USE_CLEARCOAT
|
||
float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
|
||
vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
|
||
outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
|
||
#endif
|
||
#include <opaque_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
#include <dithering_fragment>
|
||
}`,Hge=`#define TOON
|
||
varying vec3 vViewPosition;
|
||
#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <uv_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <normal_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <shadowmap_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <color_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <batching_vertex>
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#include <normal_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
vViewPosition = - mvPosition.xyz;
|
||
#include <worldpos_vertex>
|
||
#include <shadowmap_vertex>
|
||
#include <fog_vertex>
|
||
}`,Vge=`#define TOON
|
||
uniform vec3 diffuse;
|
||
uniform vec3 emissive;
|
||
uniform float opacity;
|
||
#include <common>
|
||
#include <packing>
|
||
#include <dithering_pars_fragment>
|
||
#include <color_pars_fragment>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <aomap_pars_fragment>
|
||
#include <lightmap_pars_fragment>
|
||
#include <emissivemap_pars_fragment>
|
||
#include <gradientmap_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <bsdfs>
|
||
#include <lights_pars_begin>
|
||
#include <normal_pars_fragment>
|
||
#include <lights_toon_pars_fragment>
|
||
#include <shadowmap_pars_fragment>
|
||
#include <bumpmap_pars_fragment>
|
||
#include <normalmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <clipping_planes_fragment>
|
||
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
||
vec3 totalEmissiveRadiance = emissive;
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <color_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
#include <normal_fragment_begin>
|
||
#include <normal_fragment_maps>
|
||
#include <emissivemap_fragment>
|
||
#include <lights_toon_fragment>
|
||
#include <lights_fragment_begin>
|
||
#include <lights_fragment_maps>
|
||
#include <lights_fragment_end>
|
||
#include <aomap_fragment>
|
||
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
|
||
#include <opaque_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
#include <dithering_fragment>
|
||
}`,Gge=`uniform float size;
|
||
uniform float scale;
|
||
#include <common>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
#ifdef USE_POINTS_UV
|
||
varying vec2 vUv;
|
||
uniform mat3 uvTransform;
|
||
#endif
|
||
void main() {
|
||
#ifdef USE_POINTS_UV
|
||
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
||
#endif
|
||
#include <color_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <project_vertex>
|
||
gl_PointSize = size;
|
||
#ifdef USE_SIZEATTENUATION
|
||
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
|
||
if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
|
||
#endif
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
#include <worldpos_vertex>
|
||
#include <fog_vertex>
|
||
}`,Wge=`uniform vec3 diffuse;
|
||
uniform float opacity;
|
||
#include <common>
|
||
#include <color_pars_fragment>
|
||
#include <map_particle_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <clipping_planes_fragment>
|
||
vec3 outgoingLight = vec3( 0.0 );
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_particle_fragment>
|
||
#include <color_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
outgoingLight = diffuseColor.rgb;
|
||
#include <opaque_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
}`,$ge=`#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <shadowmap_pars_vertex>
|
||
void main() {
|
||
#include <batching_vertex>
|
||
#include <beginnormal_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <worldpos_vertex>
|
||
#include <shadowmap_vertex>
|
||
#include <fog_vertex>
|
||
}`,Xge=`uniform vec3 color;
|
||
uniform float opacity;
|
||
#include <common>
|
||
#include <packing>
|
||
#include <fog_pars_fragment>
|
||
#include <bsdfs>
|
||
#include <lights_pars_begin>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <shadowmap_pars_fragment>
|
||
#include <shadowmask_pars_fragment>
|
||
void main() {
|
||
#include <logdepthbuf_fragment>
|
||
gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
}`,qge=`uniform float rotation;
|
||
uniform vec2 center;
|
||
#include <common>
|
||
#include <uv_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
vec4 mvPosition = modelViewMatrix[ 3 ];
|
||
vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
|
||
#ifndef USE_SIZEATTENUATION
|
||
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
|
||
if ( isPerspective ) scale *= - mvPosition.z;
|
||
#endif
|
||
vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
|
||
vec2 rotatedPosition;
|
||
rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
|
||
rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
|
||
mvPosition.xy += rotatedPosition;
|
||
gl_Position = projectionMatrix * mvPosition;
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
#include <fog_vertex>
|
||
}`,Kge=`uniform vec3 diffuse;
|
||
uniform float opacity;
|
||
#include <common>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <clipping_planes_fragment>
|
||
vec3 outgoingLight = vec3( 0.0 );
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
outgoingLight = diffuseColor.rgb;
|
||
#include <opaque_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
}`,hn={alphahash_fragment:vpe,alphahash_pars_fragment:ype,alphamap_fragment:xpe,alphamap_pars_fragment:bpe,alphatest_fragment:_pe,alphatest_pars_fragment:wpe,aomap_fragment:Spe,aomap_pars_fragment:Mpe,batching_pars_vertex:Epe,batching_vertex:Ape,begin_vertex:Tpe,beginnormal_vertex:Cpe,bsdfs:Ppe,iridescence_fragment:Rpe,bumpmap_pars_fragment:Npe,clipping_planes_fragment:Ipe,clipping_planes_pars_fragment:kpe,clipping_planes_pars_vertex:Ope,clipping_planes_vertex:Lpe,color_fragment:Dpe,color_pars_fragment:Upe,color_pars_vertex:jpe,color_vertex:Fpe,common:zpe,cube_uv_reflection_fragment:Bpe,defaultnormal_vertex:Hpe,displacementmap_pars_vertex:Vpe,displacementmap_vertex:Gpe,emissivemap_fragment:Wpe,emissivemap_pars_fragment:$pe,colorspace_fragment:Xpe,colorspace_pars_fragment:qpe,envmap_fragment:Kpe,envmap_common_pars_fragment:Ype,envmap_pars_fragment:Zpe,envmap_pars_vertex:Qpe,envmap_physical_pars_fragment:cme,envmap_vertex:Jpe,fog_vertex:eme,fog_pars_vertex:tme,fog_fragment:nme,fog_pars_fragment:rme,gradientmap_pars_fragment:ime,lightmap_pars_fragment:sme,lights_lambert_fragment:ome,lights_lambert_pars_fragment:ame,lights_pars_begin:lme,lights_toon_fragment:ume,lights_toon_pars_fragment:dme,lights_phong_fragment:fme,lights_phong_pars_fragment:hme,lights_physical_fragment:pme,lights_physical_pars_fragment:mme,lights_fragment_begin:gme,lights_fragment_maps:vme,lights_fragment_end:yme,logdepthbuf_fragment:xme,logdepthbuf_pars_fragment:bme,logdepthbuf_pars_vertex:_me,logdepthbuf_vertex:wme,map_fragment:Sme,map_pars_fragment:Mme,map_particle_fragment:Eme,map_particle_pars_fragment:Ame,metalnessmap_fragment:Tme,metalnessmap_pars_fragment:Cme,morphinstance_vertex:Pme,morphcolor_vertex:Rme,morphnormal_vertex:Nme,morphtarget_pars_vertex:Ime,morphtarget_vertex:kme,normal_fragment_begin:Ome,normal_fragment_maps:Lme,normal_pars_fragment:Dme,normal_pars_vertex:Ume,normal_vertex:jme,normalmap_pars_fragment:Fme,clearcoat_normal_fragment_begin:zme,clearcoat_normal_fragment_maps:Bme,clearcoat_pars_fragment:Hme,iridescence_pars_fragment:Vme,opaque_fragment:Gme,packing:Wme,premultiplied_alpha_fragment:$me,project_vertex:Xme,dithering_fragment:qme,dithering_pars_fragment:Kme,roughnessmap_fragment:Yme,roughnessmap_pars_fragment:Zme,shadowmap_pars_fragment:Qme,shadowmap_pars_vertex:Jme,shadowmap_vertex:ege,shadowmask_pars_fragment:tge,skinbase_vertex:nge,skinning_pars_vertex:rge,skinning_vertex:ige,skinnormal_vertex:sge,specularmap_fragment:oge,specularmap_pars_fragment:age,tonemapping_fragment:lge,tonemapping_pars_fragment:cge,transmission_fragment:uge,transmission_pars_fragment:dge,uv_pars_fragment:fge,uv_pars_vertex:hge,uv_vertex:pge,worldpos_vertex:mge,background_vert:gge,background_frag:vge,backgroundCube_vert:yge,backgroundCube_frag:xge,cube_vert:bge,cube_frag:_ge,depth_vert:wge,depth_frag:Sge,distanceRGBA_vert:Mge,distanceRGBA_frag:Ege,equirect_vert:Age,equirect_frag:Tge,linedashed_vert:Cge,linedashed_frag:Pge,meshbasic_vert:Rge,meshbasic_frag:Nge,meshlambert_vert:Ige,meshlambert_frag:kge,meshmatcap_vert:Oge,meshmatcap_frag:Lge,meshnormal_vert:Dge,meshnormal_frag:Uge,meshphong_vert:jge,meshphong_frag:Fge,meshphysical_vert:zge,meshphysical_frag:Bge,meshtoon_vert:Hge,meshtoon_frag:Vge,points_vert:Gge,points_frag:Wge,shadow_vert:$ge,shadow_frag:Xge,sprite_vert:qge,sprite_frag:Kge},ht={common:{diffuse:{value:new ot(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Xt},alphaMap:{value:null},alphaMapTransform:{value:new Xt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Xt}},envmap:{envMap:{value:null},envMapRotation:{value:new Xt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Xt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Xt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Xt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Xt},normalScale:{value:new Ve(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Xt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Xt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Xt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Xt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ot(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new ot(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Xt},alphaTest:{value:0},uvTransform:{value:new Xt}},sprite:{diffuse:{value:new ot(16777215)},opacity:{value:1},center:{value:new Ve(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Xt},alphaMap:{value:null},alphaMapTransform:{value:new Xt},alphaTest:{value:0}}},Da={basic:{uniforms:_s([ht.common,ht.specularmap,ht.envmap,ht.aomap,ht.lightmap,ht.fog]),vertexShader:hn.meshbasic_vert,fragmentShader:hn.meshbasic_frag},lambert:{uniforms:_s([ht.common,ht.specularmap,ht.envmap,ht.aomap,ht.lightmap,ht.emissivemap,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.fog,ht.lights,{emissive:{value:new ot(0)}}]),vertexShader:hn.meshlambert_vert,fragmentShader:hn.meshlambert_frag},phong:{uniforms:_s([ht.common,ht.specularmap,ht.envmap,ht.aomap,ht.lightmap,ht.emissivemap,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.fog,ht.lights,{emissive:{value:new ot(0)},specular:{value:new ot(1118481)},shininess:{value:30}}]),vertexShader:hn.meshphong_vert,fragmentShader:hn.meshphong_frag},standard:{uniforms:_s([ht.common,ht.envmap,ht.aomap,ht.lightmap,ht.emissivemap,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.roughnessmap,ht.metalnessmap,ht.fog,ht.lights,{emissive:{value:new ot(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:hn.meshphysical_vert,fragmentShader:hn.meshphysical_frag},toon:{uniforms:_s([ht.common,ht.aomap,ht.lightmap,ht.emissivemap,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.gradientmap,ht.fog,ht.lights,{emissive:{value:new ot(0)}}]),vertexShader:hn.meshtoon_vert,fragmentShader:hn.meshtoon_frag},matcap:{uniforms:_s([ht.common,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.fog,{matcap:{value:null}}]),vertexShader:hn.meshmatcap_vert,fragmentShader:hn.meshmatcap_frag},points:{uniforms:_s([ht.points,ht.fog]),vertexShader:hn.points_vert,fragmentShader:hn.points_frag},dashed:{uniforms:_s([ht.common,ht.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:hn.linedashed_vert,fragmentShader:hn.linedashed_frag},depth:{uniforms:_s([ht.common,ht.displacementmap]),vertexShader:hn.depth_vert,fragmentShader:hn.depth_frag},normal:{uniforms:_s([ht.common,ht.bumpmap,ht.normalmap,ht.displacementmap,{opacity:{value:1}}]),vertexShader:hn.meshnormal_vert,fragmentShader:hn.meshnormal_frag},sprite:{uniforms:_s([ht.sprite,ht.fog]),vertexShader:hn.sprite_vert,fragmentShader:hn.sprite_frag},background:{uniforms:{uvTransform:{value:new Xt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:hn.background_vert,fragmentShader:hn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Xt}},vertexShader:hn.backgroundCube_vert,fragmentShader:hn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:hn.cube_vert,fragmentShader:hn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:hn.equirect_vert,fragmentShader:hn.equirect_frag},distanceRGBA:{uniforms:_s([ht.common,ht.displacementmap,{referencePosition:{value:new X},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:hn.distanceRGBA_vert,fragmentShader:hn.distanceRGBA_frag},shadow:{uniforms:_s([ht.lights,ht.fog,{color:{value:new ot(0)},opacity:{value:1}}]),vertexShader:hn.shadow_vert,fragmentShader:hn.shadow_frag}};Da.physical={uniforms:_s([Da.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Xt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Xt},clearcoatNormalScale:{value:new Ve(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Xt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Xt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Xt},sheen:{value:0},sheenColor:{value:new ot(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Xt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Xt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Xt},transmissionSamplerSize:{value:new Ve},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Xt},attenuationDistance:{value:0},attenuationColor:{value:new ot(0)},specularColor:{value:new ot(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Xt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Xt},anisotropyVector:{value:new Ve},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Xt}}]),vertexShader:hn.meshphysical_vert,fragmentShader:hn.meshphysical_frag};const e_={r:0,b:0,g:0},Nf=new as,Yge=new Ct;function Zge(t,e,n,r,i,s,o){const a=new ot(0);let l=s===!0?0:1,c,d,f=null,m=0,y=null;function x(A){let T=A.isScene===!0?A.background:null;return T&&T.isTexture&&(T=(A.backgroundBlurriness>0?n:e).get(T)),T}function S(A){let T=!1;const C=x(A);C===null?w(a,l):C&&C.isColor&&(w(C,1),T=!0);const O=t.xr.getEnvironmentBlendMode();O==="additive"?r.buffers.color.setClear(0,0,0,1,o):O==="alpha-blend"&&r.buffers.color.setClear(0,0,0,0,o),(t.autoClear||T)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))}function _(A,T){const C=x(T);C&&(C.isCubeTexture||C.mapping===Jg)?(d===void 0&&(d=new yr(new ep(1,1,1),new Qo({name:"BackgroundCubeMaterial",uniforms:Lg(Da.backgroundCube.uniforms),vertexShader:Da.backgroundCube.vertexShader,fragmentShader:Da.backgroundCube.fragmentShader,side:ss,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(O,N,D){this.matrixWorld.copyPosition(D.matrixWorld)},Object.defineProperty(d.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(d)),Nf.copy(T.backgroundRotation),Nf.x*=-1,Nf.y*=-1,Nf.z*=-1,C.isCubeTexture&&C.isRenderTargetTexture===!1&&(Nf.y*=-1,Nf.z*=-1),d.material.uniforms.envMap.value=C,d.material.uniforms.flipEnvMap.value=C.isCubeTexture&&C.isRenderTargetTexture===!1?-1:1,d.material.uniforms.backgroundBlurriness.value=T.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,d.material.uniforms.backgroundRotation.value.setFromMatrix4(Yge.makeRotationFromEuler(Nf)),d.material.toneMapped=In.getTransfer(C.colorSpace)!==Jn,(f!==C||m!==C.version||y!==t.toneMapping)&&(d.material.needsUpdate=!0,f=C,m=C.version,y=t.toneMapping),d.layers.enableAll(),A.unshift(d,d.geometry,d.material,0,0,null)):C&&C.isTexture&&(c===void 0&&(c=new yr(new tv(2,2),new Qo({name:"BackgroundMaterial",uniforms:Lg(Da.background.uniforms),vertexShader:Da.background.vertexShader,fragmentShader:Da.background.fragmentShader,side:Dl,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=C,c.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,c.material.toneMapped=In.getTransfer(C.colorSpace)!==Jn,C.matrixAutoUpdate===!0&&C.updateMatrix(),c.material.uniforms.uvTransform.value.copy(C.matrix),(f!==C||m!==C.version||y!==t.toneMapping)&&(c.material.needsUpdate=!0,f=C,m=C.version,y=t.toneMapping),c.layers.enableAll(),A.unshift(c,c.geometry,c.material,0,0,null))}function w(A,T){A.getRGB(e_,a6(t)),r.buffers.color.setClear(e_.r,e_.g,e_.b,T,o)}return{getClearColor:function(){return a},setClearColor:function(A,T=1){a.set(A),l=T,w(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(A){l=A,w(a,l)},render:S,addToRenderList:_}}function Qge(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),r={},i=m(null);let s=i,o=!1;function a(k,j,H,ne,te){let pe=!1;const oe=f(ne,H,j);s!==oe&&(s=oe,c(s.object)),pe=y(k,ne,H,te),pe&&x(k,ne,H,te),te!==null&&e.update(te,t.ELEMENT_ARRAY_BUFFER),(pe||o)&&(o=!1,C(k,j,H,ne),te!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(te).buffer))}function l(){return t.createVertexArray()}function c(k){return t.bindVertexArray(k)}function d(k){return t.deleteVertexArray(k)}function f(k,j,H){const ne=H.wireframe===!0;let te=r[k.id];te===void 0&&(te={},r[k.id]=te);let pe=te[j.id];pe===void 0&&(pe={},te[j.id]=pe);let oe=pe[ne];return oe===void 0&&(oe=m(l()),pe[ne]=oe),oe}function m(k){const j=[],H=[],ne=[];for(let te=0;te<n;te++)j[te]=0,H[te]=0,ne[te]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:j,enabledAttributes:H,attributeDivisors:ne,object:k,attributes:{},index:null}}function y(k,j,H,ne){const te=s.attributes,pe=j.attributes;let oe=0;const ce=H.getAttributes();for(const B in ce)if(ce[B].location>=0){const q=te[B];let $=pe[B];if($===void 0&&(B==="instanceMatrix"&&k.instanceMatrix&&($=k.instanceMatrix),B==="instanceColor"&&k.instanceColor&&($=k.instanceColor)),q===void 0||q.attribute!==$||$&&q.data!==$.data)return!0;oe++}return s.attributesNum!==oe||s.index!==ne}function x(k,j,H,ne){const te={},pe=j.attributes;let oe=0;const ce=H.getAttributes();for(const B in ce)if(ce[B].location>=0){let q=pe[B];q===void 0&&(B==="instanceMatrix"&&k.instanceMatrix&&(q=k.instanceMatrix),B==="instanceColor"&&k.instanceColor&&(q=k.instanceColor));const $={};$.attribute=q,q&&q.data&&($.data=q.data),te[B]=$,oe++}s.attributes=te,s.attributesNum=oe,s.index=ne}function S(){const k=s.newAttributes;for(let j=0,H=k.length;j<H;j++)k[j]=0}function _(k){w(k,0)}function w(k,j){const H=s.newAttributes,ne=s.enabledAttributes,te=s.attributeDivisors;H[k]=1,ne[k]===0&&(t.enableVertexAttribArray(k),ne[k]=1),te[k]!==j&&(t.vertexAttribDivisor(k,j),te[k]=j)}function A(){const k=s.newAttributes,j=s.enabledAttributes;for(let H=0,ne=j.length;H<ne;H++)j[H]!==k[H]&&(t.disableVertexAttribArray(H),j[H]=0)}function T(k,j,H,ne,te,pe,oe){oe===!0?t.vertexAttribIPointer(k,j,H,te,pe):t.vertexAttribPointer(k,j,H,ne,te,pe)}function C(k,j,H,ne){S();const te=ne.attributes,pe=H.getAttributes(),oe=j.defaultAttributeValues;for(const ce in pe){const B=pe[ce];if(B.location>=0){let K=te[ce];if(K===void 0&&(ce==="instanceMatrix"&&k.instanceMatrix&&(K=k.instanceMatrix),ce==="instanceColor"&&k.instanceColor&&(K=k.instanceColor)),K!==void 0){const q=K.normalized,$=K.itemSize,Z=e.get(K);if(Z===void 0)continue;const ge=Z.buffer,ae=Z.type,fe=Z.bytesPerElement,_e=ae===t.INT||ae===t.UNSIGNED_INT||K.gpuType===HS;if(K.isInterleavedBufferAttribute){const Se=K.data,$e=Se.stride,Me=K.offset;if(Se.isInstancedInterleavedBuffer){for(let He=0;He<B.locationSize;He++)w(B.location+He,Se.meshPerAttribute);k.isInstancedMesh!==!0&&ne._maxInstanceCount===void 0&&(ne._maxInstanceCount=Se.meshPerAttribute*Se.count)}else for(let He=0;He<B.locationSize;He++)_(B.location+He);t.bindBuffer(t.ARRAY_BUFFER,ge);for(let He=0;He<B.locationSize;He++)T(B.location+He,$/B.locationSize,ae,q,$e*fe,(Me+$/B.locationSize*He)*fe,_e)}else{if(K.isInstancedBufferAttribute){for(let Se=0;Se<B.locationSize;Se++)w(B.location+Se,K.meshPerAttribute);k.isInstancedMesh!==!0&&ne._maxInstanceCount===void 0&&(ne._maxInstanceCount=K.meshPerAttribute*K.count)}else for(let Se=0;Se<B.locationSize;Se++)_(B.location+Se);t.bindBuffer(t.ARRAY_BUFFER,ge);for(let Se=0;Se<B.locationSize;Se++)T(B.location+Se,$/B.locationSize,ae,q,$*fe,$/B.locationSize*Se*fe,_e)}}else if(oe!==void 0){const q=oe[ce];if(q!==void 0)switch(q.length){case 2:t.vertexAttrib2fv(B.location,q);break;case 3:t.vertexAttrib3fv(B.location,q);break;case 4:t.vertexAttrib4fv(B.location,q);break;default:t.vertexAttrib1fv(B.location,q)}}}}A()}function O(){F();for(const k in r){const j=r[k];for(const H in j){const ne=j[H];for(const te in ne)d(ne[te].object),delete ne[te];delete j[H]}delete r[k]}}function N(k){if(r[k.id]===void 0)return;const j=r[k.id];for(const H in j){const ne=j[H];for(const te in ne)d(ne[te].object),delete ne[te];delete j[H]}delete r[k.id]}function D(k){for(const j in r){const H=r[j];if(H[k.id]===void 0)continue;const ne=H[k.id];for(const te in ne)d(ne[te].object),delete ne[te];delete H[k.id]}}function F(){V(),o=!0,s!==i&&(s=i,c(s.object))}function V(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:a,reset:F,resetDefaultState:V,dispose:O,releaseStatesOfGeometry:N,releaseStatesOfProgram:D,initAttributes:S,enableAttribute:_,disableUnusedAttributes:A}}function Jge(t,e,n){let r;function i(c){r=c}function s(c,d){t.drawArrays(r,c,d),n.update(d,r,1)}function o(c,d,f){f!==0&&(t.drawArraysInstanced(r,c,d,f),n.update(d,r,f))}function a(c,d,f){if(f===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(r,c,0,d,0,f);let y=0;for(let x=0;x<f;x++)y+=d[x];n.update(y,r,1)}function l(c,d,f,m){if(f===0)return;const y=e.get("WEBGL_multi_draw");if(y===null)for(let x=0;x<c.length;x++)o(c[x],d[x],m[x]);else{y.multiDrawArraysInstancedWEBGL(r,c,0,d,0,m,0,f);let x=0;for(let S=0;S<f;S++)x+=d[S];for(let S=0;S<m.length;S++)n.update(x,r,m[S])}}this.setMode=i,this.render=s,this.renderInstances=o,this.renderMultiDraw=a,this.renderMultiDrawInstances=l}function eve(t,e,n,r){let i;function s(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const D=e.get("EXT_texture_filter_anisotropic");i=t.getParameter(D.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function o(D){return!(D!==is&&r.convert(D)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(D){const F=D===ev&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(D!==Ha&&r.convert(D)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&D!==Zs&&!F)}function l(D){if(D==="highp"){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";D="mediump"}return D==="mediump"&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=n.precision!==void 0?n.precision:"highp";const d=l(c);d!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",d,"instead."),c=d);const f=n.logarithmicDepthBuffer===!0,m=n.reverseDepthBuffer===!0&&e.has("EXT_clip_control");if(m===!0){const D=e.get("EXT_clip_control");D.clipControlEXT(D.LOWER_LEFT_EXT,D.ZERO_TO_ONE_EXT)}const y=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),x=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),S=t.getParameter(t.MAX_TEXTURE_SIZE),_=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),w=t.getParameter(t.MAX_VERTEX_ATTRIBS),A=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),T=t.getParameter(t.MAX_VARYING_VECTORS),C=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),O=x>0,N=t.getParameter(t.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:f,reverseDepthBuffer:m,maxTextures:y,maxVertexTextures:x,maxTextureSize:S,maxCubemapSize:_,maxAttributes:w,maxVertexUniforms:A,maxVaryings:T,maxFragmentUniforms:C,vertexTextures:O,maxSamples:N}}function tve(t){const e=this;let n=null,r=0,i=!1,s=!1;const o=new Nc,a=new Xt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,m){const y=f.length!==0||m||r!==0||i;return i=m,r=f.length,y},this.beginShadows=function(){s=!0,d(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,m){n=d(f,m,0)},this.setState=function(f,m,y){const x=f.clippingPlanes,S=f.clipIntersection,_=f.clipShadows,w=t.get(f);if(!i||x===null||x.length===0||s&&!_)s?d(null):c();else{const A=s?0:r,T=A*4;let C=w.clippingState||null;l.value=C,C=d(x,m,T,y);for(let O=0;O!==T;++O)C[O]=n[O];w.clippingState=C,this.numIntersection=S?this.numPlanes:0,this.numPlanes+=A}};function c(){l.value!==n&&(l.value=n,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function d(f,m,y,x){const S=f!==null?f.length:0;let _=null;if(S!==0){if(_=l.value,x!==!0||_===null){const w=y+S*4,A=m.matrixWorldInverse;a.getNormalMatrix(A),(_===null||_.length<w)&&(_=new Float32Array(w));for(let T=0,C=y;T!==S;++T,C+=4)o.copy(f[T]).applyMatrix4(A,a),o.normal.toArray(_,C),_[C+3]=o.constant}l.value=_,l.needsUpdate=!0}return e.numPlanes=S,e.numIntersection=0,_}}function nve(t){let e=new WeakMap;function n(o,a){return a===My?o.mapping=Jc:a===Ey&&(o.mapping=Cd),o}function r(o){if(o&&o.isTexture){const a=o.mapping;if(a===My||a===Ey)if(e.has(o)){const l=e.get(o).texture;return n(l,o.mapping)}else{const l=o.image;if(l&&l.height>0){const c=new c6(l.height);return c.fromEquirectangularTexture(t,o),e.set(o,c),o.addEventListener("dispose",i),n(c.texture,o.mapping)}else return null}}return o}function i(o){const a=o.target;a.removeEventListener("dispose",i);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:r,dispose:s}}class $c extends cx{constructor(e=-1,n=1,r=1,i=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=n,this.top=r,this.bottom=i,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,n,r,i,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),n=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=r-e,o=r+e,a=i+n,l=i-n;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=d*this.view.offsetY,l=a-d*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,this.view!==null&&(n.object.view=Object.assign({},this.view)),n}}const Xm=4,rD=[.125,.215,.35,.446,.526,.582],Zf=20,hA=new $c,iD=new ot;let pA=null,mA=0,gA=0,vA=!1;const Yf=(1+Math.sqrt(5))/2,Em=1/Yf,sD=[new X(-Yf,Em,0),new X(Yf,Em,0),new X(-Em,0,Yf),new X(Em,0,Yf),new X(0,Yf,-Em),new X(0,Yf,Em),new X(-1,1,-1),new X(1,1,-1),new X(-1,1,1),new X(1,1,1)];class WC{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,n=0,r=.1,i=100){pA=this._renderer.getRenderTarget(),mA=this._renderer.getActiveCubeFace(),gA=this._renderer.getActiveMipmapLevel(),vA=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,r,i,s),n>0&&this._blur(s,0,0,n),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=lD(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=aD(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(pA,mA,gA),this._renderer.xr.enabled=vA,e.scissorTest=!1,t_(e,0,0,e.width,e.height)}_fromTexture(e,n){e.mapping===Jc||e.mapping===Cd?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),pA=this._renderer.getRenderTarget(),mA=this._renderer.getActiveCubeFace(),gA=this._renderer.getActiveMipmapLevel(),vA=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const r=n||this._allocateTargets();return this._textureToCubeUV(e,r),this._applyPMREM(r),this._cleanup(r),r}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),n=4*this._cubeSize,r={magFilter:Cr,minFilter:Cr,generateMipmaps:!1,type:ev,format:is,colorSpace:xi,depthBuffer:!1},i=oD(e,n,r);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==n){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=oD(e,n,r);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=rve(s)),this._blurMaterial=ive(s,e,n)}return i}_compileMaterial(e){const n=new yr(this._lodPlanes[0],e);this._renderer.compile(n,hA)}_sceneToCubeUV(e,n,r,i){const a=new Tr(90,1,n,r),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],d=this._renderer,f=d.autoClear,m=d.toneMapping;d.getClearColor(iD),d.toneMapping=Cl,d.autoClear=!1;const y=new As({name:"PMREM.Background",side:ss,depthWrite:!1,depthTest:!1}),x=new yr(new ep,y);let S=!1;const _=e.background;_?_.isColor&&(y.color.copy(_),e.background=null,S=!0):(y.color.copy(iD),S=!0);for(let w=0;w<6;w++){const A=w%3;A===0?(a.up.set(0,l[w],0),a.lookAt(c[w],0,0)):A===1?(a.up.set(0,0,l[w]),a.lookAt(0,c[w],0)):(a.up.set(0,l[w],0),a.lookAt(0,0,c[w]));const T=this._cubeSize;t_(i,A*T,w>2?T:0,T,T),d.setRenderTarget(i),S&&d.render(x,a),d.render(e,a)}x.geometry.dispose(),x.material.dispose(),d.toneMapping=m,d.autoClear=f,e.background=_}_textureToCubeUV(e,n){const r=this._renderer,i=e.mapping===Jc||e.mapping===Cd;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=lD()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=aD());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new yr(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;t_(n,0,0,3*l,2*l),r.setRenderTarget(n),r.render(o,hA)}_applyPMREM(e){const n=this._renderer,r=n.autoClear;n.autoClear=!1;const i=this._lodPlanes.length;for(let s=1;s<i;s++){const o=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),a=sD[(i-s-1)%sD.length];this._blur(e,s-1,s,o,a)}n.autoClear=r}_blur(e,n,r,i,s){const o=this._pingPongRenderTarget;this._halfBlur(e,o,n,r,i,"latitudinal",s),this._halfBlur(o,e,r,r,i,"longitudinal",s)}_halfBlur(e,n,r,i,s,o,a){const l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const d=3,f=new yr(this._lodPlanes[i],c),m=c.uniforms,y=this._sizeLods[r]-1,x=isFinite(s)?Math.PI/(2*y):2*Math.PI/(2*Zf-1),S=s/x,_=isFinite(s)?1+Math.floor(d*S):Zf;_>Zf&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${_} samples when the maximum is set to ${Zf}`);const w=[];let A=0;for(let D=0;D<Zf;++D){const F=D/S,V=Math.exp(-F*F/2);w.push(V),D===0?A+=V:D<_&&(A+=2*V)}for(let D=0;D<w.length;D++)w[D]=w[D]/A;m.envMap.value=e.texture,m.samples.value=_,m.weights.value=w,m.latitudinal.value=o==="latitudinal",a&&(m.poleAxis.value=a);const{_lodMax:T}=this;m.dTheta.value=x,m.mipInt.value=T-r;const C=this._sizeLods[i],O=3*C*(i>T-Xm?i-T+Xm:0),N=4*(this._cubeSize-C);t_(n,O,N,3*C,2*C),l.setRenderTarget(n),l.render(f,hA)}}function rve(t){const e=[],n=[],r=[];let i=t;const s=t-Xm+1+rD.length;for(let o=0;o<s;o++){const a=Math.pow(2,i);n.push(a);let l=1/a;o>t-Xm?l=rD[o-t+Xm-1]:o===0&&(l=0),r.push(l);const c=1/(a-2),d=-c,f=1+c,m=[d,d,f,d,f,f,d,d,f,f,d,f],y=6,x=6,S=3,_=2,w=1,A=new Float32Array(S*x*y),T=new Float32Array(_*x*y),C=new Float32Array(w*x*y);for(let N=0;N<y;N++){const D=N%3*2/3-1,F=N>2?0:-1,V=[D,F,0,D+2/3,F,0,D+2/3,F+1,0,D,F,0,D+2/3,F+1,0,D,F+1,0];A.set(V,S*x*N),T.set(m,_*x*N);const k=[N,N,N,N,N,N];C.set(k,w*x*N)}const O=new Zt;O.setAttribute("position",new Qt(A,S)),O.setAttribute("uv",new Qt(T,_)),O.setAttribute("faceIndex",new Qt(C,w)),e.push(O),i>Xm&&i--}return{lodPlanes:e,sizeLods:n,sigmas:r}}function oD(t,e,n){const r=new Va(t,e,n);return r.texture.mapping=Jg,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function t_(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function ive(t,e,n){const r=new Float32Array(Zf),i=new X(0,1,0);return new Qo({name:"SphericalGaussianBlur",defines:{n:Zf,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:A2(),fragmentShader:`
|
||
|
||
precision mediump float;
|
||
precision mediump int;
|
||
|
||
varying vec3 vOutputDirection;
|
||
|
||
uniform sampler2D envMap;
|
||
uniform int samples;
|
||
uniform float weights[ n ];
|
||
uniform bool latitudinal;
|
||
uniform float dTheta;
|
||
uniform float mipInt;
|
||
uniform vec3 poleAxis;
|
||
|
||
#define ENVMAP_TYPE_CUBE_UV
|
||
#include <cube_uv_reflection_fragment>
|
||
|
||
vec3 getSample( float theta, vec3 axis ) {
|
||
|
||
float cosTheta = cos( theta );
|
||
// Rodrigues' axis-angle rotation
|
||
vec3 sampleDirection = vOutputDirection * cosTheta
|
||
+ cross( axis, vOutputDirection ) * sin( theta )
|
||
+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
|
||
|
||
return bilinearCubeUV( envMap, sampleDirection, mipInt );
|
||
|
||
}
|
||
|
||
void main() {
|
||
|
||
vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
|
||
|
||
if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
|
||
|
||
axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
|
||
|
||
}
|
||
|
||
axis = normalize( axis );
|
||
|
||
gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
|
||
gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
|
||
|
||
for ( int i = 1; i < n; i++ ) {
|
||
|
||
if ( i >= samples ) {
|
||
|
||
break;
|
||
|
||
}
|
||
|
||
float theta = dTheta * float( i );
|
||
gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
|
||
gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
|
||
|
||
}
|
||
|
||
}
|
||
`,blending:Wc,depthTest:!1,depthWrite:!1})}function aD(){return new Qo({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:A2(),fragmentShader:`
|
||
|
||
precision mediump float;
|
||
precision mediump int;
|
||
|
||
varying vec3 vOutputDirection;
|
||
|
||
uniform sampler2D envMap;
|
||
|
||
#include <common>
|
||
|
||
void main() {
|
||
|
||
vec3 outputDirection = normalize( vOutputDirection );
|
||
vec2 uv = equirectUv( outputDirection );
|
||
|
||
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
|
||
|
||
}
|
||
`,blending:Wc,depthTest:!1,depthWrite:!1})}function lD(){return new Qo({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:A2(),fragmentShader:`
|
||
|
||
precision mediump float;
|
||
precision mediump int;
|
||
|
||
uniform float flipEnvMap;
|
||
|
||
varying vec3 vOutputDirection;
|
||
|
||
uniform samplerCube envMap;
|
||
|
||
void main() {
|
||
|
||
gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
|
||
|
||
}
|
||
`,blending:Wc,depthTest:!1,depthWrite:!1})}function A2(){return`
|
||
|
||
precision mediump float;
|
||
precision mediump int;
|
||
|
||
attribute float faceIndex;
|
||
|
||
varying vec3 vOutputDirection;
|
||
|
||
// RH coordinate system; PMREM face-indexing convention
|
||
vec3 getDirection( vec2 uv, float face ) {
|
||
|
||
uv = 2.0 * uv - 1.0;
|
||
|
||
vec3 direction = vec3( uv, 1.0 );
|
||
|
||
if ( face == 0.0 ) {
|
||
|
||
direction = direction.zyx; // ( 1, v, u ) pos x
|
||
|
||
} else if ( face == 1.0 ) {
|
||
|
||
direction = direction.xzy;
|
||
direction.xz *= -1.0; // ( -u, 1, -v ) pos y
|
||
|
||
} else if ( face == 2.0 ) {
|
||
|
||
direction.x *= -1.0; // ( -u, v, 1 ) pos z
|
||
|
||
} else if ( face == 3.0 ) {
|
||
|
||
direction = direction.zyx;
|
||
direction.xz *= -1.0; // ( -1, v, -u ) neg x
|
||
|
||
} else if ( face == 4.0 ) {
|
||
|
||
direction = direction.xzy;
|
||
direction.xy *= -1.0; // ( -u, -1, v ) neg y
|
||
|
||
} else if ( face == 5.0 ) {
|
||
|
||
direction.z *= -1.0; // ( u, v, -1 ) neg z
|
||
|
||
}
|
||
|
||
return direction;
|
||
|
||
}
|
||
|
||
void main() {
|
||
|
||
vOutputDirection = getDirection( uv, faceIndex );
|
||
gl_Position = vec4( position, 1.0 );
|
||
|
||
}
|
||
`}function sve(t){let e=new WeakMap,n=null;function r(a){if(a&&a.isTexture){const l=a.mapping,c=l===My||l===Ey,d=l===Jc||l===Cd;if(c||d){let f=e.get(a);const m=f!==void 0?f.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==m)return n===null&&(n=new WC(t)),f=c?n.fromEquirectangular(a,f):n.fromCubemap(a,f),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),f.texture;if(f!==void 0)return f.texture;{const y=a.image;return c&&y&&y.height>0||d&&y&&i(y)?(n===null&&(n=new WC(t)),f=c?n.fromEquirectangular(a):n.fromCubemap(a),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),a.addEventListener("dispose",s),f.texture):null}}}return a}function i(a){let l=0;const c=6;for(let d=0;d<c;d++)a[d]!==void 0&&l++;return l===c}function s(a){const l=a.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function o(){e=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:o}}function ove(t){const e={};function n(r){if(e[r]!==void 0)return e[r];let i;switch(r){case"WEBGL_depth_texture":i=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=t.getExtension(r)}return e[r]=i,i}return{has:function(r){return n(r)!==null},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(r){const i=n(r);return i===null&&$_("THREE.WebGLRenderer: "+r+" extension not supported."),i}}}function ave(t,e,n,r){const i={},s=new WeakMap;function o(f){const m=f.target;m.index!==null&&e.remove(m.index);for(const x in m.attributes)e.remove(m.attributes[x]);for(const x in m.morphAttributes){const S=m.morphAttributes[x];for(let _=0,w=S.length;_<w;_++)e.remove(S[_])}m.removeEventListener("dispose",o),delete i[m.id];const y=s.get(m);y&&(e.remove(y),s.delete(m)),r.releaseStatesOfGeometry(m),m.isInstancedBufferGeometry===!0&&delete m._maxInstanceCount,n.memory.geometries--}function a(f,m){return i[m.id]===!0||(m.addEventListener("dispose",o),i[m.id]=!0,n.memory.geometries++),m}function l(f){const m=f.attributes;for(const x in m)e.update(m[x],t.ARRAY_BUFFER);const y=f.morphAttributes;for(const x in y){const S=y[x];for(let _=0,w=S.length;_<w;_++)e.update(S[_],t.ARRAY_BUFFER)}}function c(f){const m=[],y=f.index,x=f.attributes.position;let S=0;if(y!==null){const A=y.array;S=y.version;for(let T=0,C=A.length;T<C;T+=3){const O=A[T+0],N=A[T+1],D=A[T+2];m.push(O,N,N,D,D,O)}}else if(x!==void 0){const A=x.array;S=x.version;for(let T=0,C=A.length/3-1;T<C;T+=3){const O=T+0,N=T+1,D=T+2;m.push(O,N,N,D,D,O)}}else return;const _=new(n6(m)?M2:S2)(m,1);_.version=S;const w=s.get(f);w&&e.remove(w),s.set(f,_)}function d(f){const m=s.get(f);if(m){const y=f.index;y!==null&&m.version<y.version&&c(f)}else c(f);return s.get(f)}return{get:a,update:l,getWireframeAttribute:d}}function lve(t,e,n){let r;function i(m){r=m}let s,o;function a(m){s=m.type,o=m.bytesPerElement}function l(m,y){t.drawElements(r,y,s,m*o),n.update(y,r,1)}function c(m,y,x){x!==0&&(t.drawElementsInstanced(r,y,s,m*o,x),n.update(y,r,x))}function d(m,y,x){if(x===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(r,y,0,s,m,0,x);let _=0;for(let w=0;w<x;w++)_+=y[w];n.update(_,r,1)}function f(m,y,x,S){if(x===0)return;const _=e.get("WEBGL_multi_draw");if(_===null)for(let w=0;w<m.length;w++)c(m[w]/o,y[w],S[w]);else{_.multiDrawElementsInstancedWEBGL(r,y,0,s,m,0,S,0,x);let w=0;for(let A=0;A<x;A++)w+=y[A];for(let A=0;A<S.length;A++)n.update(w,r,S[A])}}this.setMode=i,this.setIndex=a,this.render=l,this.renderInstances=c,this.renderMultiDraw=d,this.renderMultiDrawInstances=f}function cve(t){const e={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function r(s,o,a){switch(n.calls++,o){case t.TRIANGLES:n.triangles+=a*(s/3);break;case t.LINES:n.lines+=a*(s/2);break;case t.LINE_STRIP:n.lines+=a*(s-1);break;case t.LINE_LOOP:n.lines+=a*s;break;case t.POINTS:n.points+=a*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function i(){n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:e,render:n,programs:null,autoReset:!0,reset:i,update:r}}function uve(t,e,n){const r=new WeakMap,i=new Ln;function s(o,a,l){const c=o.morphTargetInfluences,d=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,f=d!==void 0?d.length:0;let m=r.get(a);if(m===void 0||m.count!==f){let V=function(){D.dispose(),r.delete(a),a.removeEventListener("dispose",V)};m!==void 0&&m.texture.dispose();const y=a.morphAttributes.position!==void 0,x=a.morphAttributes.normal!==void 0,S=a.morphAttributes.color!==void 0,_=a.morphAttributes.position||[],w=a.morphAttributes.normal||[],A=a.morphAttributes.color||[];let T=0;y===!0&&(T=1),x===!0&&(T=2),S===!0&&(T=3);let C=a.attributes.position.count*T,O=1;C>e.maxTextureSize&&(O=Math.ceil(C/e.maxTextureSize),C=e.maxTextureSize);const N=new Float32Array(C*O*4*f),D=new YS(N,C,O,f);D.type=Zs,D.needsUpdate=!0;const F=T*4;for(let k=0;k<f;k++){const j=_[k],H=w[k],ne=A[k],te=C*O*4*k;for(let pe=0;pe<j.count;pe++){const oe=pe*F;y===!0&&(i.fromBufferAttribute(j,pe),N[te+oe+0]=i.x,N[te+oe+1]=i.y,N[te+oe+2]=i.z,N[te+oe+3]=0),x===!0&&(i.fromBufferAttribute(H,pe),N[te+oe+4]=i.x,N[te+oe+5]=i.y,N[te+oe+6]=i.z,N[te+oe+7]=0),S===!0&&(i.fromBufferAttribute(ne,pe),N[te+oe+8]=i.x,N[te+oe+9]=i.y,N[te+oe+10]=i.z,N[te+oe+11]=ne.itemSize===4?i.w:1)}}m={count:f,texture:D,size:new Ve(C,O)},r.set(a,m),a.addEventListener("dispose",V)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)l.getUniforms().setValue(t,"morphTexture",o.morphTexture,n);else{let y=0;for(let S=0;S<c.length;S++)y+=c[S];const x=a.morphTargetsRelative?1:1-y;l.getUniforms().setValue(t,"morphTargetBaseInfluence",x),l.getUniforms().setValue(t,"morphTargetInfluences",c)}l.getUniforms().setValue(t,"morphTargetsTexture",m.texture,n),l.getUniforms().setValue(t,"morphTargetsTextureSize",m.size)}return{update:s}}function dve(t,e,n,r){let i=new WeakMap;function s(l){const c=r.render.frame,d=l.geometry,f=e.get(l,d);if(i.get(f)!==c&&(e.update(f),i.set(f,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",a)===!1&&l.addEventListener("dispose",a),i.get(l)!==c&&(n.update(l.instanceMatrix,t.ARRAY_BUFFER),l.instanceColor!==null&&n.update(l.instanceColor,t.ARRAY_BUFFER),i.set(l,c))),l.isSkinnedMesh){const m=l.skeleton;i.get(m)!==c&&(m.update(),i.set(m,c))}return f}function o(){i=new WeakMap}function a(l){const c=l.target;c.removeEventListener("dispose",a),n.remove(c.instanceMatrix),c.instanceColor!==null&&n.remove(c.instanceColor)}return{update:s,dispose:o}}class T2 extends dr{constructor(e,n,r,i,s,o,a,l,c,d=Mh){if(d!==Mh&&d!==Fh)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");r===void 0&&d===Mh&&(r=eu),r===void 0&&d===Fh&&(r=jh),super(null,i,s,o,a,l,d,r,c),this.isDepthTexture=!0,this.image={width:e,height:n},this.magFilter=a!==void 0?a:ri,this.minFilter=l!==void 0?l:ri,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const n=super.toJSON(e);return this.compareFunction!==null&&(n.compareFunction=this.compareFunction),n}}const d6=new dr,cD=new T2(1,1),f6=new YS,h6=new w2,p6=new ux,uD=[],dD=[],fD=new Float32Array(16),hD=new Float32Array(9),pD=new Float32Array(4);function nv(t,e,n){const r=t[0];if(r<=0||r>0)return t;const i=e*n;let s=uD[i];if(s===void 0&&(s=new Float32Array(i),uD[i]=s),e!==0){r.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=n,t[o].toArray(s,a)}return s}function ii(t,e){if(t.length!==e.length)return!1;for(let n=0,r=t.length;n<r;n++)if(t[n]!==e[n])return!1;return!0}function si(t,e){for(let n=0,r=e.length;n<r;n++)t[n]=e[n]}function ZS(t,e){let n=dD[e];n===void 0&&(n=new Int32Array(e),dD[e]=n);for(let r=0;r!==e;++r)n[r]=t.allocateTextureUnit();return n}function fve(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function hve(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(ii(n,e))return;t.uniform2fv(this.addr,e),si(n,e)}}function pve(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(e.r!==void 0)(n[0]!==e.r||n[1]!==e.g||n[2]!==e.b)&&(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(ii(n,e))return;t.uniform3fv(this.addr,e),si(n,e)}}function mve(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(ii(n,e))return;t.uniform4fv(this.addr,e),si(n,e)}}function gve(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(ii(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),si(n,e)}else{if(ii(n,r))return;pD.set(r),t.uniformMatrix2fv(this.addr,!1,pD),si(n,r)}}function vve(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(ii(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),si(n,e)}else{if(ii(n,r))return;hD.set(r),t.uniformMatrix3fv(this.addr,!1,hD),si(n,r)}}function yve(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(ii(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),si(n,e)}else{if(ii(n,r))return;fD.set(r),t.uniformMatrix4fv(this.addr,!1,fD),si(n,r)}}function xve(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function bve(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2i(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(ii(n,e))return;t.uniform2iv(this.addr,e),si(n,e)}}function _ve(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3i(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(ii(n,e))return;t.uniform3iv(this.addr,e),si(n,e)}}function wve(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4i(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(ii(n,e))return;t.uniform4iv(this.addr,e),si(n,e)}}function Sve(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function Mve(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2ui(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(ii(n,e))return;t.uniform2uiv(this.addr,e),si(n,e)}}function Eve(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3ui(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(ii(n,e))return;t.uniform3uiv(this.addr,e),si(n,e)}}function Ave(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4ui(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(ii(n,e))return;t.uniform4uiv(this.addr,e),si(n,e)}}function Tve(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i);let s;this.type===t.SAMPLER_2D_SHADOW?(cD.compareFunction=b2,s=cD):s=d6,n.setTexture2D(e||s,i)}function Cve(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(e||h6,i)}function Pve(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTextureCube(e||p6,i)}function Rve(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(e||f6,i)}function Nve(t){switch(t){case 5126:return fve;case 35664:return hve;case 35665:return pve;case 35666:return mve;case 35674:return gve;case 35675:return vve;case 35676:return yve;case 5124:case 35670:return xve;case 35667:case 35671:return bve;case 35668:case 35672:return _ve;case 35669:case 35673:return wve;case 5125:return Sve;case 36294:return Mve;case 36295:return Eve;case 36296:return Ave;case 35678:case 36198:case 36298:case 36306:case 35682:return Tve;case 35679:case 36299:case 36307:return Cve;case 35680:case 36300:case 36308:case 36293:return Pve;case 36289:case 36303:case 36311:case 36292:return Rve}}function Ive(t,e){t.uniform1fv(this.addr,e)}function kve(t,e){const n=nv(e,this.size,2);t.uniform2fv(this.addr,n)}function Ove(t,e){const n=nv(e,this.size,3);t.uniform3fv(this.addr,n)}function Lve(t,e){const n=nv(e,this.size,4);t.uniform4fv(this.addr,n)}function Dve(t,e){const n=nv(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function Uve(t,e){const n=nv(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function jve(t,e){const n=nv(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function Fve(t,e){t.uniform1iv(this.addr,e)}function zve(t,e){t.uniform2iv(this.addr,e)}function Bve(t,e){t.uniform3iv(this.addr,e)}function Hve(t,e){t.uniform4iv(this.addr,e)}function Vve(t,e){t.uniform1uiv(this.addr,e)}function Gve(t,e){t.uniform2uiv(this.addr,e)}function Wve(t,e){t.uniform3uiv(this.addr,e)}function $ve(t,e){t.uniform4uiv(this.addr,e)}function Xve(t,e,n){const r=this.cache,i=e.length,s=ZS(n,i);ii(r,s)||(t.uniform1iv(this.addr,s),si(r,s));for(let o=0;o!==i;++o)n.setTexture2D(e[o]||d6,s[o])}function qve(t,e,n){const r=this.cache,i=e.length,s=ZS(n,i);ii(r,s)||(t.uniform1iv(this.addr,s),si(r,s));for(let o=0;o!==i;++o)n.setTexture3D(e[o]||h6,s[o])}function Kve(t,e,n){const r=this.cache,i=e.length,s=ZS(n,i);ii(r,s)||(t.uniform1iv(this.addr,s),si(r,s));for(let o=0;o!==i;++o)n.setTextureCube(e[o]||p6,s[o])}function Yve(t,e,n){const r=this.cache,i=e.length,s=ZS(n,i);ii(r,s)||(t.uniform1iv(this.addr,s),si(r,s));for(let o=0;o!==i;++o)n.setTexture2DArray(e[o]||f6,s[o])}function Zve(t){switch(t){case 5126:return Ive;case 35664:return kve;case 35665:return Ove;case 35666:return Lve;case 35674:return Dve;case 35675:return Uve;case 35676:return jve;case 5124:case 35670:return Fve;case 35667:case 35671:return zve;case 35668:case 35672:return Bve;case 35669:case 35673:return Hve;case 5125:return Vve;case 36294:return Gve;case 36295:return Wve;case 36296:return $ve;case 35678:case 36198:case 36298:case 36306:case 35682:return Xve;case 35679:case 36299:case 36307:return qve;case 35680:case 36300:case 36308:case 36293:return Kve;case 36289:case 36303:case 36311:case 36292:return Yve}}class Qve{constructor(e,n,r){this.id=e,this.addr=r,this.cache=[],this.type=n.type,this.setValue=Nve(n.type)}}class Jve{constructor(e,n,r){this.id=e,this.addr=r,this.cache=[],this.type=n.type,this.size=n.size,this.setValue=Zve(n.type)}}class e0e{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,n,r){const i=this.seq;for(let s=0,o=i.length;s!==o;++s){const a=i[s];a.setValue(e,n[a.id],r)}}}const yA=/(\w+)(\])?(\[|\.)?/g;function mD(t,e){t.seq.push(e),t.map[e.id]=e}function t0e(t,e,n){const r=t.name,i=r.length;for(yA.lastIndex=0;;){const s=yA.exec(r),o=yA.lastIndex;let a=s[1];const l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===i){mD(n,c===void 0?new Qve(a,t,e):new Jve(a,t,e));break}else{let f=n.map[a];f===void 0&&(f=new e0e(a),mD(n,f)),n=f}}}class X_{constructor(e,n){this.seq=[],this.map={};const r=e.getProgramParameter(n,e.ACTIVE_UNIFORMS);for(let i=0;i<r;++i){const s=e.getActiveUniform(n,i),o=e.getUniformLocation(n,s.name);t0e(s,o,this)}}setValue(e,n,r,i){const s=this.map[n];s!==void 0&&s.setValue(e,r,i)}setOptional(e,n,r){const i=n[r];i!==void 0&&this.setValue(e,r,i)}static upload(e,n,r,i){for(let s=0,o=n.length;s!==o;++s){const a=n[s],l=r[a.id];l.needsUpdate!==!1&&a.setValue(e,l.value,i)}}static seqWithValue(e,n){const r=[];for(let i=0,s=e.length;i!==s;++i){const o=e[i];o.id in n&&r.push(o)}return r}}function gD(t,e,n){const r=t.createShader(e);return t.shaderSource(r,n),t.compileShader(r),r}const n0e=37297;let r0e=0;function i0e(t,e){const n=t.split(`
|
||
`),r=[],i=Math.max(e-6,0),s=Math.min(e+6,n.length);for(let o=i;o<s;o++){const a=o+1;r.push(`${a===e?">":" "} ${a}: ${n[o]}`)}return r.join(`
|
||
`)}function s0e(t){const e=In.getPrimaries(In.workingColorSpace),n=In.getPrimaries(t);let r;switch(e===n?r="":e===Py&&n===Cy?r="LinearDisplayP3ToLinearSRGB":e===Cy&&n===Py&&(r="LinearSRGBToLinearDisplayP3"),t){case xi:case lx:return[r,"LinearTransferOETF"];case ji:case KS:return[r,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",t),[r,"LinearTransferOETF"]}}function vD(t,e,n){const r=t.getShaderParameter(e,t.COMPILE_STATUS),i=t.getShaderInfoLog(e).trim();if(r&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const o=parseInt(s[1]);return n.toUpperCase()+`
|
||
|
||
`+i+`
|
||
|
||
`+i0e(t.getShaderSource(e),o)}else return i}function o0e(t,e){const n=s0e(e);return`vec4 ${t}( vec4 value ) { return ${n[0]}( ${n[1]}( value ) ); }`}function a0e(t,e){let n;switch(e){case OV:n="Linear";break;case LV:n="Reinhard";break;case DV:n="Cineon";break;case l2:n="ACESFilmic";break;case jV:n="AgX";break;case FV:n="Neutral";break;case UV:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const n_=new X;function l0e(){In.getLuminanceCoefficients(n_);const t=n_.x.toFixed(4),e=n_.y.toFixed(4),n=n_.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${t}, ${e}, ${n} );`," return dot( weights, rgb );","}"].join(`
|
||
`)}function c0e(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(F0).join(`
|
||
`)}function u0e(t){const e=[];for(const n in t){const r=t[n];r!==!1&&e.push("#define "+n+" "+r)}return e.join(`
|
||
`)}function d0e(t,e){const n={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let i=0;i<r;i++){const s=t.getActiveAttrib(e,i),o=s.name;let a=1;s.type===t.FLOAT_MAT2&&(a=2),s.type===t.FLOAT_MAT3&&(a=3),s.type===t.FLOAT_MAT4&&(a=4),n[o]={type:s.type,location:t.getAttribLocation(e,o),locationSize:a}}return n}function F0(t){return t!==""}function yD(t,e){const n=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function xD(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const f0e=/^[ \t]*#include +<([\w\d./]+)>/gm;function $C(t){return t.replace(f0e,p0e)}const h0e=new Map;function p0e(t,e){let n=hn[e];if(n===void 0){const r=h0e.get(e);if(r!==void 0)n=hn[r],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,r);else throw new Error("Can not resolve #include <"+e+">")}return $C(n)}const m0e=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function bD(t){return t.replace(m0e,g0e)}function g0e(t,e,n,r){let i="";for(let s=parseInt(e);s<parseInt(n);s++)i+=r.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return i}function _D(t){let e=`precision ${t.precision} float;
|
||
precision ${t.precision} int;
|
||
precision ${t.precision} sampler2D;
|
||
precision ${t.precision} samplerCube;
|
||
precision ${t.precision} sampler3D;
|
||
precision ${t.precision} sampler2DArray;
|
||
precision ${t.precision} sampler2DShadow;
|
||
precision ${t.precision} samplerCubeShadow;
|
||
precision ${t.precision} sampler2DArrayShadow;
|
||
precision ${t.precision} isampler2D;
|
||
precision ${t.precision} isampler3D;
|
||
precision ${t.precision} isamplerCube;
|
||
precision ${t.precision} isampler2DArray;
|
||
precision ${t.precision} usampler2D;
|
||
precision ${t.precision} usampler3D;
|
||
precision ${t.precision} usamplerCube;
|
||
precision ${t.precision} usampler2DArray;
|
||
`;return t.precision==="highp"?e+=`
|
||
#define HIGH_PRECISION`:t.precision==="mediump"?e+=`
|
||
#define MEDIUM_PRECISION`:t.precision==="lowp"&&(e+=`
|
||
#define LOW_PRECISION`),e}function v0e(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===FS?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===W0?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===Oa&&(e="SHADOWMAP_TYPE_VSM"),e}function y0e(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case Jc:case Cd:e="ENVMAP_TYPE_CUBE";break;case Jg:e="ENVMAP_TYPE_CUBE_UV";break}return e}function x0e(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case Cd:e="ENVMAP_MODE_REFRACTION";break}return e}function b0e(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case ox:e="ENVMAP_BLENDING_MULTIPLY";break;case IV:e="ENVMAP_BLENDING_MIX";break;case kV:e="ENVMAP_BLENDING_ADD";break}return e}function _0e(t){const e=t.envMapCubeUVHeight;if(e===null)return null;const n=Math.log2(e)-2,r=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:r,maxMip:n}}function w0e(t,e,n,r){const i=t.getContext(),s=n.defines;let o=n.vertexShader,a=n.fragmentShader;const l=v0e(n),c=y0e(n),d=x0e(n),f=b0e(n),m=_0e(n),y=c0e(n),x=u0e(s),S=i.createProgram();let _,w,A=n.glslVersion?"#version "+n.glslVersion+`
|
||
`:"";n.isRawShaderMaterial?(_=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x].filter(F0).join(`
|
||
`),_.length>0&&(_+=`
|
||
`),w=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x].filter(F0).join(`
|
||
`),w.length>0&&(w+=`
|
||
`)):(_=[_D(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
|
||
`].filter(F0).join(`
|
||
`),w=[_D(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+d:"",n.envMap?"#define "+f:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Cl?"#define TONE_MAPPING":"",n.toneMapping!==Cl?hn.tonemapping_pars_fragment:"",n.toneMapping!==Cl?a0e("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",hn.colorspace_pars_fragment,o0e("linearToOutputTexel",n.outputColorSpace),l0e(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
|
||
`].filter(F0).join(`
|
||
`)),o=$C(o),o=yD(o,n),o=xD(o,n),a=$C(a),a=yD(a,n),a=xD(a,n),o=bD(o),a=bD(a),n.isRawShaderMaterial!==!0&&(A=`#version 300 es
|
||
`,_=[y,"#define attribute in","#define varying out","#define texture2D texture"].join(`
|
||
`)+`
|
||
`+_,w=["#define varying in",n.glslVersion===GC?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===GC?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
|
||
`)+`
|
||
`+w);const T=A+_+o,C=A+w+a,O=gD(i,i.VERTEX_SHADER,T),N=gD(i,i.FRAGMENT_SHADER,C);i.attachShader(S,O),i.attachShader(S,N),n.index0AttributeName!==void 0?i.bindAttribLocation(S,0,n.index0AttributeName):n.morphTargets===!0&&i.bindAttribLocation(S,0,"position"),i.linkProgram(S);function D(j){if(t.debug.checkShaderErrors){const H=i.getProgramInfoLog(S).trim(),ne=i.getShaderInfoLog(O).trim(),te=i.getShaderInfoLog(N).trim();let pe=!0,oe=!0;if(i.getProgramParameter(S,i.LINK_STATUS)===!1)if(pe=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(i,S,O,N);else{const ce=vD(i,O,"vertex"),B=vD(i,N,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(S,i.VALIDATE_STATUS)+`
|
||
|
||
Material Name: `+j.name+`
|
||
Material Type: `+j.type+`
|
||
|
||
Program Info Log: `+H+`
|
||
`+ce+`
|
||
`+B)}else H!==""?console.warn("THREE.WebGLProgram: Program Info Log:",H):(ne===""||te==="")&&(oe=!1);oe&&(j.diagnostics={runnable:pe,programLog:H,vertexShader:{log:ne,prefix:_},fragmentShader:{log:te,prefix:w}})}i.deleteShader(O),i.deleteShader(N),F=new X_(i,S),V=d0e(i,S)}let F;this.getUniforms=function(){return F===void 0&&D(this),F};let V;this.getAttributes=function(){return V===void 0&&D(this),V};let k=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return k===!1&&(k=i.getProgramParameter(S,n0e)),k},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(S),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=r0e++,this.cacheKey=e,this.usedTimes=1,this.program=S,this.vertexShader=O,this.fragmentShader=N,this}let S0e=0;class M0e{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,r=e.fragmentShader,i=this._getShaderStage(n),s=this._getShaderStage(r),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const n=this.materialCache.get(e);for(const r of n)r.usedTimes--,r.usedTimes===0&&this.shaderCache.delete(r.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const n=this.materialCache;let r=n.get(e);return r===void 0&&(r=new Set,n.set(e,r)),r}_getShaderStage(e){const n=this.shaderCache;let r=n.get(e);return r===void 0&&(r=new E0e(e),n.set(e,r)),r}}class E0e{constructor(e){this.id=S0e++,this.code=e,this.usedTimes=0}}function A0e(t,e,n,r,i,s,o){const a=new Ah,l=new M0e,c=new Set,d=[],f=i.logarithmicDepthBuffer,m=i.reverseDepthBuffer,y=i.vertexTextures;let x=i.precision;const S={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(k){return c.add(k),k===0?"uv":`uv${k}`}function w(k,j,H,ne,te){const pe=ne.fog,oe=te.geometry,ce=k.isMeshStandardMaterial?ne.environment:null,B=(k.isMeshStandardMaterial?n:e).get(k.envMap||ce),K=B&&B.mapping===Jg?B.image.height:null,q=S[k.type];k.precision!==null&&(x=i.getMaxPrecision(k.precision),x!==k.precision&&console.warn("THREE.WebGLProgram.getParameters:",k.precision,"not supported, using",x,"instead."));const $=oe.morphAttributes.position||oe.morphAttributes.normal||oe.morphAttributes.color,Z=$!==void 0?$.length:0;let ge=0;oe.morphAttributes.position!==void 0&&(ge=1),oe.morphAttributes.normal!==void 0&&(ge=2),oe.morphAttributes.color!==void 0&&(ge=3);let ae,fe,_e,Se;if(q){const Hn=Da[q];ae=Hn.vertexShader,fe=Hn.fragmentShader}else ae=k.vertexShader,fe=k.fragmentShader,l.update(k),_e=l.getVertexShaderID(k),Se=l.getFragmentShaderID(k);const $e=t.getRenderTarget(),Me=te.isInstancedMesh===!0,He=te.isBatchedMesh===!0,Xe=!!k.map,ue=!!k.matcap,Q=!!B,Ge=!!k.aoMap,Ue=!!k.lightMap,We=!!k.bumpMap,Qe=!!k.normalMap,xt=!!k.displacementMap,at=!!k.emissiveMap,ee=!!k.metalnessMap,W=!!k.roughnessMap,Ee=k.anisotropy>0,Be=k.clearcoat>0,le=k.dispersion>0,Ce=k.iridescence>0,lt=k.sheen>0,rt=k.transmission>0,ft=Ee&&!!k.anisotropyMap,nn=Be&&!!k.clearcoatMap,qe=Be&&!!k.clearcoatNormalMap,dt=Be&&!!k.clearcoatRoughnessMap,Dt=Ce&&!!k.iridescenceMap,Ut=Ce&&!!k.iridescenceThicknessMap,pt=lt&&!!k.sheenColorMap,de=lt&&!!k.sheenRoughnessMap,J=!!k.specularMap,Ae=!!k.specularColorMap,re=!!k.specularIntensityMap,Fe=rt&&!!k.transmissionMap,Te=rt&&!!k.thicknessMap,Le=!!k.gradientMap,Ke=!!k.alphaMap,ut=k.alphaTest>0,Kt=!!k.alphaHash,un=!!k.extensions;let Cn=Cl;k.toneMapped&&($e===null||$e.isXRRenderTarget===!0)&&(Cn=t.toneMapping);const Jt={shaderID:q,shaderType:k.type,shaderName:k.name,vertexShader:ae,fragmentShader:fe,defines:k.defines,customVertexShaderID:_e,customFragmentShaderID:Se,isRawShaderMaterial:k.isRawShaderMaterial===!0,glslVersion:k.glslVersion,precision:x,batching:He,batchingColor:He&&te._colorsTexture!==null,instancing:Me,instancingColor:Me&&te.instanceColor!==null,instancingMorph:Me&&te.morphTexture!==null,supportsVertexTextures:y,outputColorSpace:$e===null?t.outputColorSpace:$e.isXRRenderTarget===!0?$e.texture.colorSpace:xi,alphaToCoverage:!!k.alphaToCoverage,map:Xe,matcap:ue,envMap:Q,envMapMode:Q&&B.mapping,envMapCubeUVHeight:K,aoMap:Ge,lightMap:Ue,bumpMap:We,normalMap:Qe,displacementMap:y&&xt,emissiveMap:at,normalMapObjectSpace:Qe&&k.normalMapType===XV,normalMapTangentSpace:Qe&&k.normalMapType===lu,metalnessMap:ee,roughnessMap:W,anisotropy:Ee,anisotropyMap:ft,clearcoat:Be,clearcoatMap:nn,clearcoatNormalMap:qe,clearcoatRoughnessMap:dt,dispersion:le,iridescence:Ce,iridescenceMap:Dt,iridescenceThicknessMap:Ut,sheen:lt,sheenColorMap:pt,sheenRoughnessMap:de,specularMap:J,specularColorMap:Ae,specularIntensityMap:re,transmission:rt,transmissionMap:Fe,thicknessMap:Te,gradientMap:Le,opaque:k.transparent===!1&&k.blending===Sh&&k.alphaToCoverage===!1,alphaMap:Ke,alphaTest:ut,alphaHash:Kt,combine:k.combine,mapUv:Xe&&_(k.map.channel),aoMapUv:Ge&&_(k.aoMap.channel),lightMapUv:Ue&&_(k.lightMap.channel),bumpMapUv:We&&_(k.bumpMap.channel),normalMapUv:Qe&&_(k.normalMap.channel),displacementMapUv:xt&&_(k.displacementMap.channel),emissiveMapUv:at&&_(k.emissiveMap.channel),metalnessMapUv:ee&&_(k.metalnessMap.channel),roughnessMapUv:W&&_(k.roughnessMap.channel),anisotropyMapUv:ft&&_(k.anisotropyMap.channel),clearcoatMapUv:nn&&_(k.clearcoatMap.channel),clearcoatNormalMapUv:qe&&_(k.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:dt&&_(k.clearcoatRoughnessMap.channel),iridescenceMapUv:Dt&&_(k.iridescenceMap.channel),iridescenceThicknessMapUv:Ut&&_(k.iridescenceThicknessMap.channel),sheenColorMapUv:pt&&_(k.sheenColorMap.channel),sheenRoughnessMapUv:de&&_(k.sheenRoughnessMap.channel),specularMapUv:J&&_(k.specularMap.channel),specularColorMapUv:Ae&&_(k.specularColorMap.channel),specularIntensityMapUv:re&&_(k.specularIntensityMap.channel),transmissionMapUv:Fe&&_(k.transmissionMap.channel),thicknessMapUv:Te&&_(k.thicknessMap.channel),alphaMapUv:Ke&&_(k.alphaMap.channel),vertexTangents:!!oe.attributes.tangent&&(Qe||Ee),vertexColors:k.vertexColors,vertexAlphas:k.vertexColors===!0&&!!oe.attributes.color&&oe.attributes.color.itemSize===4,pointsUvs:te.isPoints===!0&&!!oe.attributes.uv&&(Xe||Ke),fog:!!pe,useFog:k.fog===!0,fogExp2:!!pe&&pe.isFogExp2,flatShading:k.flatShading===!0,sizeAttenuation:k.sizeAttenuation===!0,logarithmicDepthBuffer:f,reverseDepthBuffer:m,skinning:te.isSkinnedMesh===!0,morphTargets:oe.morphAttributes.position!==void 0,morphNormals:oe.morphAttributes.normal!==void 0,morphColors:oe.morphAttributes.color!==void 0,morphTargetsCount:Z,morphTextureStride:ge,numDirLights:j.directional.length,numPointLights:j.point.length,numSpotLights:j.spot.length,numSpotLightMaps:j.spotLightMap.length,numRectAreaLights:j.rectArea.length,numHemiLights:j.hemi.length,numDirLightShadows:j.directionalShadowMap.length,numPointLightShadows:j.pointShadowMap.length,numSpotLightShadows:j.spotShadowMap.length,numSpotLightShadowsWithMaps:j.numSpotLightShadowsWithMaps,numLightProbes:j.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:k.dithering,shadowMapEnabled:t.shadowMap.enabled&&H.length>0,shadowMapType:t.shadowMap.type,toneMapping:Cn,decodeVideoTexture:Xe&&k.map.isVideoTexture===!0&&In.getTransfer(k.map.colorSpace)===Jn,premultipliedAlpha:k.premultipliedAlpha,doubleSided:k.side===xo,flipSided:k.side===ss,useDepthPacking:k.depthPacking>=0,depthPacking:k.depthPacking||0,index0AttributeName:k.index0AttributeName,extensionClipCullDistance:un&&k.extensions.clipCullDistance===!0&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(un&&k.extensions.multiDraw===!0||He)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:k.customProgramCacheKey()};return Jt.vertexUv1s=c.has(1),Jt.vertexUv2s=c.has(2),Jt.vertexUv3s=c.has(3),c.clear(),Jt}function A(k){const j=[];if(k.shaderID?j.push(k.shaderID):(j.push(k.customVertexShaderID),j.push(k.customFragmentShaderID)),k.defines!==void 0)for(const H in k.defines)j.push(H),j.push(k.defines[H]);return k.isRawShaderMaterial===!1&&(T(j,k),C(j,k),j.push(t.outputColorSpace)),j.push(k.customProgramCacheKey),j.join()}function T(k,j){k.push(j.precision),k.push(j.outputColorSpace),k.push(j.envMapMode),k.push(j.envMapCubeUVHeight),k.push(j.mapUv),k.push(j.alphaMapUv),k.push(j.lightMapUv),k.push(j.aoMapUv),k.push(j.bumpMapUv),k.push(j.normalMapUv),k.push(j.displacementMapUv),k.push(j.emissiveMapUv),k.push(j.metalnessMapUv),k.push(j.roughnessMapUv),k.push(j.anisotropyMapUv),k.push(j.clearcoatMapUv),k.push(j.clearcoatNormalMapUv),k.push(j.clearcoatRoughnessMapUv),k.push(j.iridescenceMapUv),k.push(j.iridescenceThicknessMapUv),k.push(j.sheenColorMapUv),k.push(j.sheenRoughnessMapUv),k.push(j.specularMapUv),k.push(j.specularColorMapUv),k.push(j.specularIntensityMapUv),k.push(j.transmissionMapUv),k.push(j.thicknessMapUv),k.push(j.combine),k.push(j.fogExp2),k.push(j.sizeAttenuation),k.push(j.morphTargetsCount),k.push(j.morphAttributeCount),k.push(j.numDirLights),k.push(j.numPointLights),k.push(j.numSpotLights),k.push(j.numSpotLightMaps),k.push(j.numHemiLights),k.push(j.numRectAreaLights),k.push(j.numDirLightShadows),k.push(j.numPointLightShadows),k.push(j.numSpotLightShadows),k.push(j.numSpotLightShadowsWithMaps),k.push(j.numLightProbes),k.push(j.shadowMapType),k.push(j.toneMapping),k.push(j.numClippingPlanes),k.push(j.numClipIntersection),k.push(j.depthPacking)}function C(k,j){a.disableAll(),j.supportsVertexTextures&&a.enable(0),j.instancing&&a.enable(1),j.instancingColor&&a.enable(2),j.instancingMorph&&a.enable(3),j.matcap&&a.enable(4),j.envMap&&a.enable(5),j.normalMapObjectSpace&&a.enable(6),j.normalMapTangentSpace&&a.enable(7),j.clearcoat&&a.enable(8),j.iridescence&&a.enable(9),j.alphaTest&&a.enable(10),j.vertexColors&&a.enable(11),j.vertexAlphas&&a.enable(12),j.vertexUv1s&&a.enable(13),j.vertexUv2s&&a.enable(14),j.vertexUv3s&&a.enable(15),j.vertexTangents&&a.enable(16),j.anisotropy&&a.enable(17),j.alphaHash&&a.enable(18),j.batching&&a.enable(19),j.dispersion&&a.enable(20),j.batchingColor&&a.enable(21),k.push(a.mask),a.disableAll(),j.fog&&a.enable(0),j.useFog&&a.enable(1),j.flatShading&&a.enable(2),j.logarithmicDepthBuffer&&a.enable(3),j.reverseDepthBuffer&&a.enable(4),j.skinning&&a.enable(5),j.morphTargets&&a.enable(6),j.morphNormals&&a.enable(7),j.morphColors&&a.enable(8),j.premultipliedAlpha&&a.enable(9),j.shadowMapEnabled&&a.enable(10),j.doubleSided&&a.enable(11),j.flipSided&&a.enable(12),j.useDepthPacking&&a.enable(13),j.dithering&&a.enable(14),j.transmission&&a.enable(15),j.sheen&&a.enable(16),j.opaque&&a.enable(17),j.pointsUvs&&a.enable(18),j.decodeVideoTexture&&a.enable(19),j.alphaToCoverage&&a.enable(20),k.push(a.mask)}function O(k){const j=S[k.type];let H;if(j){const ne=Da[j];H=E2.clone(ne.uniforms)}else H=k.uniforms;return H}function N(k,j){let H;for(let ne=0,te=d.length;ne<te;ne++){const pe=d[ne];if(pe.cacheKey===j){H=pe,++H.usedTimes;break}}return H===void 0&&(H=new w0e(t,j,k,s),d.push(H)),H}function D(k){if(--k.usedTimes===0){const j=d.indexOf(k);d[j]=d[d.length-1],d.pop(),k.destroy()}}function F(k){l.remove(k)}function V(){l.dispose()}return{getParameters:w,getProgramCacheKey:A,getUniforms:O,acquireProgram:N,releaseProgram:D,releaseShaderCache:F,programs:d,dispose:V}}function T0e(){let t=new WeakMap;function e(o){return t.has(o)}function n(o){let a=t.get(o);return a===void 0&&(a={},t.set(o,a)),a}function r(o){t.delete(o)}function i(o,a,l){t.get(o)[a]=l}function s(){t=new WeakMap}return{has:e,get:n,remove:r,update:i,dispose:s}}function C0e(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function wD(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function SD(){const t=[];let e=0;const n=[],r=[],i=[];function s(){e=0,n.length=0,r.length=0,i.length=0}function o(f,m,y,x,S,_){let w=t[e];return w===void 0?(w={id:f.id,object:f,geometry:m,material:y,groupOrder:x,renderOrder:f.renderOrder,z:S,group:_},t[e]=w):(w.id=f.id,w.object=f,w.geometry=m,w.material=y,w.groupOrder=x,w.renderOrder=f.renderOrder,w.z=S,w.group=_),e++,w}function a(f,m,y,x,S,_){const w=o(f,m,y,x,S,_);y.transmission>0?r.push(w):y.transparent===!0?i.push(w):n.push(w)}function l(f,m,y,x,S,_){const w=o(f,m,y,x,S,_);y.transmission>0?r.unshift(w):y.transparent===!0?i.unshift(w):n.unshift(w)}function c(f,m){n.length>1&&n.sort(f||C0e),r.length>1&&r.sort(m||wD),i.length>1&&i.sort(m||wD)}function d(){for(let f=e,m=t.length;f<m;f++){const y=t[f];if(y.id===null)break;y.id=null,y.object=null,y.geometry=null,y.material=null,y.group=null}}return{opaque:n,transmissive:r,transparent:i,init:s,push:a,unshift:l,finish:d,sort:c}}function P0e(){let t=new WeakMap;function e(r,i){const s=t.get(r);let o;return s===void 0?(o=new SD,t.set(r,[o])):i>=s.length?(o=new SD,s.push(o)):o=s[i],o}function n(){t=new WeakMap}return{get:e,dispose:n}}function R0e(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new X,color:new ot};break;case"SpotLight":n={position:new X,direction:new X,color:new ot,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new X,color:new ot,distance:0,decay:0};break;case"HemisphereLight":n={direction:new X,skyColor:new ot,groundColor:new ot};break;case"RectAreaLight":n={color:new ot,position:new X,halfWidth:new X,halfHeight:new X};break}return t[e.id]=n,n}}}function N0e(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ve};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ve};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ve,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let I0e=0;function k0e(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function O0e(t){const e=new R0e,n=N0e(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)r.probe.push(new X);const i=new X,s=new Ct,o=new Ct;function a(c){let d=0,f=0,m=0;for(let V=0;V<9;V++)r.probe[V].set(0,0,0);let y=0,x=0,S=0,_=0,w=0,A=0,T=0,C=0,O=0,N=0,D=0;c.sort(k0e);for(let V=0,k=c.length;V<k;V++){const j=c[V],H=j.color,ne=j.intensity,te=j.distance,pe=j.shadow&&j.shadow.map?j.shadow.map.texture:null;if(j.isAmbientLight)d+=H.r*ne,f+=H.g*ne,m+=H.b*ne;else if(j.isLightProbe){for(let oe=0;oe<9;oe++)r.probe[oe].addScaledVector(j.sh.coefficients[oe],ne);D++}else if(j.isDirectionalLight){const oe=e.get(j);if(oe.color.copy(j.color).multiplyScalar(j.intensity),j.castShadow){const ce=j.shadow,B=n.get(j);B.shadowIntensity=ce.intensity,B.shadowBias=ce.bias,B.shadowNormalBias=ce.normalBias,B.shadowRadius=ce.radius,B.shadowMapSize=ce.mapSize,r.directionalShadow[y]=B,r.directionalShadowMap[y]=pe,r.directionalShadowMatrix[y]=j.shadow.matrix,A++}r.directional[y]=oe,y++}else if(j.isSpotLight){const oe=e.get(j);oe.position.setFromMatrixPosition(j.matrixWorld),oe.color.copy(H).multiplyScalar(ne),oe.distance=te,oe.coneCos=Math.cos(j.angle),oe.penumbraCos=Math.cos(j.angle*(1-j.penumbra)),oe.decay=j.decay,r.spot[S]=oe;const ce=j.shadow;if(j.map&&(r.spotLightMap[O]=j.map,O++,ce.updateMatrices(j),j.castShadow&&N++),r.spotLightMatrix[S]=ce.matrix,j.castShadow){const B=n.get(j);B.shadowIntensity=ce.intensity,B.shadowBias=ce.bias,B.shadowNormalBias=ce.normalBias,B.shadowRadius=ce.radius,B.shadowMapSize=ce.mapSize,r.spotShadow[S]=B,r.spotShadowMap[S]=pe,C++}S++}else if(j.isRectAreaLight){const oe=e.get(j);oe.color.copy(H).multiplyScalar(ne),oe.halfWidth.set(j.width*.5,0,0),oe.halfHeight.set(0,j.height*.5,0),r.rectArea[_]=oe,_++}else if(j.isPointLight){const oe=e.get(j);if(oe.color.copy(j.color).multiplyScalar(j.intensity),oe.distance=j.distance,oe.decay=j.decay,j.castShadow){const ce=j.shadow,B=n.get(j);B.shadowIntensity=ce.intensity,B.shadowBias=ce.bias,B.shadowNormalBias=ce.normalBias,B.shadowRadius=ce.radius,B.shadowMapSize=ce.mapSize,B.shadowCameraNear=ce.camera.near,B.shadowCameraFar=ce.camera.far,r.pointShadow[x]=B,r.pointShadowMap[x]=pe,r.pointShadowMatrix[x]=j.shadow.matrix,T++}r.point[x]=oe,x++}else if(j.isHemisphereLight){const oe=e.get(j);oe.skyColor.copy(j.color).multiplyScalar(ne),oe.groundColor.copy(j.groundColor).multiplyScalar(ne),r.hemi[w]=oe,w++}}_>0&&(t.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=ht.LTC_FLOAT_1,r.rectAreaLTC2=ht.LTC_FLOAT_2):(r.rectAreaLTC1=ht.LTC_HALF_1,r.rectAreaLTC2=ht.LTC_HALF_2)),r.ambient[0]=d,r.ambient[1]=f,r.ambient[2]=m;const F=r.hash;(F.directionalLength!==y||F.pointLength!==x||F.spotLength!==S||F.rectAreaLength!==_||F.hemiLength!==w||F.numDirectionalShadows!==A||F.numPointShadows!==T||F.numSpotShadows!==C||F.numSpotMaps!==O||F.numLightProbes!==D)&&(r.directional.length=y,r.spot.length=S,r.rectArea.length=_,r.point.length=x,r.hemi.length=w,r.directionalShadow.length=A,r.directionalShadowMap.length=A,r.pointShadow.length=T,r.pointShadowMap.length=T,r.spotShadow.length=C,r.spotShadowMap.length=C,r.directionalShadowMatrix.length=A,r.pointShadowMatrix.length=T,r.spotLightMatrix.length=C+O-N,r.spotLightMap.length=O,r.numSpotLightShadowsWithMaps=N,r.numLightProbes=D,F.directionalLength=y,F.pointLength=x,F.spotLength=S,F.rectAreaLength=_,F.hemiLength=w,F.numDirectionalShadows=A,F.numPointShadows=T,F.numSpotShadows=C,F.numSpotMaps=O,F.numLightProbes=D,r.version=I0e++)}function l(c,d){let f=0,m=0,y=0,x=0,S=0;const _=d.matrixWorldInverse;for(let w=0,A=c.length;w<A;w++){const T=c[w];if(T.isDirectionalLight){const C=r.directional[f];C.direction.setFromMatrixPosition(T.matrixWorld),i.setFromMatrixPosition(T.target.matrixWorld),C.direction.sub(i),C.direction.transformDirection(_),f++}else if(T.isSpotLight){const C=r.spot[y];C.position.setFromMatrixPosition(T.matrixWorld),C.position.applyMatrix4(_),C.direction.setFromMatrixPosition(T.matrixWorld),i.setFromMatrixPosition(T.target.matrixWorld),C.direction.sub(i),C.direction.transformDirection(_),y++}else if(T.isRectAreaLight){const C=r.rectArea[x];C.position.setFromMatrixPosition(T.matrixWorld),C.position.applyMatrix4(_),o.identity(),s.copy(T.matrixWorld),s.premultiply(_),o.extractRotation(s),C.halfWidth.set(T.width*.5,0,0),C.halfHeight.set(0,T.height*.5,0),C.halfWidth.applyMatrix4(o),C.halfHeight.applyMatrix4(o),x++}else if(T.isPointLight){const C=r.point[m];C.position.setFromMatrixPosition(T.matrixWorld),C.position.applyMatrix4(_),m++}else if(T.isHemisphereLight){const C=r.hemi[S];C.direction.setFromMatrixPosition(T.matrixWorld),C.direction.transformDirection(_),S++}}}return{setup:a,setupView:l,state:r}}function MD(t){const e=new O0e(t),n=[],r=[];function i(d){c.camera=d,n.length=0,r.length=0}function s(d){n.push(d)}function o(d){r.push(d)}function a(){e.setup(n)}function l(d){e.setupView(n,d)}const c={lightsArray:n,shadowsArray:r,camera:null,lights:e,transmissionRenderTarget:{}};return{init:i,state:c,setupLights:a,setupLightsView:l,pushLight:s,pushShadow:o}}function L0e(t){let e=new WeakMap;function n(i,s=0){const o=e.get(i);let a;return o===void 0?(a=new MD(t),e.set(i,[a])):s>=o.length?(a=new MD(t),o.push(a)):a=o[s],a}function r(){e=new WeakMap}return{get:n,dispose:r}}class C2 extends Gr{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=WV,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class P2 extends Gr{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const D0e=`void main() {
|
||
gl_Position = vec4( position, 1.0 );
|
||
}`,U0e=`uniform sampler2D shadow_pass;
|
||
uniform vec2 resolution;
|
||
uniform float radius;
|
||
#include <packing>
|
||
void main() {
|
||
const float samples = float( VSM_SAMPLES );
|
||
float mean = 0.0;
|
||
float squared_mean = 0.0;
|
||
float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
|
||
float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
|
||
for ( float i = 0.0; i < samples; i ++ ) {
|
||
float uvOffset = uvStart + i * uvStride;
|
||
#ifdef HORIZONTAL_PASS
|
||
vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
|
||
mean += distribution.x;
|
||
squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
|
||
#else
|
||
float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
|
||
mean += depth;
|
||
squared_mean += depth * depth;
|
||
#endif
|
||
}
|
||
mean = mean / samples;
|
||
squared_mean = squared_mean / samples;
|
||
float std_dev = sqrt( squared_mean - mean * mean );
|
||
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
|
||
}`;function j0e(t,e,n){let r=new dx;const i=new Ve,s=new Ve,o=new Ln,a=new C2({depthPacking:$V}),l=new P2,c={},d=n.maxTextureSize,f={[Dl]:ss,[ss]:Dl,[xo]:xo},m=new Qo({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ve},radius:{value:4}},vertexShader:D0e,fragmentShader:U0e}),y=m.clone();y.defines.HORIZONTAL_PASS=1;const x=new Zt;x.setAttribute("position",new Qt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const S=new yr(x,m),_=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=FS;let w=this.type;this.render=function(N,D,F){if(_.enabled===!1||_.autoUpdate===!1&&_.needsUpdate===!1||N.length===0)return;const V=t.getRenderTarget(),k=t.getActiveCubeFace(),j=t.getActiveMipmapLevel(),H=t.state;H.setBlending(Wc),H.buffers.color.setClear(1,1,1,1),H.buffers.depth.setTest(!0),H.setScissorTest(!1);const ne=w!==Oa&&this.type===Oa,te=w===Oa&&this.type!==Oa;for(let pe=0,oe=N.length;pe<oe;pe++){const ce=N[pe],B=ce.shadow;if(B===void 0){console.warn("THREE.WebGLShadowMap:",ce,"has no shadow.");continue}if(B.autoUpdate===!1&&B.needsUpdate===!1)continue;i.copy(B.mapSize);const K=B.getFrameExtents();if(i.multiply(K),s.copy(B.mapSize),(i.x>d||i.y>d)&&(i.x>d&&(s.x=Math.floor(d/K.x),i.x=s.x*K.x,B.mapSize.x=s.x),i.y>d&&(s.y=Math.floor(d/K.y),i.y=s.y*K.y,B.mapSize.y=s.y)),B.map===null||ne===!0||te===!0){const $=this.type!==Oa?{minFilter:ri,magFilter:ri}:{};B.map!==null&&B.map.dispose(),B.map=new Va(i.x,i.y,$),B.map.texture.name=ce.name+".shadowMap",B.camera.updateProjectionMatrix()}t.setRenderTarget(B.map),t.clear();const q=B.getViewportCount();for(let $=0;$<q;$++){const Z=B.getViewport($);o.set(s.x*Z.x,s.y*Z.y,s.x*Z.z,s.y*Z.w),H.viewport(o),B.updateMatrices(ce,$),r=B.getFrustum(),C(D,F,B.camera,ce,this.type)}B.isPointLightShadow!==!0&&this.type===Oa&&A(B,F),B.needsUpdate=!1}w=this.type,_.needsUpdate=!1,t.setRenderTarget(V,k,j)};function A(N,D){const F=e.update(S);m.defines.VSM_SAMPLES!==N.blurSamples&&(m.defines.VSM_SAMPLES=N.blurSamples,y.defines.VSM_SAMPLES=N.blurSamples,m.needsUpdate=!0,y.needsUpdate=!0),N.mapPass===null&&(N.mapPass=new Va(i.x,i.y)),m.uniforms.shadow_pass.value=N.map.texture,m.uniforms.resolution.value=N.mapSize,m.uniforms.radius.value=N.radius,t.setRenderTarget(N.mapPass),t.clear(),t.renderBufferDirect(D,null,F,m,S,null),y.uniforms.shadow_pass.value=N.mapPass.texture,y.uniforms.resolution.value=N.mapSize,y.uniforms.radius.value=N.radius,t.setRenderTarget(N.map),t.clear(),t.renderBufferDirect(D,null,F,y,S,null)}function T(N,D,F,V){let k=null;const j=F.isPointLight===!0?N.customDistanceMaterial:N.customDepthMaterial;if(j!==void 0)k=j;else if(k=F.isPointLight===!0?l:a,t.localClippingEnabled&&D.clipShadows===!0&&Array.isArray(D.clippingPlanes)&&D.clippingPlanes.length!==0||D.displacementMap&&D.displacementScale!==0||D.alphaMap&&D.alphaTest>0||D.map&&D.alphaTest>0){const H=k.uuid,ne=D.uuid;let te=c[H];te===void 0&&(te={},c[H]=te);let pe=te[ne];pe===void 0&&(pe=k.clone(),te[ne]=pe,D.addEventListener("dispose",O)),k=pe}if(k.visible=D.visible,k.wireframe=D.wireframe,V===Oa?k.side=D.shadowSide!==null?D.shadowSide:D.side:k.side=D.shadowSide!==null?D.shadowSide:f[D.side],k.alphaMap=D.alphaMap,k.alphaTest=D.alphaTest,k.map=D.map,k.clipShadows=D.clipShadows,k.clippingPlanes=D.clippingPlanes,k.clipIntersection=D.clipIntersection,k.displacementMap=D.displacementMap,k.displacementScale=D.displacementScale,k.displacementBias=D.displacementBias,k.wireframeLinewidth=D.wireframeLinewidth,k.linewidth=D.linewidth,F.isPointLight===!0&&k.isMeshDistanceMaterial===!0){const H=t.properties.get(k);H.light=F}return k}function C(N,D,F,V,k){if(N.visible===!1)return;if(N.layers.test(D.layers)&&(N.isMesh||N.isLine||N.isPoints)&&(N.castShadow||N.receiveShadow&&k===Oa)&&(!N.frustumCulled||r.intersectsObject(N))){N.modelViewMatrix.multiplyMatrices(F.matrixWorldInverse,N.matrixWorld);const ne=e.update(N),te=N.material;if(Array.isArray(te)){const pe=ne.groups;for(let oe=0,ce=pe.length;oe<ce;oe++){const B=pe[oe],K=te[B.materialIndex];if(K&&K.visible){const q=T(N,K,V,k);N.onBeforeShadow(t,N,D,F,ne,q,B),t.renderBufferDirect(F,null,ne,q,N,B),N.onAfterShadow(t,N,D,F,ne,q,B)}}}else if(te.visible){const pe=T(N,te,V,k);N.onBeforeShadow(t,N,D,F,ne,pe,null),t.renderBufferDirect(F,null,ne,pe,N,null),N.onAfterShadow(t,N,D,F,ne,pe,null)}}const H=N.children;for(let ne=0,te=H.length;ne<te;ne++)C(H[ne],D,F,V,k)}function O(N){N.target.removeEventListener("dispose",O);for(const F in c){const V=c[F],k=N.target.uuid;k in V&&(V[k].dispose(),delete V[k])}}}const F0e={[Qw]:Jw,[e1]:r1,[t1]:i1,[Uh]:n1,[Jw]:Qw,[r1]:e1,[i1]:t1,[n1]:Uh};function z0e(t){function e(){let re=!1;const Fe=new Ln;let Te=null;const Le=new Ln(0,0,0,0);return{setMask:function(Ke){Te!==Ke&&!re&&(t.colorMask(Ke,Ke,Ke,Ke),Te=Ke)},setLocked:function(Ke){re=Ke},setClear:function(Ke,ut,Kt,un,Cn){Cn===!0&&(Ke*=un,ut*=un,Kt*=un),Fe.set(Ke,ut,Kt,un),Le.equals(Fe)===!1&&(t.clearColor(Ke,ut,Kt,un),Le.copy(Fe))},reset:function(){re=!1,Te=null,Le.set(-1,0,0,0)}}}function n(){let re=!1,Fe=!1,Te=null,Le=null,Ke=null;return{setReversed:function(ut){Fe=ut},setTest:function(ut){ut?_e(t.DEPTH_TEST):Se(t.DEPTH_TEST)},setMask:function(ut){Te!==ut&&!re&&(t.depthMask(ut),Te=ut)},setFunc:function(ut){if(Fe&&(ut=F0e[ut]),Le!==ut){switch(ut){case Qw:t.depthFunc(t.NEVER);break;case Jw:t.depthFunc(t.ALWAYS);break;case e1:t.depthFunc(t.LESS);break;case Uh:t.depthFunc(t.LEQUAL);break;case t1:t.depthFunc(t.EQUAL);break;case n1:t.depthFunc(t.GEQUAL);break;case r1:t.depthFunc(t.GREATER);break;case i1:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}Le=ut}},setLocked:function(ut){re=ut},setClear:function(ut){Ke!==ut&&(t.clearDepth(ut),Ke=ut)},reset:function(){re=!1,Te=null,Le=null,Ke=null}}}function r(){let re=!1,Fe=null,Te=null,Le=null,Ke=null,ut=null,Kt=null,un=null,Cn=null;return{setTest:function(Jt){re||(Jt?_e(t.STENCIL_TEST):Se(t.STENCIL_TEST))},setMask:function(Jt){Fe!==Jt&&!re&&(t.stencilMask(Jt),Fe=Jt)},setFunc:function(Jt,Hn,hr){(Te!==Jt||Le!==Hn||Ke!==hr)&&(t.stencilFunc(Jt,Hn,hr),Te=Jt,Le=Hn,Ke=hr)},setOp:function(Jt,Hn,hr){(ut!==Jt||Kt!==Hn||un!==hr)&&(t.stencilOp(Jt,Hn,hr),ut=Jt,Kt=Hn,un=hr)},setLocked:function(Jt){re=Jt},setClear:function(Jt){Cn!==Jt&&(t.clearStencil(Jt),Cn=Jt)},reset:function(){re=!1,Fe=null,Te=null,Le=null,Ke=null,ut=null,Kt=null,un=null,Cn=null}}}const i=new e,s=new n,o=new r,a=new WeakMap,l=new WeakMap;let c={},d={},f=new WeakMap,m=[],y=null,x=!1,S=null,_=null,w=null,A=null,T=null,C=null,O=null,N=new ot(0,0,0),D=0,F=!1,V=null,k=null,j=null,H=null,ne=null;const te=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let pe=!1,oe=0;const ce=t.getParameter(t.VERSION);ce.indexOf("WebGL")!==-1?(oe=parseFloat(/^WebGL (\d)/.exec(ce)[1]),pe=oe>=1):ce.indexOf("OpenGL ES")!==-1&&(oe=parseFloat(/^OpenGL ES (\d)/.exec(ce)[1]),pe=oe>=2);let B=null,K={};const q=t.getParameter(t.SCISSOR_BOX),$=t.getParameter(t.VIEWPORT),Z=new Ln().fromArray(q),ge=new Ln().fromArray($);function ae(re,Fe,Te,Le){const Ke=new Uint8Array(4),ut=t.createTexture();t.bindTexture(re,ut),t.texParameteri(re,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(re,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let Kt=0;Kt<Te;Kt++)re===t.TEXTURE_3D||re===t.TEXTURE_2D_ARRAY?t.texImage3D(Fe,0,t.RGBA,1,1,Le,0,t.RGBA,t.UNSIGNED_BYTE,Ke):t.texImage2D(Fe+Kt,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,Ke);return ut}const fe={};fe[t.TEXTURE_2D]=ae(t.TEXTURE_2D,t.TEXTURE_2D,1),fe[t.TEXTURE_CUBE_MAP]=ae(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),fe[t.TEXTURE_2D_ARRAY]=ae(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),fe[t.TEXTURE_3D]=ae(t.TEXTURE_3D,t.TEXTURE_3D,1,1),i.setClear(0,0,0,1),s.setClear(1),o.setClear(0),_e(t.DEPTH_TEST),s.setFunc(Uh),Ue(!1),We(jC),_e(t.CULL_FACE),Q(Wc);function _e(re){c[re]!==!0&&(t.enable(re),c[re]=!0)}function Se(re){c[re]!==!1&&(t.disable(re),c[re]=!1)}function $e(re,Fe){return d[re]!==Fe?(t.bindFramebuffer(re,Fe),d[re]=Fe,re===t.DRAW_FRAMEBUFFER&&(d[t.FRAMEBUFFER]=Fe),re===t.FRAMEBUFFER&&(d[t.DRAW_FRAMEBUFFER]=Fe),!0):!1}function Me(re,Fe){let Te=m,Le=!1;if(re){Te=f.get(Fe),Te===void 0&&(Te=[],f.set(Fe,Te));const Ke=re.textures;if(Te.length!==Ke.length||Te[0]!==t.COLOR_ATTACHMENT0){for(let ut=0,Kt=Ke.length;ut<Kt;ut++)Te[ut]=t.COLOR_ATTACHMENT0+ut;Te.length=Ke.length,Le=!0}}else Te[0]!==t.BACK&&(Te[0]=t.BACK,Le=!0);Le&&t.drawBuffers(Te)}function He(re){return y!==re?(t.useProgram(re),y=re,!0):!1}const Xe={[ud]:t.FUNC_ADD,[mV]:t.FUNC_SUBTRACT,[gV]:t.FUNC_REVERSE_SUBTRACT};Xe[vV]=t.MIN,Xe[yV]=t.MAX;const ue={[xV]:t.ZERO,[bV]:t.ONE,[_V]:t.SRC_COLOR,[Yw]:t.SRC_ALPHA,[TV]:t.SRC_ALPHA_SATURATE,[EV]:t.DST_COLOR,[SV]:t.DST_ALPHA,[wV]:t.ONE_MINUS_SRC_COLOR,[Zw]:t.ONE_MINUS_SRC_ALPHA,[AV]:t.ONE_MINUS_DST_COLOR,[MV]:t.ONE_MINUS_DST_ALPHA,[CV]:t.CONSTANT_COLOR,[PV]:t.ONE_MINUS_CONSTANT_COLOR,[RV]:t.CONSTANT_ALPHA,[NV]:t.ONE_MINUS_CONSTANT_ALPHA};function Q(re,Fe,Te,Le,Ke,ut,Kt,un,Cn,Jt){if(re===Wc){x===!0&&(Se(t.BLEND),x=!1);return}if(x===!1&&(_e(t.BLEND),x=!0),re!==pV){if(re!==S||Jt!==F){if((_!==ud||T!==ud)&&(t.blendEquation(t.FUNC_ADD),_=ud,T=ud),Jt)switch(re){case Sh:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case FC:t.blendFunc(t.ONE,t.ONE);break;case zC:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case BC:t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",re);break}else switch(re){case Sh:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case FC:t.blendFunc(t.SRC_ALPHA,t.ONE);break;case zC:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case BC:t.blendFunc(t.ZERO,t.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",re);break}w=null,A=null,C=null,O=null,N.set(0,0,0),D=0,S=re,F=Jt}return}Ke=Ke||Fe,ut=ut||Te,Kt=Kt||Le,(Fe!==_||Ke!==T)&&(t.blendEquationSeparate(Xe[Fe],Xe[Ke]),_=Fe,T=Ke),(Te!==w||Le!==A||ut!==C||Kt!==O)&&(t.blendFuncSeparate(ue[Te],ue[Le],ue[ut],ue[Kt]),w=Te,A=Le,C=ut,O=Kt),(un.equals(N)===!1||Cn!==D)&&(t.blendColor(un.r,un.g,un.b,Cn),N.copy(un),D=Cn),S=re,F=!1}function Ge(re,Fe){re.side===xo?Se(t.CULL_FACE):_e(t.CULL_FACE);let Te=re.side===ss;Fe&&(Te=!Te),Ue(Te),re.blending===Sh&&re.transparent===!1?Q(Wc):Q(re.blending,re.blendEquation,re.blendSrc,re.blendDst,re.blendEquationAlpha,re.blendSrcAlpha,re.blendDstAlpha,re.blendColor,re.blendAlpha,re.premultipliedAlpha),s.setFunc(re.depthFunc),s.setTest(re.depthTest),s.setMask(re.depthWrite),i.setMask(re.colorWrite);const Le=re.stencilWrite;o.setTest(Le),Le&&(o.setMask(re.stencilWriteMask),o.setFunc(re.stencilFunc,re.stencilRef,re.stencilFuncMask),o.setOp(re.stencilFail,re.stencilZFail,re.stencilZPass)),xt(re.polygonOffset,re.polygonOffsetFactor,re.polygonOffsetUnits),re.alphaToCoverage===!0?_e(t.SAMPLE_ALPHA_TO_COVERAGE):Se(t.SAMPLE_ALPHA_TO_COVERAGE)}function Ue(re){V!==re&&(re?t.frontFace(t.CW):t.frontFace(t.CCW),V=re)}function We(re){re!==dV?(_e(t.CULL_FACE),re!==k&&(re===jC?t.cullFace(t.BACK):re===fV?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):Se(t.CULL_FACE),k=re}function Qe(re){re!==j&&(pe&&t.lineWidth(re),j=re)}function xt(re,Fe,Te){re?(_e(t.POLYGON_OFFSET_FILL),(H!==Fe||ne!==Te)&&(t.polygonOffset(Fe,Te),H=Fe,ne=Te)):Se(t.POLYGON_OFFSET_FILL)}function at(re){re?_e(t.SCISSOR_TEST):Se(t.SCISSOR_TEST)}function ee(re){re===void 0&&(re=t.TEXTURE0+te-1),B!==re&&(t.activeTexture(re),B=re)}function W(re,Fe,Te){Te===void 0&&(B===null?Te=t.TEXTURE0+te-1:Te=B);let Le=K[Te];Le===void 0&&(Le={type:void 0,texture:void 0},K[Te]=Le),(Le.type!==re||Le.texture!==Fe)&&(B!==Te&&(t.activeTexture(Te),B=Te),t.bindTexture(re,Fe||fe[re]),Le.type=re,Le.texture=Fe)}function Ee(){const re=K[B];re!==void 0&&re.type!==void 0&&(t.bindTexture(re.type,null),re.type=void 0,re.texture=void 0)}function Be(){try{t.compressedTexImage2D.apply(t,arguments)}catch(re){console.error("THREE.WebGLState:",re)}}function le(){try{t.compressedTexImage3D.apply(t,arguments)}catch(re){console.error("THREE.WebGLState:",re)}}function Ce(){try{t.texSubImage2D.apply(t,arguments)}catch(re){console.error("THREE.WebGLState:",re)}}function lt(){try{t.texSubImage3D.apply(t,arguments)}catch(re){console.error("THREE.WebGLState:",re)}}function rt(){try{t.compressedTexSubImage2D.apply(t,arguments)}catch(re){console.error("THREE.WebGLState:",re)}}function ft(){try{t.compressedTexSubImage3D.apply(t,arguments)}catch(re){console.error("THREE.WebGLState:",re)}}function nn(){try{t.texStorage2D.apply(t,arguments)}catch(re){console.error("THREE.WebGLState:",re)}}function qe(){try{t.texStorage3D.apply(t,arguments)}catch(re){console.error("THREE.WebGLState:",re)}}function dt(){try{t.texImage2D.apply(t,arguments)}catch(re){console.error("THREE.WebGLState:",re)}}function Dt(){try{t.texImage3D.apply(t,arguments)}catch(re){console.error("THREE.WebGLState:",re)}}function Ut(re){Z.equals(re)===!1&&(t.scissor(re.x,re.y,re.z,re.w),Z.copy(re))}function pt(re){ge.equals(re)===!1&&(t.viewport(re.x,re.y,re.z,re.w),ge.copy(re))}function de(re,Fe){let Te=l.get(Fe);Te===void 0&&(Te=new WeakMap,l.set(Fe,Te));let Le=Te.get(re);Le===void 0&&(Le=t.getUniformBlockIndex(Fe,re.name),Te.set(re,Le))}function J(re,Fe){const Le=l.get(Fe).get(re);a.get(Fe)!==Le&&(t.uniformBlockBinding(Fe,Le,re.__bindingPointIndex),a.set(Fe,Le))}function Ae(){t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ZERO),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.blendColor(0,0,0,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(t.LESS),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(t.ALWAYS,0,4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.clearStencil(0),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.activeTexture(t.TEXTURE0),t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),c={},B=null,K={},d={},f=new WeakMap,m=[],y=null,x=!1,S=null,_=null,w=null,A=null,T=null,C=null,O=null,N=new ot(0,0,0),D=0,F=!1,V=null,k=null,j=null,H=null,ne=null,Z.set(0,0,t.canvas.width,t.canvas.height),ge.set(0,0,t.canvas.width,t.canvas.height),i.reset(),s.reset(),o.reset()}return{buffers:{color:i,depth:s,stencil:o},enable:_e,disable:Se,bindFramebuffer:$e,drawBuffers:Me,useProgram:He,setBlending:Q,setMaterial:Ge,setFlipSided:Ue,setCullFace:We,setLineWidth:Qe,setPolygonOffset:xt,setScissorTest:at,activeTexture:ee,bindTexture:W,unbindTexture:Ee,compressedTexImage2D:Be,compressedTexImage3D:le,texImage2D:dt,texImage3D:Dt,updateUBOMapping:de,uniformBlockBinding:J,texStorage2D:nn,texStorage3D:qe,texSubImage2D:Ce,texSubImage3D:lt,compressedTexSubImage2D:rt,compressedTexSubImage3D:ft,scissor:Ut,viewport:pt,reset:Ae}}function B0e(t,e){const n=t.image&&t.image.width?t.image.width/t.image.height:1;return n>e?(t.repeat.x=1,t.repeat.y=n/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2):(t.repeat.x=e/n,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0),t}function H0e(t,e){const n=t.image&&t.image.width?t.image.width/t.image.height:1;return n>e?(t.repeat.x=e/n,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0):(t.repeat.x=1,t.repeat.y=n/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2),t}function V0e(t){return t.repeat.x=1,t.repeat.y=1,t.offset.x=0,t.offset.y=0,t}function XC(t,e,n,r){const i=G0e(r);switch(n){case f2:return t*e;case p2:return t*e;case m2:return t*e*2;case WS:return t*e/i.components*i.byteLength;case ax:return t*e/i.components*i.byteLength;case g2:return t*e*2/i.components*i.byteLength;case $S:return t*e*2/i.components*i.byteLength;case h2:return t*e*3/i.components*i.byteLength;case is:return t*e*4/i.components*i.byteLength;case XS:return t*e*4/i.components*i.byteLength;case $0:case X0:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case q0:case K0:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case o1:case l1:return Math.max(t,16)*Math.max(e,8)/4;case s1:case a1:return Math.max(t,8)*Math.max(e,8)/2;case c1:case u1:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case d1:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case f1:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case h1:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case p1:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case m1:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case g1:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case v1:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case y1:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case x1:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case b1:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case _1:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case w1:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case S1:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case M1:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case E1:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case Y0:case A1:case T1:return Math.ceil(t/4)*Math.ceil(e/4)*16;case v2:case C1:return Math.ceil(t/4)*Math.ceil(e/4)*8;case P1:case R1:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function G0e(t){switch(t){case Ha:case c2:return{byteLength:1,components:1};case Ng:case u2:case ev:return{byteLength:2,components:1};case VS:case GS:return{byteLength:2,components:4};case eu:case HS:case Zs:return{byteLength:4,components:1};case d2:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}const W0e={contain:B0e,cover:H0e,fill:V0e,getByteLength:XC};function $0e(t,e,n,r,i,s,o){const a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Ve,d=new WeakMap;let f;const m=new WeakMap;let y=!1;try{y=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function x(ee,W){return y?new OffscreenCanvas(ee,W):Iy("canvas")}function S(ee,W,Ee){let Be=1;const le=at(ee);if((le.width>Ee||le.height>Ee)&&(Be=Ee/Math.max(le.width,le.height)),Be<1)if(typeof HTMLImageElement<"u"&&ee instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&ee instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&ee instanceof ImageBitmap||typeof VideoFrame<"u"&&ee instanceof VideoFrame){const Ce=Math.floor(Be*le.width),lt=Math.floor(Be*le.height);f===void 0&&(f=x(Ce,lt));const rt=W?x(Ce,lt):f;return rt.width=Ce,rt.height=lt,rt.getContext("2d").drawImage(ee,0,0,Ce,lt),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+le.width+"x"+le.height+") to ("+Ce+"x"+lt+")."),rt}else return"data"in ee&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+le.width+"x"+le.height+")."),ee;return ee}function _(ee){return ee.generateMipmaps&&ee.minFilter!==ri&&ee.minFilter!==Cr}function w(ee){t.generateMipmap(ee)}function A(ee,W,Ee,Be,le=!1){if(ee!==null){if(t[ee]!==void 0)return t[ee];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+ee+"'")}let Ce=W;if(W===t.RED&&(Ee===t.FLOAT&&(Ce=t.R32F),Ee===t.HALF_FLOAT&&(Ce=t.R16F),Ee===t.UNSIGNED_BYTE&&(Ce=t.R8)),W===t.RED_INTEGER&&(Ee===t.UNSIGNED_BYTE&&(Ce=t.R8UI),Ee===t.UNSIGNED_SHORT&&(Ce=t.R16UI),Ee===t.UNSIGNED_INT&&(Ce=t.R32UI),Ee===t.BYTE&&(Ce=t.R8I),Ee===t.SHORT&&(Ce=t.R16I),Ee===t.INT&&(Ce=t.R32I)),W===t.RG&&(Ee===t.FLOAT&&(Ce=t.RG32F),Ee===t.HALF_FLOAT&&(Ce=t.RG16F),Ee===t.UNSIGNED_BYTE&&(Ce=t.RG8)),W===t.RG_INTEGER&&(Ee===t.UNSIGNED_BYTE&&(Ce=t.RG8UI),Ee===t.UNSIGNED_SHORT&&(Ce=t.RG16UI),Ee===t.UNSIGNED_INT&&(Ce=t.RG32UI),Ee===t.BYTE&&(Ce=t.RG8I),Ee===t.SHORT&&(Ce=t.RG16I),Ee===t.INT&&(Ce=t.RG32I)),W===t.RGB_INTEGER&&(Ee===t.UNSIGNED_BYTE&&(Ce=t.RGB8UI),Ee===t.UNSIGNED_SHORT&&(Ce=t.RGB16UI),Ee===t.UNSIGNED_INT&&(Ce=t.RGB32UI),Ee===t.BYTE&&(Ce=t.RGB8I),Ee===t.SHORT&&(Ce=t.RGB16I),Ee===t.INT&&(Ce=t.RGB32I)),W===t.RGBA_INTEGER&&(Ee===t.UNSIGNED_BYTE&&(Ce=t.RGBA8UI),Ee===t.UNSIGNED_SHORT&&(Ce=t.RGBA16UI),Ee===t.UNSIGNED_INT&&(Ce=t.RGBA32UI),Ee===t.BYTE&&(Ce=t.RGBA8I),Ee===t.SHORT&&(Ce=t.RGBA16I),Ee===t.INT&&(Ce=t.RGBA32I)),W===t.RGB&&Ee===t.UNSIGNED_INT_5_9_9_9_REV&&(Ce=t.RGB9_E5),W===t.RGBA){const lt=le?Ty:In.getTransfer(Be);Ee===t.FLOAT&&(Ce=t.RGBA32F),Ee===t.HALF_FLOAT&&(Ce=t.RGBA16F),Ee===t.UNSIGNED_BYTE&&(Ce=lt===Jn?t.SRGB8_ALPHA8:t.RGBA8),Ee===t.UNSIGNED_SHORT_4_4_4_4&&(Ce=t.RGBA4),Ee===t.UNSIGNED_SHORT_5_5_5_1&&(Ce=t.RGB5_A1)}return(Ce===t.R16F||Ce===t.R32F||Ce===t.RG16F||Ce===t.RG32F||Ce===t.RGBA16F||Ce===t.RGBA32F)&&e.get("EXT_color_buffer_float"),Ce}function T(ee,W){let Ee;return ee?W===null||W===eu||W===jh?Ee=t.DEPTH24_STENCIL8:W===Zs?Ee=t.DEPTH32F_STENCIL8:W===Ng&&(Ee=t.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):W===null||W===eu||W===jh?Ee=t.DEPTH_COMPONENT24:W===Zs?Ee=t.DEPTH_COMPONENT32F:W===Ng&&(Ee=t.DEPTH_COMPONENT16),Ee}function C(ee,W){return _(ee)===!0||ee.isFramebufferTexture&&ee.minFilter!==ri&&ee.minFilter!==Cr?Math.log2(Math.max(W.width,W.height))+1:ee.mipmaps!==void 0&&ee.mipmaps.length>0?ee.mipmaps.length:ee.isCompressedTexture&&Array.isArray(ee.image)?W.mipmaps.length:1}function O(ee){const W=ee.target;W.removeEventListener("dispose",O),D(W),W.isVideoTexture&&d.delete(W)}function N(ee){const W=ee.target;W.removeEventListener("dispose",N),V(W)}function D(ee){const W=r.get(ee);if(W.__webglInit===void 0)return;const Ee=ee.source,Be=m.get(Ee);if(Be){const le=Be[W.__cacheKey];le.usedTimes--,le.usedTimes===0&&F(ee),Object.keys(Be).length===0&&m.delete(Ee)}r.remove(ee)}function F(ee){const W=r.get(ee);t.deleteTexture(W.__webglTexture);const Ee=ee.source,Be=m.get(Ee);delete Be[W.__cacheKey],o.memory.textures--}function V(ee){const W=r.get(ee);if(ee.depthTexture&&ee.depthTexture.dispose(),ee.isWebGLCubeRenderTarget)for(let Be=0;Be<6;Be++){if(Array.isArray(W.__webglFramebuffer[Be]))for(let le=0;le<W.__webglFramebuffer[Be].length;le++)t.deleteFramebuffer(W.__webglFramebuffer[Be][le]);else t.deleteFramebuffer(W.__webglFramebuffer[Be]);W.__webglDepthbuffer&&t.deleteRenderbuffer(W.__webglDepthbuffer[Be])}else{if(Array.isArray(W.__webglFramebuffer))for(let Be=0;Be<W.__webglFramebuffer.length;Be++)t.deleteFramebuffer(W.__webglFramebuffer[Be]);else t.deleteFramebuffer(W.__webglFramebuffer);if(W.__webglDepthbuffer&&t.deleteRenderbuffer(W.__webglDepthbuffer),W.__webglMultisampledFramebuffer&&t.deleteFramebuffer(W.__webglMultisampledFramebuffer),W.__webglColorRenderbuffer)for(let Be=0;Be<W.__webglColorRenderbuffer.length;Be++)W.__webglColorRenderbuffer[Be]&&t.deleteRenderbuffer(W.__webglColorRenderbuffer[Be]);W.__webglDepthRenderbuffer&&t.deleteRenderbuffer(W.__webglDepthRenderbuffer)}const Ee=ee.textures;for(let Be=0,le=Ee.length;Be<le;Be++){const Ce=r.get(Ee[Be]);Ce.__webglTexture&&(t.deleteTexture(Ce.__webglTexture),o.memory.textures--),r.remove(Ee[Be])}r.remove(ee)}let k=0;function j(){k=0}function H(){const ee=k;return ee>=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+ee+" texture units while this GPU supports only "+i.maxTextures),k+=1,ee}function ne(ee){const W=[];return W.push(ee.wrapS),W.push(ee.wrapT),W.push(ee.wrapR||0),W.push(ee.magFilter),W.push(ee.minFilter),W.push(ee.anisotropy),W.push(ee.internalFormat),W.push(ee.format),W.push(ee.type),W.push(ee.generateMipmaps),W.push(ee.premultiplyAlpha),W.push(ee.flipY),W.push(ee.unpackAlignment),W.push(ee.colorSpace),W.join()}function te(ee,W){const Ee=r.get(ee);if(ee.isVideoTexture&&Qe(ee),ee.isRenderTargetTexture===!1&&ee.version>0&&Ee.__version!==ee.version){const Be=ee.image;if(Be===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Be.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ge(Ee,ee,W);return}}n.bindTexture(t.TEXTURE_2D,Ee.__webglTexture,t.TEXTURE0+W)}function pe(ee,W){const Ee=r.get(ee);if(ee.version>0&&Ee.__version!==ee.version){ge(Ee,ee,W);return}n.bindTexture(t.TEXTURE_2D_ARRAY,Ee.__webglTexture,t.TEXTURE0+W)}function oe(ee,W){const Ee=r.get(ee);if(ee.version>0&&Ee.__version!==ee.version){ge(Ee,ee,W);return}n.bindTexture(t.TEXTURE_3D,Ee.__webglTexture,t.TEXTURE0+W)}function ce(ee,W){const Ee=r.get(ee);if(ee.version>0&&Ee.__version!==ee.version){ae(Ee,ee,W);return}n.bindTexture(t.TEXTURE_CUBE_MAP,Ee.__webglTexture,t.TEXTURE0+W)}const B={[Pd]:t.REPEAT,[_o]:t.CLAMP_TO_EDGE,[Rg]:t.MIRRORED_REPEAT},K={[ri]:t.NEAREST,[BS]:t.NEAREST_MIPMAP_NEAREST,[ih]:t.NEAREST_MIPMAP_LINEAR,[Cr]:t.LINEAR,[tg]:t.LINEAR_MIPMAP_NEAREST,[qo]:t.LINEAR_MIPMAP_LINEAR},q={[qV]:t.NEVER,[e6]:t.ALWAYS,[KV]:t.LESS,[b2]:t.LEQUAL,[YV]:t.EQUAL,[JV]:t.GEQUAL,[ZV]:t.GREATER,[QV]:t.NOTEQUAL};function $(ee,W){if(W.type===Zs&&e.has("OES_texture_float_linear")===!1&&(W.magFilter===Cr||W.magFilter===tg||W.magFilter===ih||W.magFilter===qo||W.minFilter===Cr||W.minFilter===tg||W.minFilter===ih||W.minFilter===qo)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(ee,t.TEXTURE_WRAP_S,B[W.wrapS]),t.texParameteri(ee,t.TEXTURE_WRAP_T,B[W.wrapT]),(ee===t.TEXTURE_3D||ee===t.TEXTURE_2D_ARRAY)&&t.texParameteri(ee,t.TEXTURE_WRAP_R,B[W.wrapR]),t.texParameteri(ee,t.TEXTURE_MAG_FILTER,K[W.magFilter]),t.texParameteri(ee,t.TEXTURE_MIN_FILTER,K[W.minFilter]),W.compareFunction&&(t.texParameteri(ee,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(ee,t.TEXTURE_COMPARE_FUNC,q[W.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(W.magFilter===ri||W.minFilter!==ih&&W.minFilter!==qo||W.type===Zs&&e.has("OES_texture_float_linear")===!1)return;if(W.anisotropy>1||r.get(W).__currentAnisotropy){const Ee=e.get("EXT_texture_filter_anisotropic");t.texParameterf(ee,Ee.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(W.anisotropy,i.getMaxAnisotropy())),r.get(W).__currentAnisotropy=W.anisotropy}}}function Z(ee,W){let Ee=!1;ee.__webglInit===void 0&&(ee.__webglInit=!0,W.addEventListener("dispose",O));const Be=W.source;let le=m.get(Be);le===void 0&&(le={},m.set(Be,le));const Ce=ne(W);if(Ce!==ee.__cacheKey){le[Ce]===void 0&&(le[Ce]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,Ee=!0),le[Ce].usedTimes++;const lt=le[ee.__cacheKey];lt!==void 0&&(le[ee.__cacheKey].usedTimes--,lt.usedTimes===0&&F(W)),ee.__cacheKey=Ce,ee.__webglTexture=le[Ce].texture}return Ee}function ge(ee,W,Ee){let Be=t.TEXTURE_2D;(W.isDataArrayTexture||W.isCompressedArrayTexture)&&(Be=t.TEXTURE_2D_ARRAY),W.isData3DTexture&&(Be=t.TEXTURE_3D);const le=Z(ee,W),Ce=W.source;n.bindTexture(Be,ee.__webglTexture,t.TEXTURE0+Ee);const lt=r.get(Ce);if(Ce.version!==lt.__version||le===!0){n.activeTexture(t.TEXTURE0+Ee);const rt=In.getPrimaries(In.workingColorSpace),ft=W.colorSpace===Lc?null:In.getPrimaries(W.colorSpace),nn=W.colorSpace===Lc||rt===ft?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,W.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,W.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,W.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,nn);let qe=S(W.image,!1,i.maxTextureSize);qe=xt(W,qe);const dt=s.convert(W.format,W.colorSpace),Dt=s.convert(W.type);let Ut=A(W.internalFormat,dt,Dt,W.colorSpace,W.isVideoTexture);$(Be,W);let pt;const de=W.mipmaps,J=W.isVideoTexture!==!0,Ae=lt.__version===void 0||le===!0,re=Ce.dataReady,Fe=C(W,qe);if(W.isDepthTexture)Ut=T(W.format===Fh,W.type),Ae&&(J?n.texStorage2D(t.TEXTURE_2D,1,Ut,qe.width,qe.height):n.texImage2D(t.TEXTURE_2D,0,Ut,qe.width,qe.height,0,dt,Dt,null));else if(W.isDataTexture)if(de.length>0){J&&Ae&&n.texStorage2D(t.TEXTURE_2D,Fe,Ut,de[0].width,de[0].height);for(let Te=0,Le=de.length;Te<Le;Te++)pt=de[Te],J?re&&n.texSubImage2D(t.TEXTURE_2D,Te,0,0,pt.width,pt.height,dt,Dt,pt.data):n.texImage2D(t.TEXTURE_2D,Te,Ut,pt.width,pt.height,0,dt,Dt,pt.data);W.generateMipmaps=!1}else J?(Ae&&n.texStorage2D(t.TEXTURE_2D,Fe,Ut,qe.width,qe.height),re&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,qe.width,qe.height,dt,Dt,qe.data)):n.texImage2D(t.TEXTURE_2D,0,Ut,qe.width,qe.height,0,dt,Dt,qe.data);else if(W.isCompressedTexture)if(W.isCompressedArrayTexture){J&&Ae&&n.texStorage3D(t.TEXTURE_2D_ARRAY,Fe,Ut,de[0].width,de[0].height,qe.depth);for(let Te=0,Le=de.length;Te<Le;Te++)if(pt=de[Te],W.format!==is)if(dt!==null)if(J){if(re)if(W.layerUpdates.size>0){const Ke=XC(pt.width,pt.height,W.format,W.type);for(const ut of W.layerUpdates){const Kt=pt.data.subarray(ut*Ke/pt.data.BYTES_PER_ELEMENT,(ut+1)*Ke/pt.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,Te,0,0,ut,pt.width,pt.height,1,dt,Kt,0,0)}W.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,Te,0,0,0,pt.width,pt.height,qe.depth,dt,pt.data,0,0)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,Te,Ut,pt.width,pt.height,qe.depth,0,pt.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else J?re&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,Te,0,0,0,pt.width,pt.height,qe.depth,dt,Dt,pt.data):n.texImage3D(t.TEXTURE_2D_ARRAY,Te,Ut,pt.width,pt.height,qe.depth,0,dt,Dt,pt.data)}else{J&&Ae&&n.texStorage2D(t.TEXTURE_2D,Fe,Ut,de[0].width,de[0].height);for(let Te=0,Le=de.length;Te<Le;Te++)pt=de[Te],W.format!==is?dt!==null?J?re&&n.compressedTexSubImage2D(t.TEXTURE_2D,Te,0,0,pt.width,pt.height,dt,pt.data):n.compressedTexImage2D(t.TEXTURE_2D,Te,Ut,pt.width,pt.height,0,pt.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):J?re&&n.texSubImage2D(t.TEXTURE_2D,Te,0,0,pt.width,pt.height,dt,Dt,pt.data):n.texImage2D(t.TEXTURE_2D,Te,Ut,pt.width,pt.height,0,dt,Dt,pt.data)}else if(W.isDataArrayTexture)if(J){if(Ae&&n.texStorage3D(t.TEXTURE_2D_ARRAY,Fe,Ut,qe.width,qe.height,qe.depth),re)if(W.layerUpdates.size>0){const Te=XC(qe.width,qe.height,W.format,W.type);for(const Le of W.layerUpdates){const Ke=qe.data.subarray(Le*Te/qe.data.BYTES_PER_ELEMENT,(Le+1)*Te/qe.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,Le,qe.width,qe.height,1,dt,Dt,Ke)}W.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,qe.width,qe.height,qe.depth,dt,Dt,qe.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,Ut,qe.width,qe.height,qe.depth,0,dt,Dt,qe.data);else if(W.isData3DTexture)J?(Ae&&n.texStorage3D(t.TEXTURE_3D,Fe,Ut,qe.width,qe.height,qe.depth),re&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,qe.width,qe.height,qe.depth,dt,Dt,qe.data)):n.texImage3D(t.TEXTURE_3D,0,Ut,qe.width,qe.height,qe.depth,0,dt,Dt,qe.data);else if(W.isFramebufferTexture){if(Ae)if(J)n.texStorage2D(t.TEXTURE_2D,Fe,Ut,qe.width,qe.height);else{let Te=qe.width,Le=qe.height;for(let Ke=0;Ke<Fe;Ke++)n.texImage2D(t.TEXTURE_2D,Ke,Ut,Te,Le,0,dt,Dt,null),Te>>=1,Le>>=1}}else if(de.length>0){if(J&&Ae){const Te=at(de[0]);n.texStorage2D(t.TEXTURE_2D,Fe,Ut,Te.width,Te.height)}for(let Te=0,Le=de.length;Te<Le;Te++)pt=de[Te],J?re&&n.texSubImage2D(t.TEXTURE_2D,Te,0,0,dt,Dt,pt):n.texImage2D(t.TEXTURE_2D,Te,Ut,dt,Dt,pt);W.generateMipmaps=!1}else if(J){if(Ae){const Te=at(qe);n.texStorage2D(t.TEXTURE_2D,Fe,Ut,Te.width,Te.height)}re&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,dt,Dt,qe)}else n.texImage2D(t.TEXTURE_2D,0,Ut,dt,Dt,qe);_(W)&&w(Be),lt.__version=Ce.version,W.onUpdate&&W.onUpdate(W)}ee.__version=W.version}function ae(ee,W,Ee){if(W.image.length!==6)return;const Be=Z(ee,W),le=W.source;n.bindTexture(t.TEXTURE_CUBE_MAP,ee.__webglTexture,t.TEXTURE0+Ee);const Ce=r.get(le);if(le.version!==Ce.__version||Be===!0){n.activeTexture(t.TEXTURE0+Ee);const lt=In.getPrimaries(In.workingColorSpace),rt=W.colorSpace===Lc?null:In.getPrimaries(W.colorSpace),ft=W.colorSpace===Lc||lt===rt?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,W.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,W.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,W.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,ft);const nn=W.isCompressedTexture||W.image[0].isCompressedTexture,qe=W.image[0]&&W.image[0].isDataTexture,dt=[];for(let Le=0;Le<6;Le++)!nn&&!qe?dt[Le]=S(W.image[Le],!0,i.maxCubemapSize):dt[Le]=qe?W.image[Le].image:W.image[Le],dt[Le]=xt(W,dt[Le]);const Dt=dt[0],Ut=s.convert(W.format,W.colorSpace),pt=s.convert(W.type),de=A(W.internalFormat,Ut,pt,W.colorSpace),J=W.isVideoTexture!==!0,Ae=Ce.__version===void 0||Be===!0,re=le.dataReady;let Fe=C(W,Dt);$(t.TEXTURE_CUBE_MAP,W);let Te;if(nn){J&&Ae&&n.texStorage2D(t.TEXTURE_CUBE_MAP,Fe,de,Dt.width,Dt.height);for(let Le=0;Le<6;Le++){Te=dt[Le].mipmaps;for(let Ke=0;Ke<Te.length;Ke++){const ut=Te[Ke];W.format!==is?Ut!==null?J?re&&n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Le,Ke,0,0,ut.width,ut.height,Ut,ut.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Le,Ke,de,ut.width,ut.height,0,ut.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):J?re&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Le,Ke,0,0,ut.width,ut.height,Ut,pt,ut.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Le,Ke,de,ut.width,ut.height,0,Ut,pt,ut.data)}}}else{if(Te=W.mipmaps,J&&Ae){Te.length>0&&Fe++;const Le=at(dt[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,Fe,de,Le.width,Le.height)}for(let Le=0;Le<6;Le++)if(qe){J?re&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Le,0,0,0,dt[Le].width,dt[Le].height,Ut,pt,dt[Le].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Le,0,de,dt[Le].width,dt[Le].height,0,Ut,pt,dt[Le].data);for(let Ke=0;Ke<Te.length;Ke++){const Kt=Te[Ke].image[Le].image;J?re&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Le,Ke+1,0,0,Kt.width,Kt.height,Ut,pt,Kt.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Le,Ke+1,de,Kt.width,Kt.height,0,Ut,pt,Kt.data)}}else{J?re&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Le,0,0,0,Ut,pt,dt[Le]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Le,0,de,Ut,pt,dt[Le]);for(let Ke=0;Ke<Te.length;Ke++){const ut=Te[Ke];J?re&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Le,Ke+1,0,0,Ut,pt,ut.image[Le]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Le,Ke+1,de,Ut,pt,ut.image[Le])}}}_(W)&&w(t.TEXTURE_CUBE_MAP),Ce.__version=le.version,W.onUpdate&&W.onUpdate(W)}ee.__version=W.version}function fe(ee,W,Ee,Be,le,Ce){const lt=s.convert(Ee.format,Ee.colorSpace),rt=s.convert(Ee.type),ft=A(Ee.internalFormat,lt,rt,Ee.colorSpace);if(!r.get(W).__hasExternalTextures){const qe=Math.max(1,W.width>>Ce),dt=Math.max(1,W.height>>Ce);le===t.TEXTURE_3D||le===t.TEXTURE_2D_ARRAY?n.texImage3D(le,Ce,ft,qe,dt,W.depth,0,lt,rt,null):n.texImage2D(le,Ce,ft,qe,dt,0,lt,rt,null)}n.bindFramebuffer(t.FRAMEBUFFER,ee),We(W)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,Be,le,r.get(Ee).__webglTexture,0,Ue(W)):(le===t.TEXTURE_2D||le>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&le<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,Be,le,r.get(Ee).__webglTexture,Ce),n.bindFramebuffer(t.FRAMEBUFFER,null)}function _e(ee,W,Ee){if(t.bindRenderbuffer(t.RENDERBUFFER,ee),W.depthBuffer){const Be=W.depthTexture,le=Be&&Be.isDepthTexture?Be.type:null,Ce=T(W.stencilBuffer,le),lt=W.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,rt=Ue(W);We(W)?a.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,rt,Ce,W.width,W.height):Ee?t.renderbufferStorageMultisample(t.RENDERBUFFER,rt,Ce,W.width,W.height):t.renderbufferStorage(t.RENDERBUFFER,Ce,W.width,W.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,lt,t.RENDERBUFFER,ee)}else{const Be=W.textures;for(let le=0;le<Be.length;le++){const Ce=Be[le],lt=s.convert(Ce.format,Ce.colorSpace),rt=s.convert(Ce.type),ft=A(Ce.internalFormat,lt,rt,Ce.colorSpace),nn=Ue(W);Ee&&We(W)===!1?t.renderbufferStorageMultisample(t.RENDERBUFFER,nn,ft,W.width,W.height):We(W)?a.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,nn,ft,W.width,W.height):t.renderbufferStorage(t.RENDERBUFFER,ft,W.width,W.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function Se(ee,W){if(W&&W.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(t.FRAMEBUFFER,ee),!(W.depthTexture&&W.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!r.get(W.depthTexture).__webglTexture||W.depthTexture.image.width!==W.width||W.depthTexture.image.height!==W.height)&&(W.depthTexture.image.width=W.width,W.depthTexture.image.height=W.height,W.depthTexture.needsUpdate=!0),te(W.depthTexture,0);const Be=r.get(W.depthTexture).__webglTexture,le=Ue(W);if(W.depthTexture.format===Mh)We(W)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,Be,0,le):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,Be,0);else if(W.depthTexture.format===Fh)We(W)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,Be,0,le):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,Be,0);else throw new Error("Unknown depthTexture format")}function $e(ee){const W=r.get(ee),Ee=ee.isWebGLCubeRenderTarget===!0;if(W.__boundDepthTexture!==ee.depthTexture){const Be=ee.depthTexture;if(W.__depthDisposeCallback&&W.__depthDisposeCallback(),Be){const le=()=>{delete W.__boundDepthTexture,delete W.__depthDisposeCallback,Be.removeEventListener("dispose",le)};Be.addEventListener("dispose",le),W.__depthDisposeCallback=le}W.__boundDepthTexture=Be}if(ee.depthTexture&&!W.__autoAllocateDepthBuffer){if(Ee)throw new Error("target.depthTexture not supported in Cube render targets");Se(W.__webglFramebuffer,ee)}else if(Ee){W.__webglDepthbuffer=[];for(let Be=0;Be<6;Be++)if(n.bindFramebuffer(t.FRAMEBUFFER,W.__webglFramebuffer[Be]),W.__webglDepthbuffer[Be]===void 0)W.__webglDepthbuffer[Be]=t.createRenderbuffer(),_e(W.__webglDepthbuffer[Be],ee,!1);else{const le=ee.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Ce=W.__webglDepthbuffer[Be];t.bindRenderbuffer(t.RENDERBUFFER,Ce),t.framebufferRenderbuffer(t.FRAMEBUFFER,le,t.RENDERBUFFER,Ce)}}else if(n.bindFramebuffer(t.FRAMEBUFFER,W.__webglFramebuffer),W.__webglDepthbuffer===void 0)W.__webglDepthbuffer=t.createRenderbuffer(),_e(W.__webglDepthbuffer,ee,!1);else{const Be=ee.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,le=W.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,le),t.framebufferRenderbuffer(t.FRAMEBUFFER,Be,t.RENDERBUFFER,le)}n.bindFramebuffer(t.FRAMEBUFFER,null)}function Me(ee,W,Ee){const Be=r.get(ee);W!==void 0&&fe(Be.__webglFramebuffer,ee,ee.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),Ee!==void 0&&$e(ee)}function He(ee){const W=ee.texture,Ee=r.get(ee),Be=r.get(W);ee.addEventListener("dispose",N);const le=ee.textures,Ce=ee.isWebGLCubeRenderTarget===!0,lt=le.length>1;if(lt||(Be.__webglTexture===void 0&&(Be.__webglTexture=t.createTexture()),Be.__version=W.version,o.memory.textures++),Ce){Ee.__webglFramebuffer=[];for(let rt=0;rt<6;rt++)if(W.mipmaps&&W.mipmaps.length>0){Ee.__webglFramebuffer[rt]=[];for(let ft=0;ft<W.mipmaps.length;ft++)Ee.__webglFramebuffer[rt][ft]=t.createFramebuffer()}else Ee.__webglFramebuffer[rt]=t.createFramebuffer()}else{if(W.mipmaps&&W.mipmaps.length>0){Ee.__webglFramebuffer=[];for(let rt=0;rt<W.mipmaps.length;rt++)Ee.__webglFramebuffer[rt]=t.createFramebuffer()}else Ee.__webglFramebuffer=t.createFramebuffer();if(lt)for(let rt=0,ft=le.length;rt<ft;rt++){const nn=r.get(le[rt]);nn.__webglTexture===void 0&&(nn.__webglTexture=t.createTexture(),o.memory.textures++)}if(ee.samples>0&&We(ee)===!1){Ee.__webglMultisampledFramebuffer=t.createFramebuffer(),Ee.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,Ee.__webglMultisampledFramebuffer);for(let rt=0;rt<le.length;rt++){const ft=le[rt];Ee.__webglColorRenderbuffer[rt]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,Ee.__webglColorRenderbuffer[rt]);const nn=s.convert(ft.format,ft.colorSpace),qe=s.convert(ft.type),dt=A(ft.internalFormat,nn,qe,ft.colorSpace,ee.isXRRenderTarget===!0),Dt=Ue(ee);t.renderbufferStorageMultisample(t.RENDERBUFFER,Dt,dt,ee.width,ee.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+rt,t.RENDERBUFFER,Ee.__webglColorRenderbuffer[rt])}t.bindRenderbuffer(t.RENDERBUFFER,null),ee.depthBuffer&&(Ee.__webglDepthRenderbuffer=t.createRenderbuffer(),_e(Ee.__webglDepthRenderbuffer,ee,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if(Ce){n.bindTexture(t.TEXTURE_CUBE_MAP,Be.__webglTexture),$(t.TEXTURE_CUBE_MAP,W);for(let rt=0;rt<6;rt++)if(W.mipmaps&&W.mipmaps.length>0)for(let ft=0;ft<W.mipmaps.length;ft++)fe(Ee.__webglFramebuffer[rt][ft],ee,W,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+rt,ft);else fe(Ee.__webglFramebuffer[rt],ee,W,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+rt,0);_(W)&&w(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(lt){for(let rt=0,ft=le.length;rt<ft;rt++){const nn=le[rt],qe=r.get(nn);n.bindTexture(t.TEXTURE_2D,qe.__webglTexture),$(t.TEXTURE_2D,nn),fe(Ee.__webglFramebuffer,ee,nn,t.COLOR_ATTACHMENT0+rt,t.TEXTURE_2D,0),_(nn)&&w(t.TEXTURE_2D)}n.unbindTexture()}else{let rt=t.TEXTURE_2D;if((ee.isWebGL3DRenderTarget||ee.isWebGLArrayRenderTarget)&&(rt=ee.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(rt,Be.__webglTexture),$(rt,W),W.mipmaps&&W.mipmaps.length>0)for(let ft=0;ft<W.mipmaps.length;ft++)fe(Ee.__webglFramebuffer[ft],ee,W,t.COLOR_ATTACHMENT0,rt,ft);else fe(Ee.__webglFramebuffer,ee,W,t.COLOR_ATTACHMENT0,rt,0);_(W)&&w(rt),n.unbindTexture()}ee.depthBuffer&&$e(ee)}function Xe(ee){const W=ee.textures;for(let Ee=0,Be=W.length;Ee<Be;Ee++){const le=W[Ee];if(_(le)){const Ce=ee.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,lt=r.get(le).__webglTexture;n.bindTexture(Ce,lt),w(Ce),n.unbindTexture()}}}const ue=[],Q=[];function Ge(ee){if(ee.samples>0){if(We(ee)===!1){const W=ee.textures,Ee=ee.width,Be=ee.height;let le=t.COLOR_BUFFER_BIT;const Ce=ee.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,lt=r.get(ee),rt=W.length>1;if(rt)for(let ft=0;ft<W.length;ft++)n.bindFramebuffer(t.FRAMEBUFFER,lt.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+ft,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,lt.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+ft,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,lt.__webglMultisampledFramebuffer),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,lt.__webglFramebuffer);for(let ft=0;ft<W.length;ft++){if(ee.resolveDepthBuffer&&(ee.depthBuffer&&(le|=t.DEPTH_BUFFER_BIT),ee.stencilBuffer&&ee.resolveStencilBuffer&&(le|=t.STENCIL_BUFFER_BIT)),rt){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,lt.__webglColorRenderbuffer[ft]);const nn=r.get(W[ft]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,nn,0)}t.blitFramebuffer(0,0,Ee,Be,0,0,Ee,Be,le,t.NEAREST),l===!0&&(ue.length=0,Q.length=0,ue.push(t.COLOR_ATTACHMENT0+ft),ee.depthBuffer&&ee.resolveDepthBuffer===!1&&(ue.push(Ce),Q.push(Ce),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,Q)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,ue))}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),rt)for(let ft=0;ft<W.length;ft++){n.bindFramebuffer(t.FRAMEBUFFER,lt.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+ft,t.RENDERBUFFER,lt.__webglColorRenderbuffer[ft]);const nn=r.get(W[ft]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,lt.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+ft,t.TEXTURE_2D,nn,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,lt.__webglMultisampledFramebuffer)}else if(ee.depthBuffer&&ee.resolveDepthBuffer===!1&&l){const W=ee.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[W])}}}function Ue(ee){return Math.min(i.maxSamples,ee.samples)}function We(ee){const W=r.get(ee);return ee.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&W.__useRenderToTexture!==!1}function Qe(ee){const W=o.render.frame;d.get(ee)!==W&&(d.set(ee,W),ee.update())}function xt(ee,W){const Ee=ee.colorSpace,Be=ee.format,le=ee.type;return ee.isCompressedTexture===!0||ee.isVideoTexture===!0||Ee!==xi&&Ee!==Lc&&(In.getTransfer(Ee)===Jn?(Be!==is||le!==Ha)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",Ee)),W}function at(ee){return typeof HTMLImageElement<"u"&&ee instanceof HTMLImageElement?(c.width=ee.naturalWidth||ee.width,c.height=ee.naturalHeight||ee.height):typeof VideoFrame<"u"&&ee instanceof VideoFrame?(c.width=ee.displayWidth,c.height=ee.displayHeight):(c.width=ee.width,c.height=ee.height),c}this.allocateTextureUnit=H,this.resetTextureUnits=j,this.setTexture2D=te,this.setTexture2DArray=pe,this.setTexture3D=oe,this.setTextureCube=ce,this.rebindTextures=Me,this.setupRenderTarget=He,this.updateRenderTargetMipmap=Xe,this.updateMultisampleRenderTarget=Ge,this.setupDepthRenderbuffer=$e,this.setupFrameBufferTexture=fe,this.useMultisampledRTT=We}function m6(t,e){function n(r,i=Lc){let s;const o=In.getTransfer(i);if(r===Ha)return t.UNSIGNED_BYTE;if(r===VS)return t.UNSIGNED_SHORT_4_4_4_4;if(r===GS)return t.UNSIGNED_SHORT_5_5_5_1;if(r===d2)return t.UNSIGNED_INT_5_9_9_9_REV;if(r===c2)return t.BYTE;if(r===u2)return t.SHORT;if(r===Ng)return t.UNSIGNED_SHORT;if(r===HS)return t.INT;if(r===eu)return t.UNSIGNED_INT;if(r===Zs)return t.FLOAT;if(r===ev)return t.HALF_FLOAT;if(r===f2)return t.ALPHA;if(r===h2)return t.RGB;if(r===is)return t.RGBA;if(r===p2)return t.LUMINANCE;if(r===m2)return t.LUMINANCE_ALPHA;if(r===Mh)return t.DEPTH_COMPONENT;if(r===Fh)return t.DEPTH_STENCIL;if(r===WS)return t.RED;if(r===ax)return t.RED_INTEGER;if(r===g2)return t.RG;if(r===$S)return t.RG_INTEGER;if(r===XS)return t.RGBA_INTEGER;if(r===$0||r===X0||r===q0||r===K0)if(o===Jn)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(r===$0)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===X0)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===q0)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===K0)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(r===$0)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===X0)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===q0)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===K0)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===s1||r===o1||r===a1||r===l1)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(r===s1)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===o1)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===a1)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===l1)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===c1||r===u1||r===d1)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(r===c1||r===u1)return o===Jn?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(r===d1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===f1||r===h1||r===p1||r===m1||r===g1||r===v1||r===y1||r===x1||r===b1||r===_1||r===w1||r===S1||r===M1||r===E1)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(r===f1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===h1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===p1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===m1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===g1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===v1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===y1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===x1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===b1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===_1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===w1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===S1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===M1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===E1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===Y0||r===A1||r===T1)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(r===Y0)return o===Jn?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===A1)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===T1)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===v2||r===C1||r===P1||r===R1)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(r===Y0)return s.COMPRESSED_RED_RGTC1_EXT;if(r===C1)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===P1)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===R1)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===jh?t.UNSIGNED_INT_24_8:t[r]!==void 0?t[r]:null}return{convert:n}}class g6 extends Tr{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Ts extends mn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const X0e={type:"move"};class xA{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Ts,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Ts,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new X,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new X),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Ts,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new X,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new X),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const n=this._hand;if(n)for(const r of e.hand.values())this._getHandJoint(n,r)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,n,r){let i=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const S of e.hand.values()){const _=n.getJointPose(S,r),w=this._getHandJoint(c,S);_!==null&&(w.matrix.fromArray(_.transform.matrix),w.matrix.decompose(w.position,w.rotation,w.scale),w.matrixWorldNeedsUpdate=!0,w.jointRadius=_.radius),w.visible=_!==null}const d=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],m=d.position.distanceTo(f.position),y=.02,x=.005;c.inputState.pinching&&m>y+x?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&m<=y-x&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=n.getPose(e.gripSpace,r),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(i=n.getPose(e.targetRaySpace,r),i===null&&s!==null&&(i=s),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(X0e)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const r=new Ts;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[n.jointName]=r,e.add(r)}return e.joints[n.jointName]}}const q0e=`
|
||
void main() {
|
||
|
||
gl_Position = vec4( position, 1.0 );
|
||
|
||
}`,K0e=`
|
||
uniform sampler2DArray depthColor;
|
||
uniform float depthWidth;
|
||
uniform float depthHeight;
|
||
|
||
void main() {
|
||
|
||
vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
|
||
|
||
if ( coord.x >= 1.0 ) {
|
||
|
||
gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
|
||
|
||
} else {
|
||
|
||
gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
|
||
|
||
}
|
||
|
||
}`;class Y0e{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n,r){if(this.texture===null){const i=new dr,s=e.properties.get(i);s.__webglTexture=n.texture,(n.depthNear!=r.depthNear||n.depthFar!=r.depthFar)&&(this.depthNear=n.depthNear,this.depthFar=n.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){const n=e.cameras[0].viewport,r=new Qo({vertexShader:q0e,fragmentShader:K0e,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new yr(new tv(20,20),r)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Z0e extends Bl{constructor(e,n){super();const r=this;let i=null,s=1,o=null,a="local-floor",l=1,c=null,d=null,f=null,m=null,y=null,x=null;const S=new Y0e,_=n.getContextAttributes();let w=null,A=null;const T=[],C=[],O=new Ve;let N=null;const D=new Tr;D.layers.enable(1),D.viewport=new Ln;const F=new Tr;F.layers.enable(2),F.viewport=new Ln;const V=[D,F],k=new g6;k.layers.enable(1),k.layers.enable(2);let j=null,H=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ae){let fe=T[ae];return fe===void 0&&(fe=new xA,T[ae]=fe),fe.getTargetRaySpace()},this.getControllerGrip=function(ae){let fe=T[ae];return fe===void 0&&(fe=new xA,T[ae]=fe),fe.getGripSpace()},this.getHand=function(ae){let fe=T[ae];return fe===void 0&&(fe=new xA,T[ae]=fe),fe.getHandSpace()};function ne(ae){const fe=C.indexOf(ae.inputSource);if(fe===-1)return;const _e=T[fe];_e!==void 0&&(_e.update(ae.inputSource,ae.frame,c||o),_e.dispatchEvent({type:ae.type,data:ae.inputSource}))}function te(){i.removeEventListener("select",ne),i.removeEventListener("selectstart",ne),i.removeEventListener("selectend",ne),i.removeEventListener("squeeze",ne),i.removeEventListener("squeezestart",ne),i.removeEventListener("squeezeend",ne),i.removeEventListener("end",te),i.removeEventListener("inputsourceschange",pe);for(let ae=0;ae<T.length;ae++){const fe=C[ae];fe!==null&&(C[ae]=null,T[ae].disconnect(fe))}j=null,H=null,S.reset(),e.setRenderTarget(w),y=null,m=null,f=null,i=null,A=null,ge.stop(),r.isPresenting=!1,e.setPixelRatio(N),e.setSize(O.width,O.height,!1),r.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(ae){s=ae,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(ae){a=ae,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(ae){c=ae},this.getBaseLayer=function(){return m!==null?m:y},this.getBinding=function(){return f},this.getFrame=function(){return x},this.getSession=function(){return i},this.setSession=async function(ae){if(i=ae,i!==null){if(w=e.getRenderTarget(),i.addEventListener("select",ne),i.addEventListener("selectstart",ne),i.addEventListener("selectend",ne),i.addEventListener("squeeze",ne),i.addEventListener("squeezestart",ne),i.addEventListener("squeezeend",ne),i.addEventListener("end",te),i.addEventListener("inputsourceschange",pe),_.xrCompatible!==!0&&await n.makeXRCompatible(),N=e.getPixelRatio(),e.getSize(O),i.renderState.layers===void 0){const fe={antialias:_.antialias,alpha:!0,depth:_.depth,stencil:_.stencil,framebufferScaleFactor:s};y=new XRWebGLLayer(i,n,fe),i.updateRenderState({baseLayer:y}),e.setPixelRatio(1),e.setSize(y.framebufferWidth,y.framebufferHeight,!1),A=new Va(y.framebufferWidth,y.framebufferHeight,{format:is,type:Ha,colorSpace:e.outputColorSpace,stencilBuffer:_.stencil})}else{let fe=null,_e=null,Se=null;_.depth&&(Se=_.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,fe=_.stencil?Fh:Mh,_e=_.stencil?jh:eu);const $e={colorFormat:n.RGBA8,depthFormat:Se,scaleFactor:s};f=new XRWebGLBinding(i,n),m=f.createProjectionLayer($e),i.updateRenderState({layers:[m]}),e.setPixelRatio(1),e.setSize(m.textureWidth,m.textureHeight,!1),A=new Va(m.textureWidth,m.textureHeight,{format:is,type:Ha,depthTexture:new T2(m.textureWidth,m.textureHeight,_e,void 0,void 0,void 0,void 0,void 0,void 0,fe),stencilBuffer:_.stencil,colorSpace:e.outputColorSpace,samples:_.antialias?4:0,resolveDepthBuffer:m.ignoreDepthValues===!1})}A.isXRRenderTarget=!0,this.setFoveation(l),c=null,o=await i.requestReferenceSpace(a),ge.setContext(i),ge.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return S.getDepthTexture()};function pe(ae){for(let fe=0;fe<ae.removed.length;fe++){const _e=ae.removed[fe],Se=C.indexOf(_e);Se>=0&&(C[Se]=null,T[Se].disconnect(_e))}for(let fe=0;fe<ae.added.length;fe++){const _e=ae.added[fe];let Se=C.indexOf(_e);if(Se===-1){for(let Me=0;Me<T.length;Me++)if(Me>=C.length){C.push(_e),Se=Me;break}else if(C[Me]===null){C[Me]=_e,Se=Me;break}if(Se===-1)break}const $e=T[Se];$e&&$e.connect(_e)}}const oe=new X,ce=new X;function B(ae,fe,_e){oe.setFromMatrixPosition(fe.matrixWorld),ce.setFromMatrixPosition(_e.matrixWorld);const Se=oe.distanceTo(ce),$e=fe.projectionMatrix.elements,Me=_e.projectionMatrix.elements,He=$e[14]/($e[10]-1),Xe=$e[14]/($e[10]+1),ue=($e[9]+1)/$e[5],Q=($e[9]-1)/$e[5],Ge=($e[8]-1)/$e[0],Ue=(Me[8]+1)/Me[0],We=He*Ge,Qe=He*Ue,xt=Se/(-Ge+Ue),at=xt*-Ge;if(fe.matrixWorld.decompose(ae.position,ae.quaternion,ae.scale),ae.translateX(at),ae.translateZ(xt),ae.matrixWorld.compose(ae.position,ae.quaternion,ae.scale),ae.matrixWorldInverse.copy(ae.matrixWorld).invert(),$e[10]===-1)ae.projectionMatrix.copy(fe.projectionMatrix),ae.projectionMatrixInverse.copy(fe.projectionMatrixInverse);else{const ee=He+xt,W=Xe+xt,Ee=We-at,Be=Qe+(Se-at),le=ue*Xe/W*ee,Ce=Q*Xe/W*ee;ae.projectionMatrix.makePerspective(Ee,Be,le,Ce,ee,W),ae.projectionMatrixInverse.copy(ae.projectionMatrix).invert()}}function K(ae,fe){fe===null?ae.matrixWorld.copy(ae.matrix):ae.matrixWorld.multiplyMatrices(fe.matrixWorld,ae.matrix),ae.matrixWorldInverse.copy(ae.matrixWorld).invert()}this.updateCamera=function(ae){if(i===null)return;let fe=ae.near,_e=ae.far;S.texture!==null&&(S.depthNear>0&&(fe=S.depthNear),S.depthFar>0&&(_e=S.depthFar)),k.near=F.near=D.near=fe,k.far=F.far=D.far=_e,(j!==k.near||H!==k.far)&&(i.updateRenderState({depthNear:k.near,depthFar:k.far}),j=k.near,H=k.far);const Se=ae.parent,$e=k.cameras;K(k,Se);for(let Me=0;Me<$e.length;Me++)K($e[Me],Se);$e.length===2?B(k,D,F):k.projectionMatrix.copy(D.projectionMatrix),q(ae,k,Se)};function q(ae,fe,_e){_e===null?ae.matrix.copy(fe.matrixWorld):(ae.matrix.copy(_e.matrixWorld),ae.matrix.invert(),ae.matrix.multiply(fe.matrixWorld)),ae.matrix.decompose(ae.position,ae.quaternion,ae.scale),ae.updateMatrixWorld(!0),ae.projectionMatrix.copy(fe.projectionMatrix),ae.projectionMatrixInverse.copy(fe.projectionMatrixInverse),ae.isPerspectiveCamera&&(ae.fov=Og*2*Math.atan(1/ae.projectionMatrix.elements[5]),ae.zoom=1)}this.getCamera=function(){return k},this.getFoveation=function(){if(!(m===null&&y===null))return l},this.setFoveation=function(ae){l=ae,m!==null&&(m.fixedFoveation=ae),y!==null&&y.fixedFoveation!==void 0&&(y.fixedFoveation=ae)},this.hasDepthSensing=function(){return S.texture!==null},this.getDepthSensingMesh=function(){return S.getMesh(k)};let $=null;function Z(ae,fe){if(d=fe.getViewerPose(c||o),x=fe,d!==null){const _e=d.views;y!==null&&(e.setRenderTargetFramebuffer(A,y.framebuffer),e.setRenderTarget(A));let Se=!1;_e.length!==k.cameras.length&&(k.cameras.length=0,Se=!0);for(let Me=0;Me<_e.length;Me++){const He=_e[Me];let Xe=null;if(y!==null)Xe=y.getViewport(He);else{const Q=f.getViewSubImage(m,He);Xe=Q.viewport,Me===0&&(e.setRenderTargetTextures(A,Q.colorTexture,m.ignoreDepthValues?void 0:Q.depthStencilTexture),e.setRenderTarget(A))}let ue=V[Me];ue===void 0&&(ue=new Tr,ue.layers.enable(Me),ue.viewport=new Ln,V[Me]=ue),ue.matrix.fromArray(He.transform.matrix),ue.matrix.decompose(ue.position,ue.quaternion,ue.scale),ue.projectionMatrix.fromArray(He.projectionMatrix),ue.projectionMatrixInverse.copy(ue.projectionMatrix).invert(),ue.viewport.set(Xe.x,Xe.y,Xe.width,Xe.height),Me===0&&(k.matrix.copy(ue.matrix),k.matrix.decompose(k.position,k.quaternion,k.scale)),Se===!0&&k.cameras.push(ue)}const $e=i.enabledFeatures;if($e&&$e.includes("depth-sensing")){const Me=f.getDepthInformation(_e[0]);Me&&Me.isValid&&Me.texture&&S.init(e,Me,i.renderState)}}for(let _e=0;_e<T.length;_e++){const Se=C[_e],$e=T[_e];Se!==null&&$e!==void 0&&$e.update(Se,fe,c||o)}$&&$(ae,fe),fe.detectedPlanes&&r.dispatchEvent({type:"planesdetected",data:fe}),x=null}const ge=new u6;ge.setAnimationLoop(Z),this.setAnimationLoop=function(ae){$=ae},this.dispose=function(){}}}const If=new as,Q0e=new Ct;function J0e(t,e){function n(_,w){_.matrixAutoUpdate===!0&&_.updateMatrix(),w.value.copy(_.matrix)}function r(_,w){w.color.getRGB(_.fogColor.value,a6(t)),w.isFog?(_.fogNear.value=w.near,_.fogFar.value=w.far):w.isFogExp2&&(_.fogDensity.value=w.density)}function i(_,w,A,T,C){w.isMeshBasicMaterial||w.isMeshLambertMaterial?s(_,w):w.isMeshToonMaterial?(s(_,w),f(_,w)):w.isMeshPhongMaterial?(s(_,w),d(_,w)):w.isMeshStandardMaterial?(s(_,w),m(_,w),w.isMeshPhysicalMaterial&&y(_,w,C)):w.isMeshMatcapMaterial?(s(_,w),x(_,w)):w.isMeshDepthMaterial?s(_,w):w.isMeshDistanceMaterial?(s(_,w),S(_,w)):w.isMeshNormalMaterial?s(_,w):w.isLineBasicMaterial?(o(_,w),w.isLineDashedMaterial&&a(_,w)):w.isPointsMaterial?l(_,w,A,T):w.isSpriteMaterial?c(_,w):w.isShadowMaterial?(_.color.value.copy(w.color),_.opacity.value=w.opacity):w.isShaderMaterial&&(w.uniformsNeedUpdate=!1)}function s(_,w){_.opacity.value=w.opacity,w.color&&_.diffuse.value.copy(w.color),w.emissive&&_.emissive.value.copy(w.emissive).multiplyScalar(w.emissiveIntensity),w.map&&(_.map.value=w.map,n(w.map,_.mapTransform)),w.alphaMap&&(_.alphaMap.value=w.alphaMap,n(w.alphaMap,_.alphaMapTransform)),w.bumpMap&&(_.bumpMap.value=w.bumpMap,n(w.bumpMap,_.bumpMapTransform),_.bumpScale.value=w.bumpScale,w.side===ss&&(_.bumpScale.value*=-1)),w.normalMap&&(_.normalMap.value=w.normalMap,n(w.normalMap,_.normalMapTransform),_.normalScale.value.copy(w.normalScale),w.side===ss&&_.normalScale.value.negate()),w.displacementMap&&(_.displacementMap.value=w.displacementMap,n(w.displacementMap,_.displacementMapTransform),_.displacementScale.value=w.displacementScale,_.displacementBias.value=w.displacementBias),w.emissiveMap&&(_.emissiveMap.value=w.emissiveMap,n(w.emissiveMap,_.emissiveMapTransform)),w.specularMap&&(_.specularMap.value=w.specularMap,n(w.specularMap,_.specularMapTransform)),w.alphaTest>0&&(_.alphaTest.value=w.alphaTest);const A=e.get(w),T=A.envMap,C=A.envMapRotation;T&&(_.envMap.value=T,If.copy(C),If.x*=-1,If.y*=-1,If.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(If.y*=-1,If.z*=-1),_.envMapRotation.value.setFromMatrix4(Q0e.makeRotationFromEuler(If)),_.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,_.reflectivity.value=w.reflectivity,_.ior.value=w.ior,_.refractionRatio.value=w.refractionRatio),w.lightMap&&(_.lightMap.value=w.lightMap,_.lightMapIntensity.value=w.lightMapIntensity,n(w.lightMap,_.lightMapTransform)),w.aoMap&&(_.aoMap.value=w.aoMap,_.aoMapIntensity.value=w.aoMapIntensity,n(w.aoMap,_.aoMapTransform))}function o(_,w){_.diffuse.value.copy(w.color),_.opacity.value=w.opacity,w.map&&(_.map.value=w.map,n(w.map,_.mapTransform))}function a(_,w){_.dashSize.value=w.dashSize,_.totalSize.value=w.dashSize+w.gapSize,_.scale.value=w.scale}function l(_,w,A,T){_.diffuse.value.copy(w.color),_.opacity.value=w.opacity,_.size.value=w.size*A,_.scale.value=T*.5,w.map&&(_.map.value=w.map,n(w.map,_.uvTransform)),w.alphaMap&&(_.alphaMap.value=w.alphaMap,n(w.alphaMap,_.alphaMapTransform)),w.alphaTest>0&&(_.alphaTest.value=w.alphaTest)}function c(_,w){_.diffuse.value.copy(w.color),_.opacity.value=w.opacity,_.rotation.value=w.rotation,w.map&&(_.map.value=w.map,n(w.map,_.mapTransform)),w.alphaMap&&(_.alphaMap.value=w.alphaMap,n(w.alphaMap,_.alphaMapTransform)),w.alphaTest>0&&(_.alphaTest.value=w.alphaTest)}function d(_,w){_.specular.value.copy(w.specular),_.shininess.value=Math.max(w.shininess,1e-4)}function f(_,w){w.gradientMap&&(_.gradientMap.value=w.gradientMap)}function m(_,w){_.metalness.value=w.metalness,w.metalnessMap&&(_.metalnessMap.value=w.metalnessMap,n(w.metalnessMap,_.metalnessMapTransform)),_.roughness.value=w.roughness,w.roughnessMap&&(_.roughnessMap.value=w.roughnessMap,n(w.roughnessMap,_.roughnessMapTransform)),w.envMap&&(_.envMapIntensity.value=w.envMapIntensity)}function y(_,w,A){_.ior.value=w.ior,w.sheen>0&&(_.sheenColor.value.copy(w.sheenColor).multiplyScalar(w.sheen),_.sheenRoughness.value=w.sheenRoughness,w.sheenColorMap&&(_.sheenColorMap.value=w.sheenColorMap,n(w.sheenColorMap,_.sheenColorMapTransform)),w.sheenRoughnessMap&&(_.sheenRoughnessMap.value=w.sheenRoughnessMap,n(w.sheenRoughnessMap,_.sheenRoughnessMapTransform))),w.clearcoat>0&&(_.clearcoat.value=w.clearcoat,_.clearcoatRoughness.value=w.clearcoatRoughness,w.clearcoatMap&&(_.clearcoatMap.value=w.clearcoatMap,n(w.clearcoatMap,_.clearcoatMapTransform)),w.clearcoatRoughnessMap&&(_.clearcoatRoughnessMap.value=w.clearcoatRoughnessMap,n(w.clearcoatRoughnessMap,_.clearcoatRoughnessMapTransform)),w.clearcoatNormalMap&&(_.clearcoatNormalMap.value=w.clearcoatNormalMap,n(w.clearcoatNormalMap,_.clearcoatNormalMapTransform),_.clearcoatNormalScale.value.copy(w.clearcoatNormalScale),w.side===ss&&_.clearcoatNormalScale.value.negate())),w.dispersion>0&&(_.dispersion.value=w.dispersion),w.iridescence>0&&(_.iridescence.value=w.iridescence,_.iridescenceIOR.value=w.iridescenceIOR,_.iridescenceThicknessMinimum.value=w.iridescenceThicknessRange[0],_.iridescenceThicknessMaximum.value=w.iridescenceThicknessRange[1],w.iridescenceMap&&(_.iridescenceMap.value=w.iridescenceMap,n(w.iridescenceMap,_.iridescenceMapTransform)),w.iridescenceThicknessMap&&(_.iridescenceThicknessMap.value=w.iridescenceThicknessMap,n(w.iridescenceThicknessMap,_.iridescenceThicknessMapTransform))),w.transmission>0&&(_.transmission.value=w.transmission,_.transmissionSamplerMap.value=A.texture,_.transmissionSamplerSize.value.set(A.width,A.height),w.transmissionMap&&(_.transmissionMap.value=w.transmissionMap,n(w.transmissionMap,_.transmissionMapTransform)),_.thickness.value=w.thickness,w.thicknessMap&&(_.thicknessMap.value=w.thicknessMap,n(w.thicknessMap,_.thicknessMapTransform)),_.attenuationDistance.value=w.attenuationDistance,_.attenuationColor.value.copy(w.attenuationColor)),w.anisotropy>0&&(_.anisotropyVector.value.set(w.anisotropy*Math.cos(w.anisotropyRotation),w.anisotropy*Math.sin(w.anisotropyRotation)),w.anisotropyMap&&(_.anisotropyMap.value=w.anisotropyMap,n(w.anisotropyMap,_.anisotropyMapTransform))),_.specularIntensity.value=w.specularIntensity,_.specularColor.value.copy(w.specularColor),w.specularColorMap&&(_.specularColorMap.value=w.specularColorMap,n(w.specularColorMap,_.specularColorMapTransform)),w.specularIntensityMap&&(_.specularIntensityMap.value=w.specularIntensityMap,n(w.specularIntensityMap,_.specularIntensityMapTransform))}function x(_,w){w.matcap&&(_.matcap.value=w.matcap)}function S(_,w){const A=e.get(w).light;_.referencePosition.value.setFromMatrixPosition(A.matrixWorld),_.nearDistance.value=A.shadow.camera.near,_.farDistance.value=A.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function eye(t,e,n,r){let i={},s={},o=[];const a=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function l(A,T){const C=T.program;r.uniformBlockBinding(A,C)}function c(A,T){let C=i[A.id];C===void 0&&(x(A),C=d(A),i[A.id]=C,A.addEventListener("dispose",_));const O=T.program;r.updateUBOMapping(A,O);const N=e.render.frame;s[A.id]!==N&&(m(A),s[A.id]=N)}function d(A){const T=f();A.__bindingPointIndex=T;const C=t.createBuffer(),O=A.__size,N=A.usage;return t.bindBuffer(t.UNIFORM_BUFFER,C),t.bufferData(t.UNIFORM_BUFFER,O,N),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,T,C),C}function f(){for(let A=0;A<a;A++)if(o.indexOf(A)===-1)return o.push(A),A;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function m(A){const T=i[A.id],C=A.uniforms,O=A.__cache;t.bindBuffer(t.UNIFORM_BUFFER,T);for(let N=0,D=C.length;N<D;N++){const F=Array.isArray(C[N])?C[N]:[C[N]];for(let V=0,k=F.length;V<k;V++){const j=F[V];if(y(j,N,V,O)===!0){const H=j.__offset,ne=Array.isArray(j.value)?j.value:[j.value];let te=0;for(let pe=0;pe<ne.length;pe++){const oe=ne[pe],ce=S(oe);typeof oe=="number"||typeof oe=="boolean"?(j.__data[0]=oe,t.bufferSubData(t.UNIFORM_BUFFER,H+te,j.__data)):oe.isMatrix3?(j.__data[0]=oe.elements[0],j.__data[1]=oe.elements[1],j.__data[2]=oe.elements[2],j.__data[3]=0,j.__data[4]=oe.elements[3],j.__data[5]=oe.elements[4],j.__data[6]=oe.elements[5],j.__data[7]=0,j.__data[8]=oe.elements[6],j.__data[9]=oe.elements[7],j.__data[10]=oe.elements[8],j.__data[11]=0):(oe.toArray(j.__data,te),te+=ce.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,H,j.__data)}}}t.bindBuffer(t.UNIFORM_BUFFER,null)}function y(A,T,C,O){const N=A.value,D=T+"_"+C;if(O[D]===void 0)return typeof N=="number"||typeof N=="boolean"?O[D]=N:O[D]=N.clone(),!0;{const F=O[D];if(typeof N=="number"||typeof N=="boolean"){if(F!==N)return O[D]=N,!0}else if(F.equals(N)===!1)return F.copy(N),!0}return!1}function x(A){const T=A.uniforms;let C=0;const O=16;for(let D=0,F=T.length;D<F;D++){const V=Array.isArray(T[D])?T[D]:[T[D]];for(let k=0,j=V.length;k<j;k++){const H=V[k],ne=Array.isArray(H.value)?H.value:[H.value];for(let te=0,pe=ne.length;te<pe;te++){const oe=ne[te],ce=S(oe),B=C%O,K=B%ce.boundary,q=B+K;C+=K,q!==0&&O-q<ce.storage&&(C+=O-q),H.__data=new Float32Array(ce.storage/Float32Array.BYTES_PER_ELEMENT),H.__offset=C,C+=ce.storage}}}const N=C%O;return N>0&&(C+=O-N),A.__size=C,A.__cache={},this}function S(A){const T={boundary:0,storage:0};return typeof A=="number"||typeof A=="boolean"?(T.boundary=4,T.storage=4):A.isVector2?(T.boundary=8,T.storage=8):A.isVector3||A.isColor?(T.boundary=16,T.storage=12):A.isVector4?(T.boundary=16,T.storage=16):A.isMatrix3?(T.boundary=48,T.storage=48):A.isMatrix4?(T.boundary=64,T.storage=64):A.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",A),T}function _(A){const T=A.target;T.removeEventListener("dispose",_);const C=o.indexOf(T.__bindingPointIndex);o.splice(C,1),t.deleteBuffer(i[T.id]),delete i[T.id],delete s[T.id]}function w(){for(const A in i)t.deleteBuffer(i[A]);o=[],i={},s={}}return{bind:l,update:c,dispose:w}}class v6{constructor(e={}){const{canvas:n=r6(),context:r=null,depth:i=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:f=!1}=e;this.isWebGLRenderer=!0;let m;if(r!==null){if(typeof WebGLRenderingContext<"u"&&r instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");m=r.getContextAttributes().alpha}else m=o;const y=new Uint32Array(4),x=new Int32Array(4);let S=null,_=null;const w=[],A=[];this.domElement=n,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=ji,this.toneMapping=Cl,this.toneMappingExposure=1;const T=this;let C=!1,O=0,N=0,D=null,F=-1,V=null;const k=new Ln,j=new Ln;let H=null;const ne=new ot(0);let te=0,pe=n.width,oe=n.height,ce=1,B=null,K=null;const q=new Ln(0,0,pe,oe),$=new Ln(0,0,pe,oe);let Z=!1;const ge=new dx;let ae=!1,fe=!1;const _e=new Ct,Se=new Ct,$e=new X,Me=new Ln,He={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Xe=!1;function ue(){return D===null?ce:1}let Q=r;function Ge(Y,xe){return n.getContext(Y,xe)}try{const Y={alpha:!0,depth:i,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:d,failIfMajorPerformanceCaveat:f};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${Td}`),n.addEventListener("webglcontextlost",Le,!1),n.addEventListener("webglcontextrestored",Ke,!1),n.addEventListener("webglcontextcreationerror",ut,!1),Q===null){const xe="webgl2";if(Q=Ge(xe,Y),Q===null)throw Ge(xe)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(Y){throw console.error("THREE.WebGLRenderer: "+Y.message),Y}let Ue,We,Qe,xt,at,ee,W,Ee,Be,le,Ce,lt,rt,ft,nn,qe,dt,Dt,Ut,pt,de,J,Ae,re;function Fe(){Ue=new ove(Q),Ue.init(),J=new m6(Q,Ue),We=new eve(Q,Ue,e,J),Qe=new z0e(Q),We.reverseDepthBuffer&&Qe.buffers.depth.setReversed(!0),xt=new cve(Q),at=new T0e,ee=new $0e(Q,Ue,Qe,at,We,J,xt),W=new nve(T),Ee=new sve(T),Be=new gpe(Q),Ae=new Qge(Q,Be),le=new ave(Q,Be,xt,Ae),Ce=new dve(Q,le,Be,xt),Ut=new uve(Q,We,ee),qe=new tve(at),lt=new A0e(T,W,Ee,Ue,We,Ae,qe),rt=new J0e(T,at),ft=new P0e,nn=new L0e(Ue),Dt=new Zge(T,W,Ee,Qe,Ce,m,l),dt=new j0e(T,Ce,We),re=new eye(Q,xt,We,Qe),pt=new Jge(Q,Ue,xt),de=new lve(Q,Ue,xt),xt.programs=lt.programs,T.capabilities=We,T.extensions=Ue,T.properties=at,T.renderLists=ft,T.shadowMap=dt,T.state=Qe,T.info=xt}Fe();const Te=new Z0e(T,Q);this.xr=Te,this.getContext=function(){return Q},this.getContextAttributes=function(){return Q.getContextAttributes()},this.forceContextLoss=function(){const Y=Ue.get("WEBGL_lose_context");Y&&Y.loseContext()},this.forceContextRestore=function(){const Y=Ue.get("WEBGL_lose_context");Y&&Y.restoreContext()},this.getPixelRatio=function(){return ce},this.setPixelRatio=function(Y){Y!==void 0&&(ce=Y,this.setSize(pe,oe,!1))},this.getSize=function(Y){return Y.set(pe,oe)},this.setSize=function(Y,xe,Re=!0){if(Te.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}pe=Y,oe=xe,n.width=Math.floor(Y*ce),n.height=Math.floor(xe*ce),Re===!0&&(n.style.width=Y+"px",n.style.height=xe+"px"),this.setViewport(0,0,Y,xe)},this.getDrawingBufferSize=function(Y){return Y.set(pe*ce,oe*ce).floor()},this.setDrawingBufferSize=function(Y,xe,Re){pe=Y,oe=xe,ce=Re,n.width=Math.floor(Y*Re),n.height=Math.floor(xe*Re),this.setViewport(0,0,Y,xe)},this.getCurrentViewport=function(Y){return Y.copy(k)},this.getViewport=function(Y){return Y.copy(q)},this.setViewport=function(Y,xe,Re,ke){Y.isVector4?q.set(Y.x,Y.y,Y.z,Y.w):q.set(Y,xe,Re,ke),Qe.viewport(k.copy(q).multiplyScalar(ce).round())},this.getScissor=function(Y){return Y.copy($)},this.setScissor=function(Y,xe,Re,ke){Y.isVector4?$.set(Y.x,Y.y,Y.z,Y.w):$.set(Y,xe,Re,ke),Qe.scissor(j.copy($).multiplyScalar(ce).round())},this.getScissorTest=function(){return Z},this.setScissorTest=function(Y){Qe.setScissorTest(Z=Y)},this.setOpaqueSort=function(Y){B=Y},this.setTransparentSort=function(Y){K=Y},this.getClearColor=function(Y){return Y.copy(Dt.getClearColor())},this.setClearColor=function(){Dt.setClearColor.apply(Dt,arguments)},this.getClearAlpha=function(){return Dt.getClearAlpha()},this.setClearAlpha=function(){Dt.setClearAlpha.apply(Dt,arguments)},this.clear=function(Y=!0,xe=!0,Re=!0){let ke=0;if(Y){let we=!1;if(D!==null){const et=D.texture.format;we=et===XS||et===$S||et===ax}if(we){const et=D.texture.type,vt=et===Ha||et===eu||et===Ng||et===jh||et===VS||et===GS,st=Dt.getClearColor(),Mt=Dt.getClearAlpha(),Ft=st.r,Ht=st.g,Pt=st.b;vt?(y[0]=Ft,y[1]=Ht,y[2]=Pt,y[3]=Mt,Q.clearBufferuiv(Q.COLOR,0,y)):(x[0]=Ft,x[1]=Ht,x[2]=Pt,x[3]=Mt,Q.clearBufferiv(Q.COLOR,0,x))}else ke|=Q.COLOR_BUFFER_BIT}xe&&(ke|=Q.DEPTH_BUFFER_BIT,Q.clearDepth(this.capabilities.reverseDepthBuffer?0:1)),Re&&(ke|=Q.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Q.clear(ke)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){n.removeEventListener("webglcontextlost",Le,!1),n.removeEventListener("webglcontextrestored",Ke,!1),n.removeEventListener("webglcontextcreationerror",ut,!1),ft.dispose(),nn.dispose(),at.dispose(),W.dispose(),Ee.dispose(),Ce.dispose(),Ae.dispose(),re.dispose(),lt.dispose(),Te.dispose(),Te.removeEventListener("sessionstart",Si),Te.removeEventListener("sessionend",ra),Mi.stop()};function Le(Y){Y.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),C=!0}function Ke(){console.log("THREE.WebGLRenderer: Context Restored."),C=!1;const Y=xt.autoReset,xe=dt.enabled,Re=dt.autoUpdate,ke=dt.needsUpdate,we=dt.type;Fe(),xt.autoReset=Y,dt.enabled=xe,dt.autoUpdate=Re,dt.needsUpdate=ke,dt.type=we}function ut(Y){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",Y.statusMessage)}function Kt(Y){const xe=Y.target;xe.removeEventListener("dispose",Kt),un(xe)}function un(Y){Cn(Y),at.remove(Y)}function Cn(Y){const xe=at.get(Y).programs;xe!==void 0&&(xe.forEach(function(Re){lt.releaseProgram(Re)}),Y.isShaderMaterial&<.releaseShaderCache(Y))}this.renderBufferDirect=function(Y,xe,Re,ke,we,et){xe===null&&(xe=He);const vt=we.isMesh&&we.matrixWorld.determinant()<0,st=To(Y,xe,Re,ke,we);Qe.setMaterial(ke,vt);let Mt=Re.index,Ft=1;if(ke.wireframe===!0){if(Mt=le.getWireframeAttribute(Re),Mt===void 0)return;Ft=2}const Ht=Re.drawRange,Pt=Re.attributes.position;let Sn=Ht.start*Ft,Mn=(Ht.start+Ht.count)*Ft;et!==null&&(Sn=Math.max(Sn,et.start*Ft),Mn=Math.min(Mn,(et.start+et.count)*Ft)),Mt!==null?(Sn=Math.max(Sn,0),Mn=Math.min(Mn,Mt.count)):Pt!=null&&(Sn=Math.max(Sn,0),Mn=Math.min(Mn,Pt.count));const yn=Mn-Sn;if(yn<0||yn===1/0)return;Ae.setup(we,ke,st,Re,Mt);let Yt,Lt=pt;if(Mt!==null&&(Yt=Be.get(Mt),Lt=de,Lt.setIndex(Yt)),we.isMesh)ke.wireframe===!0?(Qe.setLineWidth(ke.wireframeLinewidth*ue()),Lt.setMode(Q.LINES)):Lt.setMode(Q.TRIANGLES);else if(we.isLine){let mt=ke.linewidth;mt===void 0&&(mt=1),Qe.setLineWidth(mt*ue()),we.isLineSegments?Lt.setMode(Q.LINES):we.isLineLoop?Lt.setMode(Q.LINE_LOOP):Lt.setMode(Q.LINE_STRIP)}else we.isPoints?Lt.setMode(Q.POINTS):we.isSprite&&Lt.setMode(Q.TRIANGLES);if(we.isBatchedMesh)if(we._multiDrawInstances!==null)Lt.renderMultiDrawInstances(we._multiDrawStarts,we._multiDrawCounts,we._multiDrawCount,we._multiDrawInstances);else if(Ue.get("WEBGL_multi_draw"))Lt.renderMultiDraw(we._multiDrawStarts,we._multiDrawCounts,we._multiDrawCount);else{const mt=we._multiDrawStarts,xn=we._multiDrawCounts,en=we._multiDrawCount,Pr=Mt?Be.get(Mt).bytesPerElement:1,li=at.get(ke).currentProgram.getUniforms();for(let kn=0;kn<en;kn++)li.setValue(Q,"_gl_DrawID",kn),Lt.render(mt[kn]/Pr,xn[kn])}else if(we.isInstancedMesh)Lt.renderInstances(Sn,yn,we.count);else if(Re.isInstancedBufferGeometry){const mt=Re._maxInstanceCount!==void 0?Re._maxInstanceCount:1/0,xn=Math.min(Re.instanceCount,mt);Lt.renderInstances(Sn,yn,xn)}else Lt.render(Sn,yn)};function Jt(Y,xe,Re){Y.transparent===!0&&Y.side===xo&&Y.forceSinglePass===!1?(Y.side=ss,Y.needsUpdate=!0,sa(Y,xe,Re),Y.side=Dl,Y.needsUpdate=!0,sa(Y,xe,Re),Y.side=xo):sa(Y,xe,Re)}this.compile=function(Y,xe,Re=null){Re===null&&(Re=Y),_=nn.get(Re),_.init(xe),A.push(_),Re.traverseVisible(function(we){we.isLight&&we.layers.test(xe.layers)&&(_.pushLight(we),we.castShadow&&_.pushShadow(we))}),Y!==Re&&Y.traverseVisible(function(we){we.isLight&&we.layers.test(xe.layers)&&(_.pushLight(we),we.castShadow&&_.pushShadow(we))}),_.setupLights();const ke=new Set;return Y.traverse(function(we){if(!(we.isMesh||we.isPoints||we.isLine||we.isSprite))return;const et=we.material;if(et)if(Array.isArray(et))for(let vt=0;vt<et.length;vt++){const st=et[vt];Jt(st,Re,we),ke.add(st)}else Jt(et,Re,we),ke.add(et)}),A.pop(),_=null,ke},this.compileAsync=function(Y,xe,Re=null){const ke=this.compile(Y,xe,Re);return new Promise(we=>{function et(){if(ke.forEach(function(vt){at.get(vt).currentProgram.isReady()&&ke.delete(vt)}),ke.size===0){we(Y);return}setTimeout(et,10)}Ue.get("KHR_parallel_shader_compile")!==null?et():setTimeout(et,10)})};let Hn=null;function hr(Y){Hn&&Hn(Y)}function Si(){Mi.stop()}function ra(){Mi.start()}const Mi=new u6;Mi.setAnimationLoop(hr),typeof self<"u"&&Mi.setContext(self),this.setAnimationLoop=function(Y){Hn=Y,Te.setAnimationLoop(Y),Y===null?Mi.stop():Mi.start()},Te.addEventListener("sessionstart",Si),Te.addEventListener("sessionend",ra),this.render=function(Y,xe){if(xe!==void 0&&xe.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(C===!0)return;if(Y.matrixWorldAutoUpdate===!0&&Y.updateMatrixWorld(),xe.parent===null&&xe.matrixWorldAutoUpdate===!0&&xe.updateMatrixWorld(),Te.enabled===!0&&Te.isPresenting===!0&&(Te.cameraAutoUpdate===!0&&Te.updateCamera(xe),xe=Te.getCamera()),Y.isScene===!0&&Y.onBeforeRender(T,Y,xe,D),_=nn.get(Y,A.length),_.init(xe),A.push(_),Se.multiplyMatrices(xe.projectionMatrix,xe.matrixWorldInverse),ge.setFromProjectionMatrix(Se),fe=this.localClippingEnabled,ae=qe.init(this.clippingPlanes,fe),S=ft.get(Y,w.length),S.init(),w.push(S),Te.enabled===!0&&Te.isPresenting===!0){const et=T.xr.getDepthSensingMesh();et!==null&&Ka(et,xe,-1/0,T.sortObjects)}Ka(Y,xe,0,T.sortObjects),S.finish(),T.sortObjects===!0&&S.sort(B,K),Xe=Te.enabled===!1||Te.isPresenting===!1||Te.hasDepthSensing()===!1,Xe&&Dt.addToRenderList(S,Y),this.info.render.frame++,ae===!0&&qe.beginShadows();const Re=_.state.shadowsArray;dt.render(Re,Y,xe),ae===!0&&qe.endShadows(),this.info.autoReset===!0&&this.info.reset();const ke=S.opaque,we=S.transmissive;if(_.setupLights(),xe.isArrayCamera){const et=xe.cameras;if(we.length>0)for(let vt=0,st=et.length;vt<st;vt++){const Mt=et[vt];ia(ke,we,Y,Mt)}Xe&&Dt.render(Y);for(let vt=0,st=et.length;vt<st;vt++){const Mt=et[vt];Ns(S,Y,Mt,Mt.viewport)}}else we.length>0&&ia(ke,we,Y,xe),Xe&&Dt.render(Y),Ns(S,Y,xe);D!==null&&(ee.updateMultisampleRenderTarget(D),ee.updateRenderTargetMipmap(D)),Y.isScene===!0&&Y.onAfterRender(T,Y,xe),Ae.resetDefaultState(),F=-1,V=null,A.pop(),A.length>0?(_=A[A.length-1],ae===!0&&qe.setGlobalState(T.clippingPlanes,_.state.camera)):_=null,w.pop(),w.length>0?S=w[w.length-1]:S=null};function Ka(Y,xe,Re,ke){if(Y.visible===!1)return;if(Y.layers.test(xe.layers)){if(Y.isGroup)Re=Y.renderOrder;else if(Y.isLOD)Y.autoUpdate===!0&&Y.update(xe);else if(Y.isLight)_.pushLight(Y),Y.castShadow&&_.pushShadow(Y);else if(Y.isSprite){if(!Y.frustumCulled||ge.intersectsSprite(Y)){ke&&Me.setFromMatrixPosition(Y.matrixWorld).applyMatrix4(Se);const vt=Ce.update(Y),st=Y.material;st.visible&&S.push(Y,vt,st,Re,Me.z,null)}}else if((Y.isMesh||Y.isLine||Y.isPoints)&&(!Y.frustumCulled||ge.intersectsObject(Y))){const vt=Ce.update(Y),st=Y.material;if(ke&&(Y.boundingSphere!==void 0?(Y.boundingSphere===null&&Y.computeBoundingSphere(),Me.copy(Y.boundingSphere.center)):(vt.boundingSphere===null&&vt.computeBoundingSphere(),Me.copy(vt.boundingSphere.center)),Me.applyMatrix4(Y.matrixWorld).applyMatrix4(Se)),Array.isArray(st)){const Mt=vt.groups;for(let Ft=0,Ht=Mt.length;Ft<Ht;Ft++){const Pt=Mt[Ft],Sn=st[Pt.materialIndex];Sn&&Sn.visible&&S.push(Y,vt,Sn,Re,Me.z,Pt)}}else st.visible&&S.push(Y,vt,st,Re,Me.z,null)}}const et=Y.children;for(let vt=0,st=et.length;vt<st;vt++)Ka(et[vt],xe,Re,ke)}function Ns(Y,xe,Re,ke){const we=Y.opaque,et=Y.transmissive,vt=Y.transparent;_.setupLightsView(Re),ae===!0&&qe.setGlobalState(T.clippingPlanes,Re),ke&&Qe.viewport(k.copy(ke)),we.length>0&&Ei(we,xe,Re),et.length>0&&Ei(et,xe,Re),vt.length>0&&Ei(vt,xe,Re),Qe.buffers.depth.setTest(!0),Qe.buffers.depth.setMask(!0),Qe.buffers.color.setMask(!0),Qe.setPolygonOffset(!1)}function ia(Y,xe,Re,ke){if((Re.isScene===!0?Re.overrideMaterial:null)!==null)return;_.state.transmissionRenderTarget[ke.id]===void 0&&(_.state.transmissionRenderTarget[ke.id]=new Va(1,1,{generateMipmaps:!0,type:Ue.has("EXT_color_buffer_half_float")||Ue.has("EXT_color_buffer_float")?ev:Ha,minFilter:qo,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:In.workingColorSpace}));const et=_.state.transmissionRenderTarget[ke.id],vt=ke.viewport||k;et.setSize(vt.z,vt.w);const st=T.getRenderTarget();T.setRenderTarget(et),T.getClearColor(ne),te=T.getClearAlpha(),te<1&&T.setClearColor(16777215,.5),T.clear(),Xe&&Dt.render(Re);const Mt=T.toneMapping;T.toneMapping=Cl;const Ft=ke.viewport;if(ke.viewport!==void 0&&(ke.viewport=void 0),_.setupLightsView(ke),ae===!0&&qe.setGlobalState(T.clippingPlanes,ke),Ei(Y,Re,ke),ee.updateMultisampleRenderTarget(et),ee.updateRenderTargetMipmap(et),Ue.has("WEBGL_multisampled_render_to_texture")===!1){let Ht=!1;for(let Pt=0,Sn=xe.length;Pt<Sn;Pt++){const Mn=xe[Pt],yn=Mn.object,Yt=Mn.geometry,Lt=Mn.material,mt=Mn.group;if(Lt.side===xo&&yn.layers.test(ke.layers)){const xn=Lt.side;Lt.side=ss,Lt.needsUpdate=!0,Ao(yn,Re,ke,Yt,Lt,mt),Lt.side=xn,Lt.needsUpdate=!0,Ht=!0}}Ht===!0&&(ee.updateMultisampleRenderTarget(et),ee.updateRenderTargetMipmap(et))}T.setRenderTarget(st),T.setClearColor(ne,te),Ft!==void 0&&(ke.viewport=Ft),T.toneMapping=Mt}function Ei(Y,xe,Re){const ke=xe.isScene===!0?xe.overrideMaterial:null;for(let we=0,et=Y.length;we<et;we++){const vt=Y[we],st=vt.object,Mt=vt.geometry,Ft=ke===null?vt.material:ke,Ht=vt.group;st.layers.test(Re.layers)&&Ao(st,xe,Re,Mt,Ft,Ht)}}function Ao(Y,xe,Re,ke,we,et){Y.onBeforeRender(T,xe,Re,ke,we,et),Y.modelViewMatrix.multiplyMatrices(Re.matrixWorldInverse,Y.matrixWorld),Y.normalMatrix.getNormalMatrix(Y.modelViewMatrix),we.onBeforeRender(T,xe,Re,ke,Y,et),we.transparent===!0&&we.side===xo&&we.forceSinglePass===!1?(we.side=ss,we.needsUpdate=!0,T.renderBufferDirect(Re,xe,ke,we,Y,et),we.side=Dl,we.needsUpdate=!0,T.renderBufferDirect(Re,xe,ke,we,Y,et),we.side=xo):T.renderBufferDirect(Re,xe,ke,we,Y,et),Y.onAfterRender(T,xe,Re,ke,we,et)}function sa(Y,xe,Re){xe.isScene!==!0&&(xe=He);const ke=at.get(Y),we=_.state.lights,et=_.state.shadowsArray,vt=we.state.version,st=lt.getParameters(Y,we.state,et,xe,Re),Mt=lt.getProgramCacheKey(st);let Ft=ke.programs;ke.environment=Y.isMeshStandardMaterial?xe.environment:null,ke.fog=xe.fog,ke.envMap=(Y.isMeshStandardMaterial?Ee:W).get(Y.envMap||ke.environment),ke.envMapRotation=ke.environment!==null&&Y.envMap===null?xe.environmentRotation:Y.envMapRotation,Ft===void 0&&(Y.addEventListener("dispose",Kt),Ft=new Map,ke.programs=Ft);let Ht=Ft.get(Mt);if(Ht!==void 0){if(ke.currentProgram===Ht&&ke.lightsStateVersion===vt)return uu(Y,st),Ht}else st.uniforms=lt.getUniforms(Y),Y.onBeforeCompile(st,T),Ht=lt.acquireProgram(st,Mt),Ft.set(Mt,Ht),ke.uniforms=st.uniforms;const Pt=ke.uniforms;return(!Y.isShaderMaterial&&!Y.isRawShaderMaterial||Y.clipping===!0)&&(Pt.clippingPlanes=qe.uniform),uu(Y,st),ke.needsLights=Hl(Y),ke.lightsStateVersion=vt,ke.needsLights&&(Pt.ambientLightColor.value=we.state.ambient,Pt.lightProbe.value=we.state.probe,Pt.directionalLights.value=we.state.directional,Pt.directionalLightShadows.value=we.state.directionalShadow,Pt.spotLights.value=we.state.spot,Pt.spotLightShadows.value=we.state.spotShadow,Pt.rectAreaLights.value=we.state.rectArea,Pt.ltc_1.value=we.state.rectAreaLTC1,Pt.ltc_2.value=we.state.rectAreaLTC2,Pt.pointLights.value=we.state.point,Pt.pointLightShadows.value=we.state.pointShadow,Pt.hemisphereLights.value=we.state.hemi,Pt.directionalShadowMap.value=we.state.directionalShadowMap,Pt.directionalShadowMatrix.value=we.state.directionalShadowMatrix,Pt.spotShadowMap.value=we.state.spotShadowMap,Pt.spotLightMatrix.value=we.state.spotLightMatrix,Pt.spotLightMap.value=we.state.spotLightMap,Pt.pointShadowMap.value=we.state.pointShadowMap,Pt.pointShadowMatrix.value=we.state.pointShadowMatrix),ke.currentProgram=Ht,ke.uniformsList=null,Ht}function cu(Y){if(Y.uniformsList===null){const xe=Y.currentProgram.getUniforms();Y.uniformsList=X_.seqWithValue(xe.seq,Y.uniforms)}return Y.uniformsList}function uu(Y,xe){const Re=at.get(Y);Re.outputColorSpace=xe.outputColorSpace,Re.batching=xe.batching,Re.batchingColor=xe.batchingColor,Re.instancing=xe.instancing,Re.instancingColor=xe.instancingColor,Re.instancingMorph=xe.instancingMorph,Re.skinning=xe.skinning,Re.morphTargets=xe.morphTargets,Re.morphNormals=xe.morphNormals,Re.morphColors=xe.morphColors,Re.morphTargetsCount=xe.morphTargetsCount,Re.numClippingPlanes=xe.numClippingPlanes,Re.numIntersection=xe.numClipIntersection,Re.vertexAlphas=xe.vertexAlphas,Re.vertexTangents=xe.vertexTangents,Re.toneMapping=xe.toneMapping}function To(Y,xe,Re,ke,we){xe.isScene!==!0&&(xe=He),ee.resetTextureUnits();const et=xe.fog,vt=ke.isMeshStandardMaterial?xe.environment:null,st=D===null?T.outputColorSpace:D.isXRRenderTarget===!0?D.texture.colorSpace:xi,Mt=(ke.isMeshStandardMaterial?Ee:W).get(ke.envMap||vt),Ft=ke.vertexColors===!0&&!!Re.attributes.color&&Re.attributes.color.itemSize===4,Ht=!!Re.attributes.tangent&&(!!ke.normalMap||ke.anisotropy>0),Pt=!!Re.morphAttributes.position,Sn=!!Re.morphAttributes.normal,Mn=!!Re.morphAttributes.color;let yn=Cl;ke.toneMapped&&(D===null||D.isXRRenderTarget===!0)&&(yn=T.toneMapping);const Yt=Re.morphAttributes.position||Re.morphAttributes.normal||Re.morphAttributes.color,Lt=Yt!==void 0?Yt.length:0,mt=at.get(ke),xn=_.state.lights;if(ae===!0&&(fe===!0||Y!==V)){const Xr=Y===V&&ke.id===F;qe.setState(ke,Y,Xr)}let en=!1;ke.version===mt.__version?(mt.needsLights&&mt.lightsStateVersion!==xn.state.version||mt.outputColorSpace!==st||we.isBatchedMesh&&mt.batching===!1||!we.isBatchedMesh&&mt.batching===!0||we.isBatchedMesh&&mt.batchingColor===!0&&we.colorTexture===null||we.isBatchedMesh&&mt.batchingColor===!1&&we.colorTexture!==null||we.isInstancedMesh&&mt.instancing===!1||!we.isInstancedMesh&&mt.instancing===!0||we.isSkinnedMesh&&mt.skinning===!1||!we.isSkinnedMesh&&mt.skinning===!0||we.isInstancedMesh&&mt.instancingColor===!0&&we.instanceColor===null||we.isInstancedMesh&&mt.instancingColor===!1&&we.instanceColor!==null||we.isInstancedMesh&&mt.instancingMorph===!0&&we.morphTexture===null||we.isInstancedMesh&&mt.instancingMorph===!1&&we.morphTexture!==null||mt.envMap!==Mt||ke.fog===!0&&mt.fog!==et||mt.numClippingPlanes!==void 0&&(mt.numClippingPlanes!==qe.numPlanes||mt.numIntersection!==qe.numIntersection)||mt.vertexAlphas!==Ft||mt.vertexTangents!==Ht||mt.morphTargets!==Pt||mt.morphNormals!==Sn||mt.morphColors!==Mn||mt.toneMapping!==yn||mt.morphTargetsCount!==Lt)&&(en=!0):(en=!0,mt.__version=ke.version);let Pr=mt.currentProgram;en===!0&&(Pr=sa(ke,xe,we));let li=!1,kn=!1,Is=!1;const Vn=Pr.getUniforms(),eo=mt.uniforms;if(Qe.useProgram(Pr.program)&&(li=!0,kn=!0,Is=!0),ke.id!==F&&(F=ke.id,kn=!0),li||V!==Y){We.reverseDepthBuffer?(_e.copy(Y.projectionMatrix),zhe(_e),Bhe(_e),Vn.setValue(Q,"projectionMatrix",_e)):Vn.setValue(Q,"projectionMatrix",Y.projectionMatrix),Vn.setValue(Q,"viewMatrix",Y.matrixWorldInverse);const Xr=Vn.map.cameraPosition;Xr!==void 0&&Xr.setValue(Q,$e.setFromMatrixPosition(Y.matrixWorld)),We.logarithmicDepthBuffer&&Vn.setValue(Q,"logDepthBufFC",2/(Math.log(Y.far+1)/Math.LN2)),(ke.isMeshPhongMaterial||ke.isMeshToonMaterial||ke.isMeshLambertMaterial||ke.isMeshBasicMaterial||ke.isMeshStandardMaterial||ke.isShaderMaterial)&&Vn.setValue(Q,"isOrthographic",Y.isOrthographicCamera===!0),V!==Y&&(V=Y,kn=!0,Is=!0)}if(we.isSkinnedMesh){Vn.setOptional(Q,we,"bindMatrix"),Vn.setOptional(Q,we,"bindMatrixInverse");const Xr=we.skeleton;Xr&&(Xr.boneTexture===null&&Xr.computeBoneTexture(),Vn.setValue(Q,"boneTexture",Xr.boneTexture,ee))}we.isBatchedMesh&&(Vn.setOptional(Q,we,"batchingTexture"),Vn.setValue(Q,"batchingTexture",we._matricesTexture,ee),Vn.setOptional(Q,we,"batchingIdTexture"),Vn.setValue(Q,"batchingIdTexture",we._indirectTexture,ee),Vn.setOptional(Q,we,"batchingColorTexture"),we._colorsTexture!==null&&Vn.setValue(Q,"batchingColorTexture",we._colorsTexture,ee));const Ya=Re.morphAttributes;if((Ya.position!==void 0||Ya.normal!==void 0||Ya.color!==void 0)&&Ut.update(we,Re,Pr),(kn||mt.receiveShadow!==we.receiveShadow)&&(mt.receiveShadow=we.receiveShadow,Vn.setValue(Q,"receiveShadow",we.receiveShadow)),ke.isMeshGouraudMaterial&&ke.envMap!==null&&(eo.envMap.value=Mt,eo.flipEnvMap.value=Mt.isCubeTexture&&Mt.isRenderTargetTexture===!1?-1:1),ke.isMeshStandardMaterial&&ke.envMap===null&&xe.environment!==null&&(eo.envMapIntensity.value=xe.environmentIntensity),kn&&(Vn.setValue(Q,"toneMappingExposure",T.toneMappingExposure),mt.needsLights&&du(eo,Is),et&&ke.fog===!0&&rt.refreshFogUniforms(eo,et),rt.refreshMaterialUniforms(eo,ke,ce,oe,_.state.transmissionRenderTarget[Y.id]),X_.upload(Q,cu(mt),eo,ee)),ke.isShaderMaterial&&ke.uniformsNeedUpdate===!0&&(X_.upload(Q,cu(mt),eo,ee),ke.uniformsNeedUpdate=!1),ke.isSpriteMaterial&&Vn.setValue(Q,"center",we.center),Vn.setValue(Q,"modelViewMatrix",we.modelViewMatrix),Vn.setValue(Q,"normalMatrix",we.normalMatrix),Vn.setValue(Q,"modelMatrix",we.matrixWorld),ke.isShaderMaterial||ke.isRawShaderMaterial){const Xr=ke.uniformsGroups;for(let ci=0,Ld=Xr.length;ci<Ld;ci++){const Za=Xr[ci];re.update(Za,Pr),re.bind(Za,Pr)}}return Pr}function du(Y,xe){Y.ambientLightColor.needsUpdate=xe,Y.lightProbe.needsUpdate=xe,Y.directionalLights.needsUpdate=xe,Y.directionalLightShadows.needsUpdate=xe,Y.pointLights.needsUpdate=xe,Y.pointLightShadows.needsUpdate=xe,Y.spotLights.needsUpdate=xe,Y.spotLightShadows.needsUpdate=xe,Y.rectAreaLights.needsUpdate=xe,Y.hemisphereLights.needsUpdate=xe}function Hl(Y){return Y.isMeshLambertMaterial||Y.isMeshToonMaterial||Y.isMeshPhongMaterial||Y.isMeshStandardMaterial||Y.isShadowMaterial||Y.isShaderMaterial&&Y.lights===!0}this.getActiveCubeFace=function(){return O},this.getActiveMipmapLevel=function(){return N},this.getRenderTarget=function(){return D},this.setRenderTargetTextures=function(Y,xe,Re){at.get(Y.texture).__webglTexture=xe,at.get(Y.depthTexture).__webglTexture=Re;const ke=at.get(Y);ke.__hasExternalTextures=!0,ke.__autoAllocateDepthBuffer=Re===void 0,ke.__autoAllocateDepthBuffer||Ue.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),ke.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(Y,xe){const Re=at.get(Y);Re.__webglFramebuffer=xe,Re.__useDefaultFramebuffer=xe===void 0},this.setRenderTarget=function(Y,xe=0,Re=0){D=Y,O=xe,N=Re;let ke=!0,we=null,et=!1,vt=!1;if(Y){const Mt=at.get(Y);if(Mt.__useDefaultFramebuffer!==void 0)Qe.bindFramebuffer(Q.FRAMEBUFFER,null),ke=!1;else if(Mt.__webglFramebuffer===void 0)ee.setupRenderTarget(Y);else if(Mt.__hasExternalTextures)ee.rebindTextures(Y,at.get(Y.texture).__webglTexture,at.get(Y.depthTexture).__webglTexture);else if(Y.depthBuffer){const Pt=Y.depthTexture;if(Mt.__boundDepthTexture!==Pt){if(Pt!==null&&at.has(Pt)&&(Y.width!==Pt.image.width||Y.height!==Pt.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");ee.setupDepthRenderbuffer(Y)}}const Ft=Y.texture;(Ft.isData3DTexture||Ft.isDataArrayTexture||Ft.isCompressedArrayTexture)&&(vt=!0);const Ht=at.get(Y).__webglFramebuffer;Y.isWebGLCubeRenderTarget?(Array.isArray(Ht[xe])?we=Ht[xe][Re]:we=Ht[xe],et=!0):Y.samples>0&&ee.useMultisampledRTT(Y)===!1?we=at.get(Y).__webglMultisampledFramebuffer:Array.isArray(Ht)?we=Ht[Re]:we=Ht,k.copy(Y.viewport),j.copy(Y.scissor),H=Y.scissorTest}else k.copy(q).multiplyScalar(ce).floor(),j.copy($).multiplyScalar(ce).floor(),H=Z;if(Qe.bindFramebuffer(Q.FRAMEBUFFER,we)&&ke&&Qe.drawBuffers(Y,we),Qe.viewport(k),Qe.scissor(j),Qe.setScissorTest(H),et){const Mt=at.get(Y.texture);Q.framebufferTexture2D(Q.FRAMEBUFFER,Q.COLOR_ATTACHMENT0,Q.TEXTURE_CUBE_MAP_POSITIVE_X+xe,Mt.__webglTexture,Re)}else if(vt){const Mt=at.get(Y.texture),Ft=xe||0;Q.framebufferTextureLayer(Q.FRAMEBUFFER,Q.COLOR_ATTACHMENT0,Mt.__webglTexture,Re||0,Ft)}F=-1},this.readRenderTargetPixels=function(Y,xe,Re,ke,we,et,vt){if(!(Y&&Y.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let st=at.get(Y).__webglFramebuffer;if(Y.isWebGLCubeRenderTarget&&vt!==void 0&&(st=st[vt]),st){Qe.bindFramebuffer(Q.FRAMEBUFFER,st);try{const Mt=Y.texture,Ft=Mt.format,Ht=Mt.type;if(!We.textureFormatReadable(Ft)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!We.textureTypeReadable(Ht)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}xe>=0&&xe<=Y.width-ke&&Re>=0&&Re<=Y.height-we&&Q.readPixels(xe,Re,ke,we,J.convert(Ft),J.convert(Ht),et)}finally{const Mt=D!==null?at.get(D).__webglFramebuffer:null;Qe.bindFramebuffer(Q.FRAMEBUFFER,Mt)}}},this.readRenderTargetPixelsAsync=async function(Y,xe,Re,ke,we,et,vt){if(!(Y&&Y.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let st=at.get(Y).__webglFramebuffer;if(Y.isWebGLCubeRenderTarget&&vt!==void 0&&(st=st[vt]),st){const Mt=Y.texture,Ft=Mt.format,Ht=Mt.type;if(!We.textureFormatReadable(Ft))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!We.textureTypeReadable(Ht))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(xe>=0&&xe<=Y.width-ke&&Re>=0&&Re<=Y.height-we){Qe.bindFramebuffer(Q.FRAMEBUFFER,st);const Pt=Q.createBuffer();Q.bindBuffer(Q.PIXEL_PACK_BUFFER,Pt),Q.bufferData(Q.PIXEL_PACK_BUFFER,et.byteLength,Q.STREAM_READ),Q.readPixels(xe,Re,ke,we,J.convert(Ft),J.convert(Ht),0);const Sn=D!==null?at.get(D).__webglFramebuffer:null;Qe.bindFramebuffer(Q.FRAMEBUFFER,Sn);const Mn=Q.fenceSync(Q.SYNC_GPU_COMMANDS_COMPLETE,0);return Q.flush(),await Fhe(Q,Mn,4),Q.bindBuffer(Q.PIXEL_PACK_BUFFER,Pt),Q.getBufferSubData(Q.PIXEL_PACK_BUFFER,0,et),Q.deleteBuffer(Pt),Q.deleteSync(Mn),et}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(Y,xe=null,Re=0){Y.isTexture!==!0&&($_("WebGLRenderer: copyFramebufferToTexture function signature has changed."),xe=arguments[0]||null,Y=arguments[1]);const ke=Math.pow(2,-Re),we=Math.floor(Y.image.width*ke),et=Math.floor(Y.image.height*ke),vt=xe!==null?xe.x:0,st=xe!==null?xe.y:0;ee.setTexture2D(Y,0),Q.copyTexSubImage2D(Q.TEXTURE_2D,Re,0,0,vt,st,we,et),Qe.unbindTexture()},this.copyTextureToTexture=function(Y,xe,Re=null,ke=null,we=0){Y.isTexture!==!0&&($_("WebGLRenderer: copyTextureToTexture function signature has changed."),ke=arguments[0]||null,Y=arguments[1],xe=arguments[2],we=arguments[3]||0,Re=null);let et,vt,st,Mt,Ft,Ht;Re!==null?(et=Re.max.x-Re.min.x,vt=Re.max.y-Re.min.y,st=Re.min.x,Mt=Re.min.y):(et=Y.image.width,vt=Y.image.height,st=0,Mt=0),ke!==null?(Ft=ke.x,Ht=ke.y):(Ft=0,Ht=0);const Pt=J.convert(xe.format),Sn=J.convert(xe.type);ee.setTexture2D(xe,0),Q.pixelStorei(Q.UNPACK_FLIP_Y_WEBGL,xe.flipY),Q.pixelStorei(Q.UNPACK_PREMULTIPLY_ALPHA_WEBGL,xe.premultiplyAlpha),Q.pixelStorei(Q.UNPACK_ALIGNMENT,xe.unpackAlignment);const Mn=Q.getParameter(Q.UNPACK_ROW_LENGTH),yn=Q.getParameter(Q.UNPACK_IMAGE_HEIGHT),Yt=Q.getParameter(Q.UNPACK_SKIP_PIXELS),Lt=Q.getParameter(Q.UNPACK_SKIP_ROWS),mt=Q.getParameter(Q.UNPACK_SKIP_IMAGES),xn=Y.isCompressedTexture?Y.mipmaps[we]:Y.image;Q.pixelStorei(Q.UNPACK_ROW_LENGTH,xn.width),Q.pixelStorei(Q.UNPACK_IMAGE_HEIGHT,xn.height),Q.pixelStorei(Q.UNPACK_SKIP_PIXELS,st),Q.pixelStorei(Q.UNPACK_SKIP_ROWS,Mt),Y.isDataTexture?Q.texSubImage2D(Q.TEXTURE_2D,we,Ft,Ht,et,vt,Pt,Sn,xn.data):Y.isCompressedTexture?Q.compressedTexSubImage2D(Q.TEXTURE_2D,we,Ft,Ht,xn.width,xn.height,Pt,xn.data):Q.texSubImage2D(Q.TEXTURE_2D,we,Ft,Ht,et,vt,Pt,Sn,xn),Q.pixelStorei(Q.UNPACK_ROW_LENGTH,Mn),Q.pixelStorei(Q.UNPACK_IMAGE_HEIGHT,yn),Q.pixelStorei(Q.UNPACK_SKIP_PIXELS,Yt),Q.pixelStorei(Q.UNPACK_SKIP_ROWS,Lt),Q.pixelStorei(Q.UNPACK_SKIP_IMAGES,mt),we===0&&xe.generateMipmaps&&Q.generateMipmap(Q.TEXTURE_2D),Qe.unbindTexture()},this.copyTextureToTexture3D=function(Y,xe,Re=null,ke=null,we=0){Y.isTexture!==!0&&($_("WebGLRenderer: copyTextureToTexture3D function signature has changed."),Re=arguments[0]||null,ke=arguments[1]||null,Y=arguments[2],xe=arguments[3],we=arguments[4]||0);let et,vt,st,Mt,Ft,Ht,Pt,Sn,Mn;const yn=Y.isCompressedTexture?Y.mipmaps[we]:Y.image;Re!==null?(et=Re.max.x-Re.min.x,vt=Re.max.y-Re.min.y,st=Re.max.z-Re.min.z,Mt=Re.min.x,Ft=Re.min.y,Ht=Re.min.z):(et=yn.width,vt=yn.height,st=yn.depth,Mt=0,Ft=0,Ht=0),ke!==null?(Pt=ke.x,Sn=ke.y,Mn=ke.z):(Pt=0,Sn=0,Mn=0);const Yt=J.convert(xe.format),Lt=J.convert(xe.type);let mt;if(xe.isData3DTexture)ee.setTexture3D(xe,0),mt=Q.TEXTURE_3D;else if(xe.isDataArrayTexture||xe.isCompressedArrayTexture)ee.setTexture2DArray(xe,0),mt=Q.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}Q.pixelStorei(Q.UNPACK_FLIP_Y_WEBGL,xe.flipY),Q.pixelStorei(Q.UNPACK_PREMULTIPLY_ALPHA_WEBGL,xe.premultiplyAlpha),Q.pixelStorei(Q.UNPACK_ALIGNMENT,xe.unpackAlignment);const xn=Q.getParameter(Q.UNPACK_ROW_LENGTH),en=Q.getParameter(Q.UNPACK_IMAGE_HEIGHT),Pr=Q.getParameter(Q.UNPACK_SKIP_PIXELS),li=Q.getParameter(Q.UNPACK_SKIP_ROWS),kn=Q.getParameter(Q.UNPACK_SKIP_IMAGES);Q.pixelStorei(Q.UNPACK_ROW_LENGTH,yn.width),Q.pixelStorei(Q.UNPACK_IMAGE_HEIGHT,yn.height),Q.pixelStorei(Q.UNPACK_SKIP_PIXELS,Mt),Q.pixelStorei(Q.UNPACK_SKIP_ROWS,Ft),Q.pixelStorei(Q.UNPACK_SKIP_IMAGES,Ht),Y.isDataTexture||Y.isData3DTexture?Q.texSubImage3D(mt,we,Pt,Sn,Mn,et,vt,st,Yt,Lt,yn.data):xe.isCompressedArrayTexture?Q.compressedTexSubImage3D(mt,we,Pt,Sn,Mn,et,vt,st,Yt,yn.data):Q.texSubImage3D(mt,we,Pt,Sn,Mn,et,vt,st,Yt,Lt,yn),Q.pixelStorei(Q.UNPACK_ROW_LENGTH,xn),Q.pixelStorei(Q.UNPACK_IMAGE_HEIGHT,en),Q.pixelStorei(Q.UNPACK_SKIP_PIXELS,Pr),Q.pixelStorei(Q.UNPACK_SKIP_ROWS,li),Q.pixelStorei(Q.UNPACK_SKIP_IMAGES,kn),we===0&&xe.generateMipmaps&&Q.generateMipmap(mt),Qe.unbindTexture()},this.initRenderTarget=function(Y){at.get(Y).__webglFramebuffer===void 0&&ee.setupRenderTarget(Y)},this.initTexture=function(Y){Y.isCubeTexture?ee.setTextureCube(Y,0):Y.isData3DTexture?ee.setTexture3D(Y,0):Y.isDataArrayTexture||Y.isCompressedArrayTexture?ee.setTexture2DArray(Y,0):ee.setTexture2D(Y,0),Qe.unbindTexture()},this.resetState=function(){O=0,N=0,D=null,Qe.reset(),Ae.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Ml}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorSpace=e===KS?"display-p3":"srgb",n.unpackColorSpace=In.workingColorSpace===lx?"display-p3":"srgb"}}class QS{constructor(e,n=25e-5){this.isFogExp2=!0,this.name="",this.color=new ot(e),this.density=n}clone(){return new QS(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class JS{constructor(e,n=1,r=1e3){this.isFog=!0,this.name="",this.color=new ot(e),this.near=n,this.far=r}clone(){return new JS(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class R2 extends mn{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new as,this.environmentIntensity=1,this.environmentRotation=new as,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,n){return super.copy(e,n),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const n=super.toJSON(e);return this.fog!==null&&(n.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(n.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(n.object.backgroundIntensity=this.backgroundIntensity),n.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(n.object.environmentIntensity=this.environmentIntensity),n.object.environmentRotation=this.environmentRotation.toArray(),n}}class tp{constructor(e,n){this.isInterleavedBuffer=!0,this.array=e,this.stride=n,this.count=e!==void 0?e.length/n:0,this.usage=Ry,this.updateRanges=[],this.version=0,this.uuid=So()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,n,r){e*=this.stride,r*=n.stride;for(let i=0,s=this.stride;i<s;i++)this.array[e+i]=n.array[r+i];return this}set(e,n=0){return this.array.set(e,n),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=So()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const n=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),r=new this.constructor(n,this.stride);return r.setUsage(this.usage),r}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=So()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const bs=new X;class Ul{constructor(e,n,r,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=n,this.offset=r,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let n=0,r=this.data.count;n<r;n++)bs.fromBufferAttribute(this,n),bs.applyMatrix4(e),this.setXYZ(n,bs.x,bs.y,bs.z);return this}applyNormalMatrix(e){for(let n=0,r=this.count;n<r;n++)bs.fromBufferAttribute(this,n),bs.applyNormalMatrix(e),this.setXYZ(n,bs.x,bs.y,bs.z);return this}transformDirection(e){for(let n=0,r=this.count;n<r;n++)bs.fromBufferAttribute(this,n),bs.transformDirection(e),this.setXYZ(n,bs.x,bs.y,bs.z);return this}getComponent(e,n){let r=this.array[e*this.data.stride+this.offset+n];return this.normalized&&(r=Ss(r,this.array)),r}setComponent(e,n,r){return this.normalized&&(r=cn(r,this.array)),this.data.array[e*this.data.stride+this.offset+n]=r,this}setX(e,n){return this.normalized&&(n=cn(n,this.array)),this.data.array[e*this.data.stride+this.offset]=n,this}setY(e,n){return this.normalized&&(n=cn(n,this.array)),this.data.array[e*this.data.stride+this.offset+1]=n,this}setZ(e,n){return this.normalized&&(n=cn(n,this.array)),this.data.array[e*this.data.stride+this.offset+2]=n,this}setW(e,n){return this.normalized&&(n=cn(n,this.array)),this.data.array[e*this.data.stride+this.offset+3]=n,this}getX(e){let n=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(n=Ss(n,this.array)),n}getY(e){let n=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(n=Ss(n,this.array)),n}getZ(e){let n=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(n=Ss(n,this.array)),n}getW(e){let n=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(n=Ss(n,this.array)),n}setXY(e,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(n=cn(n,this.array),r=cn(r,this.array)),this.data.array[e+0]=n,this.data.array[e+1]=r,this}setXYZ(e,n,r,i){return e=e*this.data.stride+this.offset,this.normalized&&(n=cn(n,this.array),r=cn(r,this.array),i=cn(i,this.array)),this.data.array[e+0]=n,this.data.array[e+1]=r,this.data.array[e+2]=i,this}setXYZW(e,n,r,i,s){return e=e*this.data.stride+this.offset,this.normalized&&(n=cn(n,this.array),r=cn(r,this.array),i=cn(i,this.array),s=cn(s,this.array)),this.data.array[e+0]=n,this.data.array[e+1]=r,this.data.array[e+2]=i,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const n=[];for(let r=0;r<this.count;r++){const i=r*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)n.push(this.data.array[i+s])}return new Qt(new this.array.constructor(n),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Ul(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const n=[];for(let r=0;r<this.count;r++){const i=r*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)n.push(this.data.array[i+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:n,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class N2 extends Gr{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new ot(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let Am;const y0=new X,Tm=new X,Cm=new X,Pm=new Ve,x0=new Ve,y6=new Ct,r_=new X,b0=new X,i_=new X,ED=new Ve,bA=new Ve,AD=new Ve;class x6 extends mn{constructor(e=new N2){if(super(),this.isSprite=!0,this.type="Sprite",Am===void 0){Am=new Zt;const n=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),r=new tp(n,5);Am.setIndex([0,1,2,0,2,3]),Am.setAttribute("position",new Ul(r,3,0,!1)),Am.setAttribute("uv",new Ul(r,2,3,!1))}this.geometry=Am,this.material=e,this.center=new Ve(.5,.5)}raycast(e,n){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Tm.setFromMatrixScale(this.matrixWorld),y6.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Cm.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Tm.multiplyScalar(-Cm.z);const r=this.material.rotation;let i,s;r!==0&&(s=Math.cos(r),i=Math.sin(r));const o=this.center;s_(r_.set(-.5,-.5,0),Cm,o,Tm,i,s),s_(b0.set(.5,-.5,0),Cm,o,Tm,i,s),s_(i_.set(.5,.5,0),Cm,o,Tm,i,s),ED.set(0,0),bA.set(1,0),AD.set(1,1);let a=e.ray.intersectTriangle(r_,b0,i_,!1,y0);if(a===null&&(s_(b0.set(-.5,.5,0),Cm,o,Tm,i,s),bA.set(0,1),a=e.ray.intersectTriangle(r_,i_,b0,!1,y0),a===null))return;const l=e.ray.origin.distanceTo(y0);l<e.near||l>e.far||n.push({distance:l,point:y0.clone(),uv:qs.getInterpolation(y0,r_,b0,i_,ED,bA,AD,new Ve),face:null,object:this})}copy(e,n){return super.copy(e,n),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function s_(t,e,n,r,i,s){Pm.subVectors(t,n).addScalar(.5).multiply(r),i!==void 0?(x0.x=s*Pm.x-i*Pm.y,x0.y=i*Pm.x+s*Pm.y):x0.copy(Pm),t.copy(e),t.x+=x0.x,t.y+=x0.y,t.applyMatrix4(y6)}const o_=new X,TD=new X;class b6 extends mn{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const n=e.levels;for(let r=0,i=n.length;r<i;r++){const s=n[r];this.addLevel(s.object.clone(),s.distance,s.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,n=0,r=0){n=Math.abs(n);const i=this.levels;let s;for(s=0;s<i.length&&!(n<i[s].distance);s++);return i.splice(s,0,{distance:n,hysteresis:r,object:e}),this.add(e),this}removeLevel(e){const n=this.levels;for(let r=0;r<n.length;r++)if(n[r].distance===e){const i=n.splice(r,1);return this.remove(i[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const n=this.levels;if(n.length>0){let r,i;for(r=1,i=n.length;r<i;r++){let s=n[r].distance;if(n[r].object.visible&&(s-=s*n[r].hysteresis),e<s)break}return n[r-1].object}return null}raycast(e,n){if(this.levels.length>0){o_.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(o_);this.getObjectForDistance(i).raycast(e,n)}}update(e){const n=this.levels;if(n.length>1){o_.setFromMatrixPosition(e.matrixWorld),TD.setFromMatrixPosition(this.matrixWorld);const r=o_.distanceTo(TD)/e.zoom;n[0].object.visible=!0;let i,s;for(i=1,s=n.length;i<s;i++){let o=n[i].distance;if(n[i].object.visible&&(o-=o*n[i].hysteresis),r>=o)n[i-1].object.visible=!1,n[i].object.visible=!0;else break}for(this._currentLevel=i-1;i<s;i++)n[i].object.visible=!1}}toJSON(e){const n=super.toJSON(e);this.autoUpdate===!1&&(n.object.autoUpdate=!1),n.object.levels=[];const r=this.levels;for(let i=0,s=r.length;i<s;i++){const o=r[i];n.object.levels.push({object:o.object.uuid,distance:o.distance,hysteresis:o.hysteresis})}return n}}const CD=new X,PD=new Ln,RD=new Ln,tye=new X,ND=new Ct,a_=new X,_A=new Bi,ID=new Ct,wA=new Jh;class eM extends yr{constructor(e,n){super(e,n),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=HC,this.bindMatrix=new Ct,this.bindMatrixInverse=new Ct,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new os),this.boundingBox.makeEmpty();const n=e.getAttribute("position");for(let r=0;r<n.count;r++)this.getVertexPosition(r,a_),this.boundingBox.expandByPoint(a_)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Bi),this.boundingSphere.makeEmpty();const n=e.getAttribute("position");for(let r=0;r<n.count;r++)this.getVertexPosition(r,a_),this.boundingSphere.expandByPoint(a_)}copy(e,n){return super.copy(e,n),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,n){const r=this.material,i=this.matrixWorld;r!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),_A.copy(this.boundingSphere),_A.applyMatrix4(i),e.ray.intersectsSphere(_A)!==!1&&(ID.copy(i).invert(),wA.copy(e.ray).applyMatrix4(ID),!(this.boundingBox!==null&&wA.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,n,wA)))}getVertexPosition(e,n){return super.getVertexPosition(e,n),this.applyBoneTransform(e,n),n}bind(e,n){this.skeleton=e,n===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),n=this.matrixWorld),this.bindMatrix.copy(n),this.bindMatrixInverse.copy(n).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new Ln,n=this.geometry.attributes.skinWeight;for(let r=0,i=n.count;r<i;r++){e.fromBufferAttribute(n,r);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),n.setXYZW(r,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===HC?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===zV?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,n){const r=this.skeleton,i=this.geometry;PD.fromBufferAttribute(i.attributes.skinIndex,e),RD.fromBufferAttribute(i.attributes.skinWeight,e),CD.copy(n).applyMatrix4(this.bindMatrix),n.set(0,0,0);for(let s=0;s<4;s++){const o=RD.getComponent(s);if(o!==0){const a=PD.getComponent(s);ND.multiplyMatrices(r.bones[a].matrixWorld,r.boneInverses[a]),n.addScaledVector(tye.copy(CD).applyMatrix4(ND),o)}}return n.applyMatrix4(this.bindMatrixInverse)}}class tM extends mn{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Pl extends dr{constructor(e=null,n=1,r=1,i,s,o,a,l,c=ri,d=ri,f,m){super(null,o,a,l,c,d,i,s,f,m),this.isDataTexture=!0,this.image={data:e,width:n,height:r},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const kD=new Ct,nye=new Ct;class Id{constructor(e=[],n=[]){this.uuid=So(),this.bones=e.slice(0),this.boneInverses=n,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,n=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),n.length===0)this.calculateInverses();else if(e.length!==n.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let r=0,i=this.bones.length;r<i;r++)this.boneInverses.push(new Ct)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,n=this.bones.length;e<n;e++){const r=new Ct;this.bones[e]&&r.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(r)}}pose(){for(let e=0,n=this.bones.length;e<n;e++){const r=this.bones[e];r&&r.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,n=this.bones.length;e<n;e++){const r=this.bones[e];r&&(r.parent&&r.parent.isBone?(r.matrix.copy(r.parent.matrixWorld).invert(),r.matrix.multiply(r.matrixWorld)):r.matrix.copy(r.matrixWorld),r.matrix.decompose(r.position,r.quaternion,r.scale))}}update(){const e=this.bones,n=this.boneInverses,r=this.boneMatrices,i=this.boneTexture;for(let s=0,o=e.length;s<o;s++){const a=e[s]?e[s].matrixWorld:nye;kD.multiplyMatrices(a,n[s]),kD.toArray(r,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new Id(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const n=new Float32Array(e*e*4);n.set(this.boneMatrices);const r=new Pl(n,e,e,is,Zs);return r.needsUpdate=!0,this.boneMatrices=n,this.boneTexture=r,this}getBoneByName(e){for(let n=0,r=this.bones.length;n<r;n++){const i=this.bones[n];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,n){this.uuid=e.uuid;for(let r=0,i=e.bones.length;r<i;r++){const s=e.bones[r];let o=n[s];o===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),o=new tM),this.bones.push(o),this.boneInverses.push(new Ct().fromArray(e.boneInverses[r]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const n=this.bones,r=this.boneInverses;for(let i=0,s=n.length;i<s;i++){const o=n[i];e.bones.push(o.uuid);const a=r[i];e.boneInverses.push(a.toArray())}return e}}class zh extends Qt{constructor(e,n,r,i=1){super(e,n,r),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const Rm=new Ct,OD=new Ct,l_=[],LD=new os,rye=new Ct,_0=new yr,w0=new Bi;class I2 extends yr{constructor(e,n,r){super(e,n),this.isInstancedMesh=!0,this.instanceMatrix=new zh(new Float32Array(r*16),16),this.instanceColor=null,this.morphTexture=null,this.count=r,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<r;i++)this.setMatrixAt(i,rye)}computeBoundingBox(){const e=this.geometry,n=this.count;this.boundingBox===null&&(this.boundingBox=new os),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let r=0;r<n;r++)this.getMatrixAt(r,Rm),LD.copy(e.boundingBox).applyMatrix4(Rm),this.boundingBox.union(LD)}computeBoundingSphere(){const e=this.geometry,n=this.count;this.boundingSphere===null&&(this.boundingSphere=new Bi),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let r=0;r<n;r++)this.getMatrixAt(r,Rm),w0.copy(e.boundingSphere).applyMatrix4(Rm),this.boundingSphere.union(w0)}copy(e,n){return super.copy(e,n),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,n){n.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,n){n.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,n){const r=n.morphTargetInfluences,i=this.morphTexture.source.data.data,s=r.length+1,o=e*s+1;for(let a=0;a<r.length;a++)r[a]=i[o+a]}raycast(e,n){const r=this.matrixWorld,i=this.count;if(_0.geometry=this.geometry,_0.material=this.material,_0.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),w0.copy(this.boundingSphere),w0.applyMatrix4(r),e.ray.intersectsSphere(w0)!==!1))for(let s=0;s<i;s++){this.getMatrixAt(s,Rm),OD.multiplyMatrices(r,Rm),_0.matrixWorld=OD,_0.raycast(e,l_);for(let o=0,a=l_.length;o<a;o++){const l=l_[o];l.instanceId=s,l.object=this,n.push(l)}l_.length=0}}setColorAt(e,n){this.instanceColor===null&&(this.instanceColor=new zh(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),n.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,n){n.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,n){const r=n.morphTargetInfluences,i=r.length+1;this.morphTexture===null&&(this.morphTexture=new Pl(new Float32Array(i*this.count),i,this.count,WS,Zs));const s=this.morphTexture.source.data.data;let o=0;for(let c=0;c<r.length;c++)o+=r[c];const a=this.geometry.morphTargetsRelative?1:1-o,l=i*e;s[l]=a,s.set(r,l+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null),this}}function iye(t,e){return t.z-e.z}function sye(t,e){return e.z-t.z}class oye{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,n,r){const i=this.pool,s=this.list;this.index>=i.length&&i.push({start:-1,count:-1,z:-1,index:-1});const o=i[this.index];s.push(o),this.index++,o.start=e.start,o.count=e.count,o.z=n,o.index=r}reset(){this.list.length=0,this.index=0}}const Ju=new Ct,SA=new Ct,aye=new Ct,lye=new ot(1,1,1),DD=new Ct,MA=new dx,c_=new os,kf=new Bi,S0=new X,UD=new X,cye=new X,EA=new oye,es=new yr,u_=[];function uye(t,e,n=0){const r=e.itemSize;if(t.isInterleavedBufferAttribute||t.array.constructor!==e.array.constructor){const i=t.count;for(let s=0;s<i;s++)for(let o=0;o<r;o++)e.setComponent(s+n,o,t.getComponent(s,o))}else e.array.set(t.array,n*r);e.needsUpdate=!0}class _6 extends yr{get maxInstanceCount(){return this._maxInstanceCount}constructor(e,n,r=n*2,i){super(new Zt,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._drawInfo=[],this._availableInstanceIds=[],this._drawRanges=[],this._reservedRanges=[],this._bounds=[],this._maxInstanceCount=e,this._maxVertexCount=n,this._maxIndexCount=r,this._geometryInitialized=!1,this._geometryCount=0,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawInstances=null,this._visibilityChanged=!0,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}_initMatricesTexture(){let e=Math.sqrt(this._maxInstanceCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const n=new Float32Array(e*e*4),r=new Pl(n,e,e,is,Zs);this._matricesTexture=r}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const n=new Uint32Array(e*e),r=new Pl(n,e,e,ax,eu);this._indirectTexture=r}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const n=new Float32Array(e*e*4).fill(1),r=new Pl(n,e,e,is,Zs);r.colorSpace=In.workingColorSpace,this._colorsTexture=r}_initializeGeometry(e){const n=this.geometry,r=this._maxVertexCount,i=this._maxIndexCount;if(this._geometryInitialized===!1){for(const s in e.attributes){const o=e.getAttribute(s),{array:a,itemSize:l,normalized:c}=o,d=new a.constructor(r*l),f=new Qt(d,l,c);n.setAttribute(s,f)}if(e.getIndex()!==null){const s=r>65535?new Uint32Array(i):new Uint16Array(i);n.setIndex(new Qt(s,1))}this._geometryInitialized=!0}}_validateGeometry(e){const n=this.geometry;if(!!e.getIndex()!=!!n.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const r in n.attributes){if(!e.hasAttribute(r))throw new Error(`BatchedMesh: Added geometry missing "${r}". All geometries must have consistent attributes.`);const i=e.getAttribute(r),s=n.getAttribute(r);if(i.itemSize!==s.itemSize||i.normalized!==s.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new os);const e=this.boundingBox,n=this._drawInfo;e.makeEmpty();for(let r=0,i=n.length;r<i;r++){if(n[r].active===!1)continue;const s=n[r].geometryIndex;this.getMatrixAt(r,Ju),this.getBoundingBoxAt(s,c_).applyMatrix4(Ju),e.union(c_)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Bi);const e=this.boundingSphere,n=this._drawInfo;e.makeEmpty();for(let r=0,i=n.length;r<i;r++){if(n[r].active===!1)continue;const s=n[r].geometryIndex;this.getMatrixAt(r,Ju),this.getBoundingSphereAt(s,kf).applyMatrix4(Ju),e.union(kf)}}addInstance(e){if(this._drawInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("BatchedMesh: Maximum item count reached.");const r={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(i=this._availableInstanceIds.pop(),this._drawInfo[i]=r):(i=this._drawInfo.length,this._drawInfo.push(r));const s=this._matricesTexture,o=s.image.data;aye.toArray(o,i*16),s.needsUpdate=!0;const a=this._colorsTexture;return a&&(lye.toArray(a.image.data,i*4),a.needsUpdate=!0),i}addGeometry(e,n=-1,r=-1){if(this._initializeGeometry(e),this._validateGeometry(e),this._drawInfo.length>=this._maxInstanceCount)throw new Error("BatchedMesh: Maximum item count reached.");const i={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let s=null;const o=this._reservedRanges,a=this._drawRanges,l=this._bounds;this._geometryCount!==0&&(s=o[o.length-1]),n===-1?i.vertexCount=e.getAttribute("position").count:i.vertexCount=n,s===null?i.vertexStart=0:i.vertexStart=s.vertexStart+s.vertexCount;const c=e.getIndex(),d=c!==null;if(d&&(r===-1?i.indexCount=c.count:i.indexCount=r,s===null?i.indexStart=0:i.indexStart=s.indexStart+s.indexCount),i.indexStart!==-1&&i.indexStart+i.indexCount>this._maxIndexCount||i.vertexStart+i.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const f=this._geometryCount;return this._geometryCount++,o.push(i),a.push({start:d?i.indexStart:i.vertexStart,count:-1}),l.push({boxInitialized:!1,box:new os,sphereInitialized:!1,sphere:new Bi}),this.setGeometryAt(f,e),f}setGeometryAt(e,n){if(e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(n);const r=this.geometry,i=r.getIndex()!==null,s=r.getIndex(),o=n.getIndex(),a=this._reservedRanges[e];if(i&&o.count>a.indexCount||n.attributes.position.count>a.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const l=a.vertexStart,c=a.vertexCount;for(const y in r.attributes){const x=n.getAttribute(y),S=r.getAttribute(y);uye(x,S,l);const _=x.itemSize;for(let w=x.count,A=c;w<A;w++){const T=l+w;for(let C=0;C<_;C++)S.setComponent(T,C,0)}S.needsUpdate=!0,S.addUpdateRange(l*_,c*_)}if(i){const y=a.indexStart;for(let x=0;x<o.count;x++)s.setX(y+x,l+o.getX(x));for(let x=o.count,S=a.indexCount;x<S;x++)s.setX(y+x,l);s.needsUpdate=!0,s.addUpdateRange(y,a.indexCount)}const d=this._bounds[e];n.boundingBox!==null?(d.box.copy(n.boundingBox),d.boxInitialized=!0):d.boxInitialized=!1,n.boundingSphere!==null?(d.sphere.copy(n.boundingSphere),d.sphereInitialized=!0):d.sphereInitialized=!1;const f=this._drawRanges[e],m=n.getAttribute("position");return f.count=i?o.count:m.count,this._visibilityChanged=!0,e}deleteInstance(e){const n=this._drawInfo;return e>=n.length||n[e].active===!1?this:(n[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this)}getBoundingBoxAt(e,n){if(e>=this._geometryCount)return null;const r=this._bounds[e],i=r.box,s=this.geometry;if(r.boxInitialized===!1){i.makeEmpty();const o=s.index,a=s.attributes.position,l=this._drawRanges[e];for(let c=l.start,d=l.start+l.count;c<d;c++){let f=c;o&&(f=o.getX(f)),i.expandByPoint(S0.fromBufferAttribute(a,f))}r.boxInitialized=!0}return n.copy(i),n}getBoundingSphereAt(e,n){if(e>=this._geometryCount)return null;const r=this._bounds[e],i=r.sphere,s=this.geometry;if(r.sphereInitialized===!1){i.makeEmpty(),this.getBoundingBoxAt(e,c_),c_.getCenter(i.center);const o=s.index,a=s.attributes.position,l=this._drawRanges[e];let c=0;for(let d=l.start,f=l.start+l.count;d<f;d++){let m=d;o&&(m=o.getX(m)),S0.fromBufferAttribute(a,m),c=Math.max(c,i.center.distanceToSquared(S0))}i.radius=Math.sqrt(c),r.sphereInitialized=!0}return n.copy(i),n}setMatrixAt(e,n){const r=this._drawInfo,i=this._matricesTexture,s=this._matricesTexture.image.data;return e>=r.length||r[e].active===!1?this:(n.toArray(s,e*16),i.needsUpdate=!0,this)}getMatrixAt(e,n){const r=this._drawInfo,i=this._matricesTexture.image.data;return e>=r.length||r[e].active===!1?null:n.fromArray(i,e*16)}setColorAt(e,n){this._colorsTexture===null&&this._initColorsTexture();const r=this._colorsTexture,i=this._colorsTexture.image.data,s=this._drawInfo;return e>=s.length||s[e].active===!1?this:(n.toArray(i,e*4),r.needsUpdate=!0,this)}getColorAt(e,n){const r=this._colorsTexture.image.data,i=this._drawInfo;return e>=i.length||i[e].active===!1?null:n.fromArray(r,e*4)}setVisibleAt(e,n){const r=this._drawInfo;return e>=r.length||r[e].active===!1||r[e].visible===n?this:(r[e].visible=n,this._visibilityChanged=!0,this)}getVisibleAt(e){const n=this._drawInfo;return e>=n.length||n[e].active===!1?!1:n[e].visible}setGeometryIdAt(e,n){const r=this._drawInfo;return e>=r.length||r[e].active===!1||n<0||n>=this._geometryCount?null:(r[e].geometryIndex=n,this)}getGeometryIdAt(e){const n=this._drawInfo;return e>=n.length||n[e].active===!1?-1:n[e].geometryIndex}getGeometryRangeAt(e,n={}){if(e<0||e>=this._geometryCount)return null;const r=this._drawRanges[e];return n.start=r.start,n.count=r.count,n}raycast(e,n){const r=this._drawInfo,i=this._drawRanges,s=this.matrixWorld,o=this.geometry;es.material=this.material,es.geometry.index=o.index,es.geometry.attributes=o.attributes,es.geometry.boundingBox===null&&(es.geometry.boundingBox=new os),es.geometry.boundingSphere===null&&(es.geometry.boundingSphere=new Bi);for(let a=0,l=r.length;a<l;a++){if(!r[a].visible||!r[a].active)continue;const c=r[a].geometryIndex,d=i[c];es.geometry.setDrawRange(d.start,d.count),this.getMatrixAt(a,es.matrixWorld).premultiply(s),this.getBoundingBoxAt(c,es.geometry.boundingBox),this.getBoundingSphereAt(c,es.geometry.boundingSphere),es.raycast(e,u_);for(let f=0,m=u_.length;f<m;f++){const y=u_[f];y.object=this,y.batchId=a,n.push(y)}u_.length=0}es.material=null,es.geometry.index=null,es.geometry.attributes={},es.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._drawRanges=e._drawRanges.map(n=>({...n})),this._reservedRanges=e._reservedRanges.map(n=>({...n})),this._drawInfo=e._drawInfo.map(n=>({...n})),this._bounds=e._bounds.map(n=>({boxInitialized:n.boxInitialized,box:n.box.clone(),sphereInitialized:n.sphereInitialized,sphere:n.sphere.clone()})),this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null),this}onBeforeRender(e,n,r,i,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=i.getIndex(),a=o===null?1:o.array.BYTES_PER_ELEMENT,l=this._drawInfo,c=this._multiDrawStarts,d=this._multiDrawCounts,f=this._drawRanges,m=this.perObjectFrustumCulled,y=this._indirectTexture,x=y.image.data;m&&(DD.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse).multiply(this.matrixWorld),MA.setFromProjectionMatrix(DD,e.coordinateSystem));let S=0;if(this.sortObjects){SA.copy(this.matrixWorld).invert(),S0.setFromMatrixPosition(r.matrixWorld).applyMatrix4(SA),UD.set(0,0,-1).transformDirection(r.matrixWorld).transformDirection(SA);for(let A=0,T=l.length;A<T;A++)if(l[A].visible&&l[A].active){const C=l[A].geometryIndex;this.getMatrixAt(A,Ju),this.getBoundingSphereAt(C,kf).applyMatrix4(Ju);let O=!1;if(m&&(O=!MA.intersectsSphere(kf)),!O){const N=cye.subVectors(kf.center,S0).dot(UD);EA.push(f[C],N,A)}}const _=EA.list,w=this.customSort;w===null?_.sort(s.transparent?sye:iye):w.call(this,_,r);for(let A=0,T=_.length;A<T;A++){const C=_[A];c[S]=C.start*a,d[S]=C.count,x[S]=C.index,S++}EA.reset()}else for(let _=0,w=l.length;_<w;_++)if(l[_].visible&&l[_].active){const A=l[_].geometryIndex;let T=!1;if(m&&(this.getMatrixAt(_,Ju),this.getBoundingSphereAt(A,kf).applyMatrix4(Ju),T=!MA.intersectsSphere(kf)),!T){const C=f[A];c[S]=C.start*a,d[S]=C.count,x[S]=_,S++}}y.needsUpdate=!0,this._multiDrawCount=S,this._visibilityChanged=!1}onBeforeShadow(e,n,r,i,s,o){this.onBeforeRender(e,null,i,s,o)}}class $r extends Gr{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new ot(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const I1=new X,k1=new X,jD=new Ct,M0=new Jh,d_=new Bi,AA=new X,FD=new X;class jl extends mn{constructor(e=new Zt,n=new $r){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=n,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,r=[0];for(let i=1,s=n.count;i<s;i++)I1.fromBufferAttribute(n,i-1),k1.fromBufferAttribute(n,i),r[i]=r[i-1],r[i]+=I1.distanceTo(k1);e.setAttribute("lineDistance",new kt(r,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,n){const r=this.geometry,i=this.matrixWorld,s=e.params.Line.threshold,o=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),d_.copy(r.boundingSphere),d_.applyMatrix4(i),d_.radius+=s,e.ray.intersectsSphere(d_)===!1)return;jD.copy(i).invert(),M0.copy(e.ray).applyMatrix4(jD);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=this.isLineSegments?2:1,d=r.index,m=r.attributes.position;if(d!==null){const y=Math.max(0,o.start),x=Math.min(d.count,o.start+o.count);for(let S=y,_=x-1;S<_;S+=c){const w=d.getX(S),A=d.getX(S+1),T=f_(this,e,M0,l,w,A);T&&n.push(T)}if(this.isLineLoop){const S=d.getX(x-1),_=d.getX(y),w=f_(this,e,M0,l,S,_);w&&n.push(w)}}else{const y=Math.max(0,o.start),x=Math.min(m.count,o.start+o.count);for(let S=y,_=x-1;S<_;S+=c){const w=f_(this,e,M0,l,S,S+1);w&&n.push(w)}if(this.isLineLoop){const S=f_(this,e,M0,l,x-1,y);S&&n.push(S)}}}updateMorphTargets(){const n=this.geometry.morphAttributes,r=Object.keys(n);if(r.length>0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function f_(t,e,n,r,i,s){const o=t.geometry.attributes.position;if(I1.fromBufferAttribute(o,i),k1.fromBufferAttribute(o,s),n.distanceSqToSegment(I1,k1,AA,FD)>r)return;AA.applyMatrix4(t.matrixWorld);const l=e.ray.origin.distanceTo(AA);if(!(l<e.near||l>e.far))return{distance:l,point:FD.clone().applyMatrix4(t.matrixWorld),index:i,face:null,faceIndex:null,barycoord:null,object:t}}const zD=new X,BD=new X;class Js extends jl{constructor(e,n){super(e,n),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,r=[];for(let i=0,s=n.count;i<s;i+=2)zD.fromBufferAttribute(n,i),BD.fromBufferAttribute(n,i+1),r[i]=i===0?0:r[i-1],r[i+1]=r[i]+zD.distanceTo(BD);e.setAttribute("lineDistance",new kt(r,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class k2 extends jl{constructor(e,n){super(e,n),this.isLineLoop=!0,this.type="LineLoop"}}class nM extends Gr{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new ot(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const HD=new Ct,qC=new Jh,h_=new Bi,p_=new X;class O2 extends mn{constructor(e=new Zt,n=new nM){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=n,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,n){const r=this.geometry,i=this.matrixWorld,s=e.params.Points.threshold,o=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),h_.copy(r.boundingSphere),h_.applyMatrix4(i),h_.radius+=s,e.ray.intersectsSphere(h_)===!1)return;HD.copy(i).invert(),qC.copy(e.ray).applyMatrix4(HD);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=r.index,f=r.attributes.position;if(c!==null){const m=Math.max(0,o.start),y=Math.min(c.count,o.start+o.count);for(let x=m,S=y;x<S;x++){const _=c.getX(x);p_.fromBufferAttribute(f,_),VD(p_,_,l,i,e,n,this)}}else{const m=Math.max(0,o.start),y=Math.min(f.count,o.start+o.count);for(let x=m,S=y;x<S;x++)p_.fromBufferAttribute(f,x),VD(p_,x,l,i,e,n,this)}}updateMorphTargets(){const n=this.geometry.morphAttributes,r=Object.keys(n);if(r.length>0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function VD(t,e,n,r,i,s,o){const a=qC.distanceSqToPoint(t);if(a<n){const l=new X;qC.closestPointToPoint(t,l),l.applyMatrix4(r);const c=i.ray.origin.distanceTo(l);if(c<i.near||c>i.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class dye extends dr{constructor(e,n,r,i,s,o,a,l,c){super(e,n,r,i,s,o,a,l,c),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:Cr,this.magFilter=s!==void 0?s:Cr,this.generateMipmaps=!1;const d=this;function f(){d.needsUpdate=!0,e.requestVideoFrameCallback(f)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(f)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class fye extends dr{constructor(e,n){super({width:e,height:n}),this.isFramebufferTexture=!0,this.magFilter=ri,this.minFilter=ri,this.generateMipmaps=!1,this.needsUpdate=!0}}class rM extends dr{constructor(e,n,r,i,s,o,a,l,c,d,f,m){super(null,o,a,l,c,d,i,s,f,m),this.isCompressedTexture=!0,this.image={width:n,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class hye extends rM{constructor(e,n,r,i,s,o){super(e,n,r,s,o),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=_o,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class pye extends rM{constructor(e,n,r){super(void 0,e[0].width,e[0].height,n,r,Jc),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class mye extends dr{constructor(e,n,r,i,s,o,a,l,c){super(e,n,r,i,s,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Xa{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,n){const r=this.getUtoTmapping(e);return this.getPoint(r,n)}getPoints(e=5){const n=[];for(let r=0;r<=e;r++)n.push(this.getPoint(r/e));return n}getSpacedPoints(e=5){const n=[];for(let r=0;r<=e;r++)n.push(this.getPointAt(r/e));return n}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const n=[];let r,i=this.getPoint(0),s=0;n.push(0);for(let o=1;o<=e;o++)r=this.getPoint(o/e),s+=r.distanceTo(i),n.push(s),i=r;return this.cacheArcLengths=n,n}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,n){const r=this.getLengths();let i=0;const s=r.length;let o;n?o=n:o=e*r[s-1];let a=0,l=s-1,c;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),c=r[i]-o,c<0)a=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,r[i]===o)return i/(s-1);const d=r[i],m=r[i+1]-d,y=(o-d)/m;return(i+y)/(s-1)}getTangent(e,n){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const o=this.getPoint(i),a=this.getPoint(s),l=n||(o.isVector2?new Ve:new X);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,n){const r=this.getUtoTmapping(e);return this.getTangent(r,n)}computeFrenetFrames(e,n){const r=new X,i=[],s=[],o=[],a=new X,l=new Ct;for(let y=0;y<=e;y++){const x=y/e;i[y]=this.getTangentAt(x,new X)}s[0]=new X,o[0]=new X;let c=Number.MAX_VALUE;const d=Math.abs(i[0].x),f=Math.abs(i[0].y),m=Math.abs(i[0].z);d<=c&&(c=d,r.set(1,0,0)),f<=c&&(c=f,r.set(0,1,0)),m<=c&&r.set(0,0,1),a.crossVectors(i[0],r).normalize(),s[0].crossVectors(i[0],a),o[0].crossVectors(i[0],s[0]);for(let y=1;y<=e;y++){if(s[y]=s[y-1].clone(),o[y]=o[y-1].clone(),a.crossVectors(i[y-1],i[y]),a.length()>Number.EPSILON){a.normalize();const x=Math.acos(Ar(i[y-1].dot(i[y]),-1,1));s[y].applyMatrix4(l.makeRotationAxis(a,x))}o[y].crossVectors(i[y],s[y])}if(n===!0){let y=Math.acos(Ar(s[0].dot(s[e]),-1,1));y/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(y=-y);for(let x=1;x<=e;x++)s[x].applyMatrix4(l.makeRotationAxis(i[x],y*x)),o[x].crossVectors(i[x],s[x])}return{tangents:i,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class iM extends Xa{constructor(e=0,n=0,r=1,i=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=n,this.xRadius=r,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,n=new Ve){const r=n,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(o?s=0:s=i),this.aClockwise===!0&&!o&&(s===i?s=-i:s=s-i);const a=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){const d=Math.cos(this.aRotation),f=Math.sin(this.aRotation),m=l-this.aX,y=c-this.aY;l=m*d-y*f+this.aX,c=m*f+y*d+this.aY}return r.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class w6 extends iM{constructor(e,n,r,i,s,o){super(e,n,r,r,i,s,o),this.isArcCurve=!0,this.type="ArcCurve"}}function L2(){let t=0,e=0,n=0,r=0;function i(s,o,a,l){t=s,e=a,n=-3*s+3*o-2*a-l,r=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){i(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,d,f){let m=(o-s)/c-(a-s)/(c+d)+(a-o)/d,y=(a-o)/d-(l-o)/(d+f)+(l-a)/f;m*=d,y*=d,i(o,a,m,y)},calc:function(s){const o=s*s,a=o*s;return t+e*s+n*o+r*a}}}const m_=new X,TA=new L2,CA=new L2,PA=new L2;class S6 extends Xa{constructor(e=[],n=!1,r="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=n,this.curveType=r,this.tension=i}getPoint(e,n=new X){const r=n,i=this.points,s=i.length,o=(s-(this.closed?0:1))*e;let a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,d;this.closed||a>0?c=i[(a-1)%s]:(m_.subVectors(i[0],i[1]).add(i[0]),c=m_);const f=i[a%s],m=i[(a+1)%s];if(this.closed||a+2<s?d=i[(a+2)%s]:(m_.subVectors(i[s-1],i[s-2]).add(i[s-1]),d=m_),this.curveType==="centripetal"||this.curveType==="chordal"){const y=this.curveType==="chordal"?.5:.25;let x=Math.pow(c.distanceToSquared(f),y),S=Math.pow(f.distanceToSquared(m),y),_=Math.pow(m.distanceToSquared(d),y);S<1e-4&&(S=1),x<1e-4&&(x=S),_<1e-4&&(_=S),TA.initNonuniformCatmullRom(c.x,f.x,m.x,d.x,x,S,_),CA.initNonuniformCatmullRom(c.y,f.y,m.y,d.y,x,S,_),PA.initNonuniformCatmullRom(c.z,f.z,m.z,d.z,x,S,_)}else this.curveType==="catmullrom"&&(TA.initCatmullRom(c.x,f.x,m.x,d.x,this.tension),CA.initCatmullRom(c.y,f.y,m.y,d.y,this.tension),PA.initCatmullRom(c.z,f.z,m.z,d.z,this.tension));return r.set(TA.calc(l),CA.calc(l),PA.calc(l)),r}copy(e){super.copy(e),this.points=[];for(let n=0,r=e.points.length;n<r;n++){const i=e.points[n];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let n=0,r=this.points.length;n<r;n++){const i=this.points[n];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let n=0,r=e.points.length;n<r;n++){const i=e.points[n];this.points.push(new X().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function GD(t,e,n,r,i){const s=(r-e)*.5,o=(i-n)*.5,a=t*t,l=t*a;return(2*n-2*r+s+o)*l+(-3*n+3*r-2*s-o)*a+s*t+n}function gye(t,e){const n=1-t;return n*n*e}function vye(t,e){return 2*(1-t)*t*e}function yye(t,e){return t*t*e}function Q0(t,e,n,r){return gye(t,e)+vye(t,n)+yye(t,r)}function xye(t,e){const n=1-t;return n*n*n*e}function bye(t,e){const n=1-t;return 3*n*n*t*e}function _ye(t,e){return 3*(1-t)*t*t*e}function wye(t,e){return t*t*t*e}function J0(t,e,n,r,i){return xye(t,e)+bye(t,n)+_ye(t,r)+wye(t,i)}class D2 extends Xa{constructor(e=new Ve,n=new Ve,r=new Ve,i=new Ve){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=n,this.v2=r,this.v3=i}getPoint(e,n=new Ve){const r=n,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return r.set(J0(e,i.x,s.x,o.x,a.x),J0(e,i.y,s.y,o.y,a.y)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class M6 extends Xa{constructor(e=new X,n=new X,r=new X,i=new X){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=n,this.v2=r,this.v3=i}getPoint(e,n=new X){const r=n,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return r.set(J0(e,i.x,s.x,o.x,a.x),J0(e,i.y,s.y,o.y,a.y),J0(e,i.z,s.z,o.z,a.z)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class U2 extends Xa{constructor(e=new Ve,n=new Ve){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=n}getPoint(e,n=new Ve){const r=n;return e===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r}getPointAt(e,n){return this.getPoint(e,n)}getTangent(e,n=new Ve){return n.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,n){return this.getTangent(e,n)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class E6 extends Xa{constructor(e=new X,n=new X){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=n}getPoint(e,n=new X){const r=n;return e===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r}getPointAt(e,n){return this.getPoint(e,n)}getTangent(e,n=new X){return n.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,n){return this.getTangent(e,n)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class j2 extends Xa{constructor(e=new Ve,n=new Ve,r=new Ve){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=n,this.v2=r}getPoint(e,n=new Ve){const r=n,i=this.v0,s=this.v1,o=this.v2;return r.set(Q0(e,i.x,s.x,o.x),Q0(e,i.y,s.y,o.y)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class F2 extends Xa{constructor(e=new X,n=new X,r=new X){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=n,this.v2=r}getPoint(e,n=new X){const r=n,i=this.v0,s=this.v1,o=this.v2;return r.set(Q0(e,i.x,s.x,o.x),Q0(e,i.y,s.y,o.y),Q0(e,i.z,s.z,o.z)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class z2 extends Xa{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,n=new Ve){const r=n,i=this.points,s=(i.length-1)*e,o=Math.floor(s),a=s-o,l=i[o===0?o:o-1],c=i[o],d=i[o>i.length-2?i.length-1:o+1],f=i[o>i.length-3?i.length-1:o+2];return r.set(GD(a,l.x,c.x,d.x,f.x),GD(a,l.y,c.y,d.y,f.y)),r}copy(e){super.copy(e),this.points=[];for(let n=0,r=e.points.length;n<r;n++){const i=e.points[n];this.points.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let n=0,r=this.points.length;n<r;n++){const i=this.points[n];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let n=0,r=e.points.length;n<r;n++){const i=e.points[n];this.points.push(new Ve().fromArray(i))}return this}}var O1=Object.freeze({__proto__:null,ArcCurve:w6,CatmullRomCurve3:S6,CubicBezierCurve:D2,CubicBezierCurve3:M6,EllipseCurve:iM,LineCurve:U2,LineCurve3:E6,QuadraticBezierCurve:j2,QuadraticBezierCurve3:F2,SplineCurve:z2});class A6 extends Xa{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),n=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(n)){const r=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new O1[r](n,e))}return this}getPoint(e,n){const r=e*this.getLength(),i=this.getCurveLengths();let s=0;for(;s<i.length;){if(i[s]>=r){const o=i[s]-r,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,n)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let n=0;for(let r=0,i=this.curves.length;r<i;r++)n+=this.curves[r].getLength(),e.push(n);return this.cacheLengths=e,e}getSpacedPoints(e=40){const n=[];for(let r=0;r<=e;r++)n.push(this.getPoint(r/e));return this.autoClose&&n.push(n[0]),n}getPoints(e=12){const n=[];let r;for(let i=0,s=this.curves;i<s.length;i++){const o=s[i],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);for(let c=0;c<l.length;c++){const d=l[c];r&&r.equals(d)||(n.push(d),r=d)}}return this.autoClose&&n.length>1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n}copy(e){super.copy(e),this.curves=[];for(let n=0,r=e.curves.length;n<r;n++){const i=e.curves[n];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let n=0,r=this.curves.length;n<r;n++){const i=this.curves[n];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let n=0,r=e.curves.length;n<r;n++){const i=e.curves[n];this.curves.push(new O1[i.type]().fromJSON(i))}return this}}class ky extends A6{constructor(e){super(),this.type="Path",this.currentPoint=new Ve,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let n=1,r=e.length;n<r;n++)this.lineTo(e[n].x,e[n].y);return this}moveTo(e,n){return this.currentPoint.set(e,n),this}lineTo(e,n){const r=new U2(this.currentPoint.clone(),new Ve(e,n));return this.curves.push(r),this.currentPoint.set(e,n),this}quadraticCurveTo(e,n,r,i){const s=new j2(this.currentPoint.clone(),new Ve(e,n),new Ve(r,i));return this.curves.push(s),this.currentPoint.set(r,i),this}bezierCurveTo(e,n,r,i,s,o){const a=new D2(this.currentPoint.clone(),new Ve(e,n),new Ve(r,i),new Ve(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){const n=[this.currentPoint.clone()].concat(e),r=new z2(n);return this.curves.push(r),this.currentPoint.copy(e[e.length-1]),this}arc(e,n,r,i,s,o){const a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,n+l,r,i,s,o),this}absarc(e,n,r,i,s,o){return this.absellipse(e,n,r,r,i,s,o),this}ellipse(e,n,r,i,s,o,a,l){const c=this.currentPoint.x,d=this.currentPoint.y;return this.absellipse(e+c,n+d,r,i,s,o,a,l),this}absellipse(e,n,r,i,s,o,a,l){const c=new iM(e,n,r,i,s,o,a,l);if(this.curves.length>0){const f=c.getPoint(0);f.equals(this.currentPoint)||this.lineTo(f.x,f.y)}this.curves.push(c);const d=c.getPoint(1);return this.currentPoint.copy(d),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class fx extends Zt{constructor(e=[new Ve(0,-.5),new Ve(.5,0),new Ve(0,.5)],n=12,r=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:n,phiStart:r,phiLength:i},n=Math.floor(n),i=Ar(i,0,Math.PI*2);const s=[],o=[],a=[],l=[],c=[],d=1/n,f=new X,m=new Ve,y=new X,x=new X,S=new X;let _=0,w=0;for(let A=0;A<=e.length-1;A++)switch(A){case 0:_=e[A+1].x-e[A].x,w=e[A+1].y-e[A].y,y.x=w*1,y.y=-_,y.z=w*0,S.copy(y),y.normalize(),l.push(y.x,y.y,y.z);break;case e.length-1:l.push(S.x,S.y,S.z);break;default:_=e[A+1].x-e[A].x,w=e[A+1].y-e[A].y,y.x=w*1,y.y=-_,y.z=w*0,x.copy(y),y.x+=S.x,y.y+=S.y,y.z+=S.z,y.normalize(),l.push(y.x,y.y,y.z),S.copy(x)}for(let A=0;A<=n;A++){const T=r+A*d*i,C=Math.sin(T),O=Math.cos(T);for(let N=0;N<=e.length-1;N++){f.x=e[N].x*C,f.y=e[N].y,f.z=e[N].x*O,o.push(f.x,f.y,f.z),m.x=A/n,m.y=N/(e.length-1),a.push(m.x,m.y);const D=l[3*N+0]*C,F=l[3*N+1],V=l[3*N+0]*O;c.push(D,F,V)}}for(let A=0;A<n;A++)for(let T=0;T<e.length-1;T++){const C=T+A*e.length,O=C,N=C+e.length,D=C+e.length+1,F=C+1;s.push(O,N,F),s.push(D,F,N)}this.setIndex(s),this.setAttribute("position",new kt(o,3)),this.setAttribute("uv",new kt(a,2)),this.setAttribute("normal",new kt(c,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new fx(e.points,e.segments,e.phiStart,e.phiLength)}}class sM extends fx{constructor(e=1,n=1,r=4,i=8){const s=new ky;s.absarc(0,-n/2,e,Math.PI*1.5,0),s.absarc(0,n/2,e,0,Math.PI*.5),super(s.getPoints(r),i),this.type="CapsuleGeometry",this.parameters={radius:e,length:n,capSegments:r,radialSegments:i}}static fromJSON(e){return new sM(e.radius,e.length,e.capSegments,e.radialSegments)}}class oM extends Zt{constructor(e=1,n=32,r=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:n,thetaStart:r,thetaLength:i},n=Math.max(3,n);const s=[],o=[],a=[],l=[],c=new X,d=new Ve;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let f=0,m=3;f<=n;f++,m+=3){const y=r+f/n*i;c.x=e*Math.cos(y),c.y=e*Math.sin(y),o.push(c.x,c.y,c.z),a.push(0,0,1),d.x=(o[m]/e+1)/2,d.y=(o[m+1]/e+1)/2,l.push(d.x,d.y)}for(let f=1;f<=n;f++)s.push(f,f+1,0);this.setIndex(s),this.setAttribute("position",new kt(o,3)),this.setAttribute("normal",new kt(a,3)),this.setAttribute("uv",new kt(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new oM(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class rv extends Zt{constructor(e=1,n=1,r=1,i=32,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:n,height:r,radialSegments:i,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};const c=this;i=Math.floor(i),s=Math.floor(s);const d=[],f=[],m=[],y=[];let x=0;const S=[],_=r/2;let w=0;A(),o===!1&&(e>0&&T(!0),n>0&&T(!1)),this.setIndex(d),this.setAttribute("position",new kt(f,3)),this.setAttribute("normal",new kt(m,3)),this.setAttribute("uv",new kt(y,2));function A(){const C=new X,O=new X;let N=0;const D=(n-e)/r;for(let F=0;F<=s;F++){const V=[],k=F/s,j=k*(n-e)+e;for(let H=0;H<=i;H++){const ne=H/i,te=ne*l+a,pe=Math.sin(te),oe=Math.cos(te);O.x=j*pe,O.y=-k*r+_,O.z=j*oe,f.push(O.x,O.y,O.z),C.set(pe,D,oe).normalize(),m.push(C.x,C.y,C.z),y.push(ne,1-k),V.push(x++)}S.push(V)}for(let F=0;F<i;F++)for(let V=0;V<s;V++){const k=S[V][F],j=S[V+1][F],H=S[V+1][F+1],ne=S[V][F+1];e>0&&(d.push(k,j,ne),N+=3),n>0&&(d.push(j,H,ne),N+=3)}c.addGroup(w,N,0),w+=N}function T(C){const O=x,N=new Ve,D=new X;let F=0;const V=C===!0?e:n,k=C===!0?1:-1;for(let H=1;H<=i;H++)f.push(0,_*k,0),m.push(0,k,0),y.push(.5,.5),x++;const j=x;for(let H=0;H<=i;H++){const te=H/i*l+a,pe=Math.cos(te),oe=Math.sin(te);D.x=V*oe,D.y=_*k,D.z=V*pe,f.push(D.x,D.y,D.z),m.push(0,k,0),N.x=pe*.5+.5,N.y=oe*.5*k+.5,y.push(N.x,N.y),x++}for(let H=0;H<i;H++){const ne=O+H,te=j+H;C===!0?d.push(te,te+1,ne):d.push(te+1,te,ne),F+=3}c.addGroup(w,F,C===!0?1:2),w+=F}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new rv(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class aM extends rv{constructor(e=1,n=1,r=32,i=1,s=!1,o=0,a=Math.PI*2){super(0,e,n,r,i,s,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:n,radialSegments:r,heightSegments:i,openEnded:s,thetaStart:o,thetaLength:a}}static fromJSON(e){return new aM(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class kd extends Zt{constructor(e=[],n=[],r=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:n,radius:r,detail:i};const s=[],o=[];a(i),c(r),d(),this.setAttribute("position",new kt(s,3)),this.setAttribute("normal",new kt(s.slice(),3)),this.setAttribute("uv",new kt(o,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function a(A){const T=new X,C=new X,O=new X;for(let N=0;N<n.length;N+=3)y(n[N+0],T),y(n[N+1],C),y(n[N+2],O),l(T,C,O,A)}function l(A,T,C,O){const N=O+1,D=[];for(let F=0;F<=N;F++){D[F]=[];const V=A.clone().lerp(C,F/N),k=T.clone().lerp(C,F/N),j=N-F;for(let H=0;H<=j;H++)H===0&&F===N?D[F][H]=V:D[F][H]=V.clone().lerp(k,H/j)}for(let F=0;F<N;F++)for(let V=0;V<2*(N-F)-1;V++){const k=Math.floor(V/2);V%2===0?(m(D[F][k+1]),m(D[F+1][k]),m(D[F][k])):(m(D[F][k+1]),m(D[F+1][k+1]),m(D[F+1][k]))}}function c(A){const T=new X;for(let C=0;C<s.length;C+=3)T.x=s[C+0],T.y=s[C+1],T.z=s[C+2],T.normalize().multiplyScalar(A),s[C+0]=T.x,s[C+1]=T.y,s[C+2]=T.z}function d(){const A=new X;for(let T=0;T<s.length;T+=3){A.x=s[T+0],A.y=s[T+1],A.z=s[T+2];const C=_(A)/2/Math.PI+.5,O=w(A)/Math.PI+.5;o.push(C,1-O)}x(),f()}function f(){for(let A=0;A<o.length;A+=6){const T=o[A+0],C=o[A+2],O=o[A+4],N=Math.max(T,C,O),D=Math.min(T,C,O);N>.9&&D<.1&&(T<.2&&(o[A+0]+=1),C<.2&&(o[A+2]+=1),O<.2&&(o[A+4]+=1))}}function m(A){s.push(A.x,A.y,A.z)}function y(A,T){const C=A*3;T.x=e[C+0],T.y=e[C+1],T.z=e[C+2]}function x(){const A=new X,T=new X,C=new X,O=new X,N=new Ve,D=new Ve,F=new Ve;for(let V=0,k=0;V<s.length;V+=9,k+=6){A.set(s[V+0],s[V+1],s[V+2]),T.set(s[V+3],s[V+4],s[V+5]),C.set(s[V+6],s[V+7],s[V+8]),N.set(o[k+0],o[k+1]),D.set(o[k+2],o[k+3]),F.set(o[k+4],o[k+5]),O.copy(A).add(T).add(C).divideScalar(3);const j=_(O);S(N,k+0,A,j),S(D,k+2,T,j),S(F,k+4,C,j)}}function S(A,T,C,O){O<0&&A.x===1&&(o[T]=A.x-1),C.x===0&&C.z===0&&(o[T]=O/2/Math.PI+.5)}function _(A){return Math.atan2(A.z,-A.x)}function w(A){return Math.atan2(-A.y,Math.sqrt(A.x*A.x+A.z*A.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new kd(e.vertices,e.indices,e.radius,e.details)}}class lM extends kd{constructor(e=1,n=0){const r=(1+Math.sqrt(5))/2,i=1/r,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-r,0,-i,r,0,i,-r,0,i,r,-i,-r,0,-i,r,0,i,-r,0,i,r,0,-r,0,-i,r,0,-i,-r,0,i,r,0,i],o=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(s,o,e,n),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:n}}static fromJSON(e){return new lM(e.radius,e.detail)}}const g_=new X,v_=new X,RA=new X,y_=new qs;class T6 extends Zt{constructor(e=null,n=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:n},e!==null){const i=Math.pow(10,4),s=Math.cos(Eh*n),o=e.getIndex(),a=e.getAttribute("position"),l=o?o.count:a.count,c=[0,0,0],d=["a","b","c"],f=new Array(3),m={},y=[];for(let x=0;x<l;x+=3){o?(c[0]=o.getX(x),c[1]=o.getX(x+1),c[2]=o.getX(x+2)):(c[0]=x,c[1]=x+1,c[2]=x+2);const{a:S,b:_,c:w}=y_;if(S.fromBufferAttribute(a,c[0]),_.fromBufferAttribute(a,c[1]),w.fromBufferAttribute(a,c[2]),y_.getNormal(RA),f[0]=`${Math.round(S.x*i)},${Math.round(S.y*i)},${Math.round(S.z*i)}`,f[1]=`${Math.round(_.x*i)},${Math.round(_.y*i)},${Math.round(_.z*i)}`,f[2]=`${Math.round(w.x*i)},${Math.round(w.y*i)},${Math.round(w.z*i)}`,!(f[0]===f[1]||f[1]===f[2]||f[2]===f[0]))for(let A=0;A<3;A++){const T=(A+1)%3,C=f[A],O=f[T],N=y_[d[A]],D=y_[d[T]],F=`${C}_${O}`,V=`${O}_${C}`;V in m&&m[V]?(RA.dot(m[V].normal)<=s&&(y.push(N.x,N.y,N.z),y.push(D.x,D.y,D.z)),m[V]=null):F in m||(m[F]={index0:c[A],index1:c[T],normal:RA.clone()})}}for(const x in m)if(m[x]){const{index0:S,index1:_}=m[x];g_.fromBufferAttribute(a,S),v_.fromBufferAttribute(a,_),y.push(g_.x,g_.y,g_.z),y.push(v_.x,v_.y,v_.z)}this.setAttribute("position",new kt(y,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class Th extends ky{constructor(e){super(e),this.uuid=So(),this.type="Shape",this.holes=[]}getPointsHoles(e){const n=[];for(let r=0,i=this.holes.length;r<i;r++)n[r]=this.holes[r].getPoints(e);return n}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let n=0,r=e.holes.length;n<r;n++){const i=e.holes[n];this.holes.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let n=0,r=this.holes.length;n<r;n++){const i=this.holes[n];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let n=0,r=e.holes.length;n<r;n++){const i=e.holes[n];this.holes.push(new ky().fromJSON(i))}return this}}const Sye={triangulate:function(t,e,n=2){const r=e&&e.length,i=r?e[0]*n:t.length;let s=C6(t,0,i,n,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c,d,f,m,y;if(r&&(s=Cye(t,e,s,n)),t.length>80*n){a=c=t[0],l=d=t[1];for(let x=n;x<i;x+=n)f=t[x],m=t[x+1],f<a&&(a=f),m<l&&(l=m),f>c&&(c=f),m>d&&(d=m);y=Math.max(c-a,d-l),y=y!==0?32767/y:0}return Oy(s,o,n,a,l,y,0),o}};function C6(t,e,n,r,i){let s,o;if(i===Fye(t,e,n,r)>0)for(s=e;s<n;s+=r)o=WD(s,t[s],t[s+1],o);else for(s=n-r;s>=e;s-=r)o=WD(s,t[s],t[s+1],o);return o&&cM(o,o.next)&&(Dy(o),o=o.next),o}function Bh(t,e){if(!t)return t;e||(e=t);let n=t,r;do if(r=!1,!n.steiner&&(cM(n,n.next)||vr(n.prev,n,n.next)===0)){if(Dy(n),n=e=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==e);return e}function Oy(t,e,n,r,i,s,o){if(!t)return;!o&&s&&kye(t,r,i,s);let a=t,l,c;for(;t.prev!==t.next;){if(l=t.prev,c=t.next,s?Eye(t,r,i,s):Mye(t)){e.push(l.i/n|0),e.push(t.i/n|0),e.push(c.i/n|0),Dy(t),t=c.next,a=c.next;continue}if(t=c,t===a){o?o===1?(t=Aye(Bh(t),e,n),Oy(t,e,n,r,i,s,2)):o===2&&Tye(t,e,n,r,i,s):Oy(Bh(t),e,n,r,i,s,1);break}}}function Mye(t){const e=t.prev,n=t,r=t.next;if(vr(e,n,r)>=0)return!1;const i=e.x,s=n.x,o=r.x,a=e.y,l=n.y,c=r.y,d=i<s?i<o?i:o:s<o?s:o,f=a<l?a<c?a:c:l<c?l:c,m=i>s?i>o?i:o:s>o?s:o,y=a>l?a>c?a:c:l>c?l:c;let x=r.next;for(;x!==e;){if(x.x>=d&&x.x<=m&&x.y>=f&&x.y<=y&&qm(i,a,s,l,o,c,x.x,x.y)&&vr(x.prev,x,x.next)>=0)return!1;x=x.next}return!0}function Eye(t,e,n,r){const i=t.prev,s=t,o=t.next;if(vr(i,s,o)>=0)return!1;const a=i.x,l=s.x,c=o.x,d=i.y,f=s.y,m=o.y,y=a<l?a<c?a:c:l<c?l:c,x=d<f?d<m?d:m:f<m?f:m,S=a>l?a>c?a:c:l>c?l:c,_=d>f?d>m?d:m:f>m?f:m,w=KC(y,x,e,n,r),A=KC(S,_,e,n,r);let T=t.prevZ,C=t.nextZ;for(;T&&T.z>=w&&C&&C.z<=A;){if(T.x>=y&&T.x<=S&&T.y>=x&&T.y<=_&&T!==i&&T!==o&&qm(a,d,l,f,c,m,T.x,T.y)&&vr(T.prev,T,T.next)>=0||(T=T.prevZ,C.x>=y&&C.x<=S&&C.y>=x&&C.y<=_&&C!==i&&C!==o&&qm(a,d,l,f,c,m,C.x,C.y)&&vr(C.prev,C,C.next)>=0))return!1;C=C.nextZ}for(;T&&T.z>=w;){if(T.x>=y&&T.x<=S&&T.y>=x&&T.y<=_&&T!==i&&T!==o&&qm(a,d,l,f,c,m,T.x,T.y)&&vr(T.prev,T,T.next)>=0)return!1;T=T.prevZ}for(;C&&C.z<=A;){if(C.x>=y&&C.x<=S&&C.y>=x&&C.y<=_&&C!==i&&C!==o&&qm(a,d,l,f,c,m,C.x,C.y)&&vr(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function Aye(t,e,n){let r=t;do{const i=r.prev,s=r.next.next;!cM(i,s)&&P6(i,r,r.next,s)&&Ly(i,s)&&Ly(s,i)&&(e.push(i.i/n|0),e.push(r.i/n|0),e.push(s.i/n|0),Dy(r),Dy(r.next),r=t=s),r=r.next}while(r!==t);return Bh(r)}function Tye(t,e,n,r,i,s){let o=t;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&Dye(o,a)){let l=R6(o,a);o=Bh(o,o.next),l=Bh(l,l.next),Oy(o,e,n,r,i,s,0),Oy(l,e,n,r,i,s,0);return}a=a.next}o=o.next}while(o!==t)}function Cye(t,e,n,r){const i=[];let s,o,a,l,c;for(s=0,o=e.length;s<o;s++)a=e[s]*r,l=s<o-1?e[s+1]*r:t.length,c=C6(t,a,l,r,!1),c===c.next&&(c.steiner=!0),i.push(Lye(c));for(i.sort(Pye),s=0;s<i.length;s++)n=Rye(i[s],n);return n}function Pye(t,e){return t.x-e.x}function Rye(t,e){const n=Nye(t,e);if(!n)return e;const r=R6(n,t);return Bh(r,r.next),Bh(n,n.next)}function Nye(t,e){let n=e,r=-1/0,i;const s=t.x,o=t.y;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){const m=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(m<=s&&m>r&&(r=m,i=n.x<n.next.x?n:n.next,m===s))return i}n=n.next}while(n!==e);if(!i)return null;const a=i,l=i.x,c=i.y;let d=1/0,f;n=i;do s>=n.x&&n.x>=l&&s!==n.x&&qm(o<c?s:r,o,l,c,o<c?r:s,o,n.x,n.y)&&(f=Math.abs(o-n.y)/(s-n.x),Ly(n,t)&&(f<d||f===d&&(n.x>i.x||n.x===i.x&&Iye(i,n)))&&(i=n,d=f)),n=n.next;while(n!==a);return i}function Iye(t,e){return vr(t.prev,t,e.prev)<0&&vr(e.next,t,t.next)<0}function kye(t,e,n,r){let i=t;do i.z===0&&(i.z=KC(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,Oye(i)}function Oye(t){let e,n,r,i,s,o,a,l,c=1;do{for(n=t,t=null,s=null,o=0;n;){for(o++,r=n,a=0,e=0;e<c&&(a++,r=r.nextZ,!!r);e++);for(l=c;a>0||l>0&&r;)a!==0&&(l===0||!r||n.z<=r.z)?(i=n,n=n.nextZ,a--):(i=r,r=r.nextZ,l--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;n=r}s.nextZ=null,c*=2}while(o>1);return t}function KC(t,e,n,r,i){return t=(t-n)*i|0,e=(e-r)*i|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function Lye(t){let e=t,n=t;do(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next;while(e!==t);return n}function qm(t,e,n,r,i,s,o,a){return(i-o)*(e-a)>=(t-o)*(s-a)&&(t-o)*(r-a)>=(n-o)*(e-a)&&(n-o)*(s-a)>=(i-o)*(r-a)}function Dye(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!Uye(t,e)&&(Ly(t,e)&&Ly(e,t)&&jye(t,e)&&(vr(t.prev,t,e.prev)||vr(t,e.prev,e))||cM(t,e)&&vr(t.prev,t,t.next)>0&&vr(e.prev,e,e.next)>0)}function vr(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function cM(t,e){return t.x===e.x&&t.y===e.y}function P6(t,e,n,r){const i=b_(vr(t,e,n)),s=b_(vr(t,e,r)),o=b_(vr(n,r,t)),a=b_(vr(n,r,e));return!!(i!==s&&o!==a||i===0&&x_(t,n,e)||s===0&&x_(t,r,e)||o===0&&x_(n,t,r)||a===0&&x_(n,e,r))}function x_(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function b_(t){return t>0?1:t<0?-1:0}function Uye(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&P6(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function Ly(t,e){return vr(t.prev,t,t.next)<0?vr(t,e,t.next)>=0&&vr(t,t.prev,e)>=0:vr(t,e,t.prev)<0||vr(t,t.next,e)<0}function jye(t,e){let n=t,r=!1;const i=(t.x+e.x)/2,s=(t.y+e.y)/2;do n.y>s!=n.next.y>s&&n.next.y!==n.y&&i<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==t);return r}function R6(t,e){const n=new YC(t.i,t.x,t.y),r=new YC(e.i,e.x,e.y),i=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,s.next=r,r.prev=s,r}function WD(t,e,n,r){const i=new YC(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Dy(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function YC(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Fye(t,e,n,r){let i=0;for(let s=e,o=n-r;s<n;s+=r)i+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return i}class Rl{static area(e){const n=e.length;let r=0;for(let i=n-1,s=0;s<n;i=s++)r+=e[i].x*e[s].y-e[s].x*e[i].y;return r*.5}static isClockWise(e){return Rl.area(e)<0}static triangulateShape(e,n){const r=[],i=[],s=[];$D(e),XD(r,e);let o=e.length;n.forEach($D);for(let l=0;l<n.length;l++)i.push(o),o+=n[l].length,XD(r,n[l]);const a=Sye.triangulate(r,i);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}}function $D(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function XD(t,e){for(let n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}class uM extends Zt{constructor(e=new Th([new Ve(.5,.5),new Ve(-.5,.5),new Ve(-.5,-.5),new Ve(.5,-.5)]),n={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:n},e=Array.isArray(e)?e:[e];const r=this,i=[],s=[];for(let a=0,l=e.length;a<l;a++){const c=e[a];o(c)}this.setAttribute("position",new kt(i,3)),this.setAttribute("uv",new kt(s,2)),this.computeVertexNormals();function o(a){const l=[],c=n.curveSegments!==void 0?n.curveSegments:12,d=n.steps!==void 0?n.steps:1,f=n.depth!==void 0?n.depth:1;let m=n.bevelEnabled!==void 0?n.bevelEnabled:!0,y=n.bevelThickness!==void 0?n.bevelThickness:.2,x=n.bevelSize!==void 0?n.bevelSize:y-.1,S=n.bevelOffset!==void 0?n.bevelOffset:0,_=n.bevelSegments!==void 0?n.bevelSegments:3;const w=n.extrudePath,A=n.UVGenerator!==void 0?n.UVGenerator:zye;let T,C=!1,O,N,D,F;w&&(T=w.getSpacedPoints(d),C=!0,m=!1,O=w.computeFrenetFrames(d,!1),N=new X,D=new X,F=new X),m||(_=0,y=0,x=0,S=0);const V=a.extractPoints(c);let k=V.shape;const j=V.holes;if(!Rl.isClockWise(k)){k=k.reverse();for(let ue=0,Q=j.length;ue<Q;ue++){const Ge=j[ue];Rl.isClockWise(Ge)&&(j[ue]=Ge.reverse())}}const ne=Rl.triangulateShape(k,j),te=k;for(let ue=0,Q=j.length;ue<Q;ue++){const Ge=j[ue];k=k.concat(Ge)}function pe(ue,Q,Ge){return Q||console.error("THREE.ExtrudeGeometry: vec does not exist"),ue.clone().addScaledVector(Q,Ge)}const oe=k.length,ce=ne.length;function B(ue,Q,Ge){let Ue,We,Qe;const xt=ue.x-Q.x,at=ue.y-Q.y,ee=Ge.x-ue.x,W=Ge.y-ue.y,Ee=xt*xt+at*at,Be=xt*W-at*ee;if(Math.abs(Be)>Number.EPSILON){const le=Math.sqrt(Ee),Ce=Math.sqrt(ee*ee+W*W),lt=Q.x-at/le,rt=Q.y+xt/le,ft=Ge.x-W/Ce,nn=Ge.y+ee/Ce,qe=((ft-lt)*W-(nn-rt)*ee)/(xt*W-at*ee);Ue=lt+xt*qe-ue.x,We=rt+at*qe-ue.y;const dt=Ue*Ue+We*We;if(dt<=2)return new Ve(Ue,We);Qe=Math.sqrt(dt/2)}else{let le=!1;xt>Number.EPSILON?ee>Number.EPSILON&&(le=!0):xt<-Number.EPSILON?ee<-Number.EPSILON&&(le=!0):Math.sign(at)===Math.sign(W)&&(le=!0),le?(Ue=-at,We=xt,Qe=Math.sqrt(Ee)):(Ue=xt,We=at,Qe=Math.sqrt(Ee/2))}return new Ve(Ue/Qe,We/Qe)}const K=[];for(let ue=0,Q=te.length,Ge=Q-1,Ue=ue+1;ue<Q;ue++,Ge++,Ue++)Ge===Q&&(Ge=0),Ue===Q&&(Ue=0),K[ue]=B(te[ue],te[Ge],te[Ue]);const q=[];let $,Z=K.concat();for(let ue=0,Q=j.length;ue<Q;ue++){const Ge=j[ue];$=[];for(let Ue=0,We=Ge.length,Qe=We-1,xt=Ue+1;Ue<We;Ue++,Qe++,xt++)Qe===We&&(Qe=0),xt===We&&(xt=0),$[Ue]=B(Ge[Ue],Ge[Qe],Ge[xt]);q.push($),Z=Z.concat($)}for(let ue=0;ue<_;ue++){const Q=ue/_,Ge=y*Math.cos(Q*Math.PI/2),Ue=x*Math.sin(Q*Math.PI/2)+S;for(let We=0,Qe=te.length;We<Qe;We++){const xt=pe(te[We],K[We],Ue);Se(xt.x,xt.y,-Ge)}for(let We=0,Qe=j.length;We<Qe;We++){const xt=j[We];$=q[We];for(let at=0,ee=xt.length;at<ee;at++){const W=pe(xt[at],$[at],Ue);Se(W.x,W.y,-Ge)}}}const ge=x+S;for(let ue=0;ue<oe;ue++){const Q=m?pe(k[ue],Z[ue],ge):k[ue];C?(D.copy(O.normals[0]).multiplyScalar(Q.x),N.copy(O.binormals[0]).multiplyScalar(Q.y),F.copy(T[0]).add(D).add(N),Se(F.x,F.y,F.z)):Se(Q.x,Q.y,0)}for(let ue=1;ue<=d;ue++)for(let Q=0;Q<oe;Q++){const Ge=m?pe(k[Q],Z[Q],ge):k[Q];C?(D.copy(O.normals[ue]).multiplyScalar(Ge.x),N.copy(O.binormals[ue]).multiplyScalar(Ge.y),F.copy(T[ue]).add(D).add(N),Se(F.x,F.y,F.z)):Se(Ge.x,Ge.y,f/d*ue)}for(let ue=_-1;ue>=0;ue--){const Q=ue/_,Ge=y*Math.cos(Q*Math.PI/2),Ue=x*Math.sin(Q*Math.PI/2)+S;for(let We=0,Qe=te.length;We<Qe;We++){const xt=pe(te[We],K[We],Ue);Se(xt.x,xt.y,f+Ge)}for(let We=0,Qe=j.length;We<Qe;We++){const xt=j[We];$=q[We];for(let at=0,ee=xt.length;at<ee;at++){const W=pe(xt[at],$[at],Ue);C?Se(W.x,W.y+T[d-1].y,T[d-1].x+Ge):Se(W.x,W.y,f+Ge)}}}ae(),fe();function ae(){const ue=i.length/3;if(m){let Q=0,Ge=oe*Q;for(let Ue=0;Ue<ce;Ue++){const We=ne[Ue];$e(We[2]+Ge,We[1]+Ge,We[0]+Ge)}Q=d+_*2,Ge=oe*Q;for(let Ue=0;Ue<ce;Ue++){const We=ne[Ue];$e(We[0]+Ge,We[1]+Ge,We[2]+Ge)}}else{for(let Q=0;Q<ce;Q++){const Ge=ne[Q];$e(Ge[2],Ge[1],Ge[0])}for(let Q=0;Q<ce;Q++){const Ge=ne[Q];$e(Ge[0]+oe*d,Ge[1]+oe*d,Ge[2]+oe*d)}}r.addGroup(ue,i.length/3-ue,0)}function fe(){const ue=i.length/3;let Q=0;_e(te,Q),Q+=te.length;for(let Ge=0,Ue=j.length;Ge<Ue;Ge++){const We=j[Ge];_e(We,Q),Q+=We.length}r.addGroup(ue,i.length/3-ue,1)}function _e(ue,Q){let Ge=ue.length;for(;--Ge>=0;){const Ue=Ge;let We=Ge-1;We<0&&(We=ue.length-1);for(let Qe=0,xt=d+_*2;Qe<xt;Qe++){const at=oe*Qe,ee=oe*(Qe+1),W=Q+Ue+at,Ee=Q+We+at,Be=Q+We+ee,le=Q+Ue+ee;Me(W,Ee,Be,le)}}}function Se(ue,Q,Ge){l.push(ue),l.push(Q),l.push(Ge)}function $e(ue,Q,Ge){He(ue),He(Q),He(Ge);const Ue=i.length/3,We=A.generateTopUV(r,i,Ue-3,Ue-2,Ue-1);Xe(We[0]),Xe(We[1]),Xe(We[2])}function Me(ue,Q,Ge,Ue){He(ue),He(Q),He(Ue),He(Q),He(Ge),He(Ue);const We=i.length/3,Qe=A.generateSideWallUV(r,i,We-6,We-3,We-2,We-1);Xe(Qe[0]),Xe(Qe[1]),Xe(Qe[3]),Xe(Qe[1]),Xe(Qe[2]),Xe(Qe[3])}function He(ue){i.push(l[ue*3+0]),i.push(l[ue*3+1]),i.push(l[ue*3+2])}function Xe(ue){s.push(ue.x),s.push(ue.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),n=this.parameters.shapes,r=this.parameters.options;return Bye(n,r,e)}static fromJSON(e,n){const r=[];for(let s=0,o=e.shapes.length;s<o;s++){const a=n[e.shapes[s]];r.push(a)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new O1[i.type]().fromJSON(i)),new uM(r,e.options)}}const zye={generateTopUV:function(t,e,n,r,i){const s=e[n*3],o=e[n*3+1],a=e[r*3],l=e[r*3+1],c=e[i*3],d=e[i*3+1];return[new Ve(s,o),new Ve(a,l),new Ve(c,d)]},generateSideWallUV:function(t,e,n,r,i,s){const o=e[n*3],a=e[n*3+1],l=e[n*3+2],c=e[r*3],d=e[r*3+1],f=e[r*3+2],m=e[i*3],y=e[i*3+1],x=e[i*3+2],S=e[s*3],_=e[s*3+1],w=e[s*3+2];return Math.abs(a-d)<Math.abs(o-c)?[new Ve(o,1-l),new Ve(c,1-f),new Ve(m,1-x),new Ve(S,1-w)]:[new Ve(a,1-l),new Ve(d,1-f),new Ve(y,1-x),new Ve(_,1-w)]}};function Bye(t,e,n){if(n.shapes=[],Array.isArray(t))for(let r=0,i=t.length;r<i;r++){const s=t[r];n.shapes.push(s.uuid)}else n.shapes.push(t.uuid);return n.options=Object.assign({},e),e.extrudePath!==void 0&&(n.options.extrudePath=e.extrudePath.toJSON()),n}class dM extends kd{constructor(e=1,n=0){const r=(1+Math.sqrt(5))/2,i=[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(i,s,e,n),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:n}}static fromJSON(e){return new dM(e.radius,e.detail)}}class hx extends kd{constructor(e=1,n=0){const r=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(r,i,e,n),this.type="OctahedronGeometry",this.parameters={radius:e,detail:n}}static fromJSON(e){return new hx(e.radius,e.detail)}}class fM extends Zt{constructor(e=.5,n=1,r=32,i=1,s=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:n,thetaSegments:r,phiSegments:i,thetaStart:s,thetaLength:o},r=Math.max(3,r),i=Math.max(1,i);const a=[],l=[],c=[],d=[];let f=e;const m=(n-e)/i,y=new X,x=new Ve;for(let S=0;S<=i;S++){for(let _=0;_<=r;_++){const w=s+_/r*o;y.x=f*Math.cos(w),y.y=f*Math.sin(w),l.push(y.x,y.y,y.z),c.push(0,0,1),x.x=(y.x/n+1)/2,x.y=(y.y/n+1)/2,d.push(x.x,x.y)}f+=m}for(let S=0;S<i;S++){const _=S*(r+1);for(let w=0;w<r;w++){const A=w+_,T=A,C=A+r+1,O=A+r+2,N=A+1;a.push(T,C,N),a.push(C,O,N)}}this.setIndex(a),this.setAttribute("position",new kt(l,3)),this.setAttribute("normal",new kt(c,3)),this.setAttribute("uv",new kt(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new fM(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class hM extends Zt{constructor(e=new Th([new Ve(0,.5),new Ve(-.5,-.5),new Ve(.5,-.5)]),n=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:n};const r=[],i=[],s=[],o=[];let a=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let d=0;d<e.length;d++)c(e[d]),this.addGroup(a,l,d),a+=l,l=0;this.setIndex(r),this.setAttribute("position",new kt(i,3)),this.setAttribute("normal",new kt(s,3)),this.setAttribute("uv",new kt(o,2));function c(d){const f=i.length/3,m=d.extractPoints(n);let y=m.shape;const x=m.holes;Rl.isClockWise(y)===!1&&(y=y.reverse());for(let _=0,w=x.length;_<w;_++){const A=x[_];Rl.isClockWise(A)===!0&&(x[_]=A.reverse())}const S=Rl.triangulateShape(y,x);for(let _=0,w=x.length;_<w;_++){const A=x[_];y=y.concat(A)}for(let _=0,w=y.length;_<w;_++){const A=y[_];i.push(A.x,A.y,0),s.push(0,0,1),o.push(A.x,A.y)}for(let _=0,w=S.length;_<w;_++){const A=S[_],T=A[0]+f,C=A[1]+f,O=A[2]+f;r.push(T,C,O),l+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),n=this.parameters.shapes;return Hye(n,e)}static fromJSON(e,n){const r=[];for(let i=0,s=e.shapes.length;i<s;i++){const o=n[e.shapes[i]];r.push(o)}return new hM(r,e.curveSegments)}}function Hye(t,e){if(e.shapes=[],Array.isArray(t))for(let n=0,r=t.length;n<r;n++){const i=t[n];e.shapes.push(i.uuid)}else e.shapes.push(t.uuid);return e}class px extends Zt{constructor(e=1,n=32,r=16,i=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:n,heightSegments:r,phiStart:i,phiLength:s,thetaStart:o,thetaLength:a},n=Math.max(3,Math.floor(n)),r=Math.max(2,Math.floor(r));const l=Math.min(o+a,Math.PI);let c=0;const d=[],f=new X,m=new X,y=[],x=[],S=[],_=[];for(let w=0;w<=r;w++){const A=[],T=w/r;let C=0;w===0&&o===0?C=.5/n:w===r&&l===Math.PI&&(C=-.5/n);for(let O=0;O<=n;O++){const N=O/n;f.x=-e*Math.cos(i+N*s)*Math.sin(o+T*a),f.y=e*Math.cos(o+T*a),f.z=e*Math.sin(i+N*s)*Math.sin(o+T*a),x.push(f.x,f.y,f.z),m.copy(f).normalize(),S.push(m.x,m.y,m.z),_.push(N+C,1-T),A.push(c++)}d.push(A)}for(let w=0;w<r;w++)for(let A=0;A<n;A++){const T=d[w][A+1],C=d[w][A],O=d[w+1][A],N=d[w+1][A+1];(w!==0||o>0)&&y.push(T,C,N),(w!==r-1||l<Math.PI)&&y.push(C,O,N)}this.setIndex(y),this.setAttribute("position",new kt(x,3)),this.setAttribute("normal",new kt(S,3)),this.setAttribute("uv",new kt(_,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new px(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class pM extends kd{constructor(e=1,n=0){const r=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];super(r,i,e,n),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:n}}static fromJSON(e){return new pM(e.radius,e.detail)}}class mM extends Zt{constructor(e=1,n=.4,r=12,i=48,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:n,radialSegments:r,tubularSegments:i,arc:s},r=Math.floor(r),i=Math.floor(i);const o=[],a=[],l=[],c=[],d=new X,f=new X,m=new X;for(let y=0;y<=r;y++)for(let x=0;x<=i;x++){const S=x/i*s,_=y/r*Math.PI*2;f.x=(e+n*Math.cos(_))*Math.cos(S),f.y=(e+n*Math.cos(_))*Math.sin(S),f.z=n*Math.sin(_),a.push(f.x,f.y,f.z),d.x=e*Math.cos(S),d.y=e*Math.sin(S),m.subVectors(f,d).normalize(),l.push(m.x,m.y,m.z),c.push(x/i),c.push(y/r)}for(let y=1;y<=r;y++)for(let x=1;x<=i;x++){const S=(i+1)*y+x-1,_=(i+1)*(y-1)+x-1,w=(i+1)*(y-1)+x,A=(i+1)*y+x;o.push(S,_,A),o.push(_,w,A)}this.setIndex(o),this.setAttribute("position",new kt(a,3)),this.setAttribute("normal",new kt(l,3)),this.setAttribute("uv",new kt(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new mM(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class gM extends Zt{constructor(e=1,n=.4,r=64,i=8,s=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:n,tubularSegments:r,radialSegments:i,p:s,q:o},r=Math.floor(r),i=Math.floor(i);const a=[],l=[],c=[],d=[],f=new X,m=new X,y=new X,x=new X,S=new X,_=new X,w=new X;for(let T=0;T<=r;++T){const C=T/r*s*Math.PI*2;A(C,s,o,e,y),A(C+.01,s,o,e,x),_.subVectors(x,y),w.addVectors(x,y),S.crossVectors(_,w),w.crossVectors(S,_),S.normalize(),w.normalize();for(let O=0;O<=i;++O){const N=O/i*Math.PI*2,D=-n*Math.cos(N),F=n*Math.sin(N);f.x=y.x+(D*w.x+F*S.x),f.y=y.y+(D*w.y+F*S.y),f.z=y.z+(D*w.z+F*S.z),l.push(f.x,f.y,f.z),m.subVectors(f,y).normalize(),c.push(m.x,m.y,m.z),d.push(T/r),d.push(O/i)}}for(let T=1;T<=r;T++)for(let C=1;C<=i;C++){const O=(i+1)*(T-1)+(C-1),N=(i+1)*T+(C-1),D=(i+1)*T+C,F=(i+1)*(T-1)+C;a.push(O,N,F),a.push(N,D,F)}this.setIndex(a),this.setAttribute("position",new kt(l,3)),this.setAttribute("normal",new kt(c,3)),this.setAttribute("uv",new kt(d,2));function A(T,C,O,N,D){const F=Math.cos(T),V=Math.sin(T),k=O/C*T,j=Math.cos(k);D.x=N*(2+j)*.5*F,D.y=N*(2+j)*V*.5,D.z=N*Math.sin(k)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new gM(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class vM extends Zt{constructor(e=new F2(new X(-1,-1,0),new X(-1,1,0),new X(1,1,0)),n=64,r=1,i=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:n,radius:r,radialSegments:i,closed:s};const o=e.computeFrenetFrames(n,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const a=new X,l=new X,c=new Ve;let d=new X;const f=[],m=[],y=[],x=[];S(),this.setIndex(x),this.setAttribute("position",new kt(f,3)),this.setAttribute("normal",new kt(m,3)),this.setAttribute("uv",new kt(y,2));function S(){for(let T=0;T<n;T++)_(T);_(s===!1?n:0),A(),w()}function _(T){d=e.getPointAt(T/n,d);const C=o.normals[T],O=o.binormals[T];for(let N=0;N<=i;N++){const D=N/i*Math.PI*2,F=Math.sin(D),V=-Math.cos(D);l.x=V*C.x+F*O.x,l.y=V*C.y+F*O.y,l.z=V*C.z+F*O.z,l.normalize(),m.push(l.x,l.y,l.z),a.x=d.x+r*l.x,a.y=d.y+r*l.y,a.z=d.z+r*l.z,f.push(a.x,a.y,a.z)}}function w(){for(let T=1;T<=n;T++)for(let C=1;C<=i;C++){const O=(i+1)*(T-1)+(C-1),N=(i+1)*T+(C-1),D=(i+1)*T+C,F=(i+1)*(T-1)+C;x.push(O,N,F),x.push(N,D,F)}}function A(){for(let T=0;T<=n;T++)for(let C=0;C<=i;C++)c.x=T/n,c.y=C/i,y.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new vM(new O1[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class N6 extends Zt{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const n=[],r=new Set,i=new X,s=new X;if(e.index!==null){const o=e.attributes.position,a=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:a.count,materialIndex:0}]);for(let c=0,d=l.length;c<d;++c){const f=l[c],m=f.start,y=f.count;for(let x=m,S=m+y;x<S;x+=3)for(let _=0;_<3;_++){const w=a.getX(x+_),A=a.getX(x+(_+1)%3);i.fromBufferAttribute(o,w),s.fromBufferAttribute(o,A),qD(i,s,r)===!0&&(n.push(i.x,i.y,i.z),n.push(s.x,s.y,s.z))}}}else{const o=e.attributes.position;for(let a=0,l=o.count/3;a<l;a++)for(let c=0;c<3;c++){const d=3*a+c,f=3*a+(c+1)%3;i.fromBufferAttribute(o,d),s.fromBufferAttribute(o,f),qD(i,s,r)===!0&&(n.push(i.x,i.y,i.z),n.push(s.x,s.y,s.z))}}this.setAttribute("position",new kt(n,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function qD(t,e,n){const r=`${t.x},${t.y},${t.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${t.x},${t.y},${t.z}`;return n.has(r)===!0||n.has(i)===!0?!1:(n.add(r),n.add(i),!0)}var KD=Object.freeze({__proto__:null,BoxGeometry:ep,CapsuleGeometry:sM,CircleGeometry:oM,ConeGeometry:aM,CylinderGeometry:rv,DodecahedronGeometry:lM,EdgesGeometry:T6,ExtrudeGeometry:uM,IcosahedronGeometry:dM,LatheGeometry:fx,OctahedronGeometry:hx,PlaneGeometry:tv,PolyhedronGeometry:kd,RingGeometry:fM,ShapeGeometry:hM,SphereGeometry:px,TetrahedronGeometry:pM,TorusGeometry:mM,TorusKnotGeometry:gM,TubeGeometry:vM,WireframeGeometry:N6});class I6 extends Gr{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new ot(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class k6 extends Qo{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class mx extends Gr{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new ot(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ot(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lu,this.normalScale=new Ve(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new as,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class na extends mx{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Ve(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Ar(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(n){this.ior=(1+.4*n)/(1-.4*n)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new ot(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new ot(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new ot(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class O6 extends Gr{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ot(16777215),this.specular=new ot(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ot(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lu,this.normalScale=new Ve(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new as,this.combine=ox,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class L6 extends Gr{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new ot(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ot(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lu,this.normalScale=new Ve(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class D6 extends Gr{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lu,this.normalScale=new Ve(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class U6 extends Gr{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ot(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ot(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lu,this.normalScale=new Ve(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new as,this.combine=ox,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class j6 extends Gr{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new ot(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lu,this.normalScale=new Ve(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class F6 extends $r{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function lh(t,e,n){return!t||!n&&t.constructor===e?t:typeof e.BYTES_PER_ELEMENT=="number"?new e(t):Array.prototype.slice.call(t)}function z6(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function B6(t){function e(i,s){return t[i]-t[s]}const n=t.length,r=new Array(n);for(let i=0;i!==n;++i)r[i]=i;return r.sort(e),r}function ZC(t,e,n){const r=t.length,i=new t.constructor(r);for(let s=0,o=0;o!==r;++s){const a=n[s]*e;for(let l=0;l!==e;++l)i[o++]=t[a+l]}return i}function B2(t,e,n,r){let i=1,s=t[0];for(;s!==void 0&&s[r]===void 0;)s=t[i++];if(s===void 0)return;let o=s[r];if(o!==void 0)if(Array.isArray(o))do o=s[r],o!==void 0&&(e.push(s.time),n.push.apply(n,o)),s=t[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[r],o!==void 0&&(e.push(s.time),o.toArray(n,n.length)),s=t[i++];while(s!==void 0);else do o=s[r],o!==void 0&&(e.push(s.time),n.push(o)),s=t[i++];while(s!==void 0)}function Vye(t,e,n,r,i=30){const s=t.clone();s.name=e;const o=[];for(let l=0;l<s.tracks.length;++l){const c=s.tracks[l],d=c.getValueSize(),f=[],m=[];for(let y=0;y<c.times.length;++y){const x=c.times[y]*i;if(!(x<n||x>=r)){f.push(c.times[y]);for(let S=0;S<d;++S)m.push(c.values[y*d+S])}}f.length!==0&&(c.times=lh(f,c.times.constructor),c.values=lh(m,c.values.constructor),o.push(c))}s.tracks=o;let a=1/0;for(let l=0;l<s.tracks.length;++l)a>s.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l<s.tracks.length;++l)s.tracks[l].shift(-1*a);return s.resetDuration(),s}function Gye(t,e=0,n=t,r=30){r<=0&&(r=30);const i=n.tracks.length,s=e/r;for(let o=0;o<i;++o){const a=n.tracks[o],l=a.ValueTypeName;if(l==="bool"||l==="string")continue;const c=t.tracks.find(function(w){return w.name===a.name&&w.ValueTypeName===l});if(c===void 0)continue;let d=0;const f=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(d=f/3);let m=0;const y=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(m=y/3);const x=a.times.length-1;let S;if(s<=a.times[0]){const w=d,A=f-d;S=a.values.slice(w,A)}else if(s>=a.times[x]){const w=x*f+d,A=w+f-d;S=a.values.slice(w,A)}else{const w=a.createInterpolant(),A=d,T=f-d;w.evaluate(s),S=w.resultBuffer.slice(A,T)}l==="quaternion"&&new qt().fromArray(S).normalize().conjugate().toArray(S);const _=c.times.length;for(let w=0;w<_;++w){const A=w*y+m;if(l==="quaternion")qt.multiplyQuaternionsFlat(c.values,A,S,0,c.values,A);else{const T=y-m*2;for(let C=0;C<T;++C)c.values[A+C]-=S[C]}}}return t.blendMode=y2,t}const Wye={convertArray:lh,isTypedArray:z6,getKeyframeOrder:B6,sortedArray:ZC,flattenJSON:B2,subclip:Vye,makeClipAdditive:Gye};class iv{constructor(e,n,r,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new n.constructor(r),this.sampleValues=n,this.valueSize=r,this.settings=null,this.DefaultSettings_={}}evaluate(e){const n=this.parameterPositions;let r=this._cachedIndex,i=n[r],s=n[r-1];e:{t:{let o;n:{r:if(!(e<i)){for(let a=r+2;;){if(i===void 0){if(e<s)break r;return r=n.length,this._cachedIndex=r,this.copySampleValue_(r-1)}if(r===a)break;if(s=i,i=n[++r],e<i)break t}o=n.length;break n}if(!(e>=s)){const a=n[1];e<a&&(r=2,s=a);for(let l=r-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===l)break;if(i=s,s=n[--r-1],e>=s)break t}o=r,r=0;break n}break e}for(;r<o;){const a=r+o>>>1;e<n[a]?o=a:r=a+1}if(i=n[r],s=n[r-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return r=n.length,this._cachedIndex=r,this.copySampleValue_(r-1)}this._cachedIndex=r,this.intervalChanged_(r,s,i)}return this.interpolate_(r,s,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const n=this.resultBuffer,r=this.sampleValues,i=this.valueSize,s=e*i;for(let o=0;o!==i;++o)n[o]=r[s+o];return n}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class H6 extends iv{constructor(e,n,r,i){super(e,n,r,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:sh,endingEnd:sh}}intervalChanged_(e,n,r){const i=this.parameterPositions;let s=e-2,o=e+1,a=i[s],l=i[o];if(a===void 0)switch(this.getSettings_().endingStart){case oh:s=e,a=2*n-r;break;case Ay:s=i.length-2,a=n+i[s]-i[s+1];break;default:s=e,a=r}if(l===void 0)switch(this.getSettings_().endingEnd){case oh:o=e,l=2*r-n;break;case Ay:o=1,l=r+i[1]-i[0];break;default:o=e-1,l=n}const c=(r-n)*.5,d=this.valueSize;this._weightPrev=c/(n-a),this._weightNext=c/(l-r),this._offsetPrev=s*d,this._offsetNext=o*d}interpolate_(e,n,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,d=this._offsetPrev,f=this._offsetNext,m=this._weightPrev,y=this._weightNext,x=(r-n)/(i-n),S=x*x,_=S*x,w=-m*_+2*m*S-m*x,A=(1+m)*_+(-1.5-2*m)*S+(-.5+m)*x+1,T=(-1-y)*_+(1.5+y)*S+.5*x,C=y*_-y*S;for(let O=0;O!==a;++O)s[O]=w*o[d+O]+A*o[c+O]+T*o[l+O]+C*o[f+O];return s}}class H2 extends iv{constructor(e,n,r,i){super(e,n,r,i)}interpolate_(e,n,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,d=(r-n)/(i-n),f=1-d;for(let m=0;m!==a;++m)s[m]=o[c+m]*f+o[l+m]*d;return s}}class V6 extends iv{constructor(e,n,r,i){super(e,n,r,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class qa{constructor(e,n,r,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(n===void 0||n.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=lh(n,this.TimeBufferType),this.values=lh(r,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const n=e.constructor;let r;if(n.toJSON!==this.toJSON)r=n.toJSON(e);else{r={name:e.name,times:lh(e.times,Array),values:lh(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(r.interpolation=i)}return r.type=e.ValueTypeName,r}InterpolantFactoryMethodDiscrete(e){return new V6(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new H2(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new H6(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let n;switch(e){case Ig:n=this.InterpolantFactoryMethodDiscrete;break;case kg:n=this.InterpolantFactoryMethodLinear;break;case W_:n=this.InterpolantFactoryMethodSmooth;break}if(n===void 0){const r="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(r);return console.warn("THREE.KeyframeTrack:",r),this}return this.createInterpolant=n,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Ig;case this.InterpolantFactoryMethodLinear:return kg;case this.InterpolantFactoryMethodSmooth:return W_}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const n=this.times;for(let r=0,i=n.length;r!==i;++r)n[r]+=e}return this}scale(e){if(e!==1){const n=this.times;for(let r=0,i=n.length;r!==i;++r)n[r]*=e}return this}trim(e,n){const r=this.times,i=r.length;let s=0,o=i-1;for(;s!==i&&r[s]<e;)++s;for(;o!==-1&&r[o]>n;)--o;if(++o,s!==0||o!==i){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=r.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0;const n=this.getValueSize();n-Math.floor(n)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const r=this.times,i=this.values,s=r.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=r[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(i!==void 0&&z6(i))for(let a=0,l=i.length;a!==l;++a){const c=i[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),n=this.values.slice(),r=this.getValueSize(),i=this.getInterpolation()===W_,s=e.length-1;let o=1;for(let a=1;a<s;++a){let l=!1;const c=e[a],d=e[a+1];if(c!==d&&(a!==1||c!==e[0]))if(i)l=!0;else{const f=a*r,m=f-r,y=f+r;for(let x=0;x!==r;++x){const S=n[f+x];if(S!==n[m+x]||S!==n[y+x]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];const f=a*r,m=o*r;for(let y=0;y!==r;++y)n[m+y]=n[f+y]}++o}}if(s>0){e[o]=e[s];for(let a=s*r,l=o*r,c=0;c!==r;++c)n[l+c]=n[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=n.slice(0,o*r)):(this.times=e,this.values=n),this}clone(){const e=this.times.slice(),n=this.values.slice(),r=this.constructor,i=new r(this.name,e,n);return i.createInterpolant=this.createInterpolant,i}}qa.prototype.TimeBufferType=Float32Array;qa.prototype.ValueBufferType=Float32Array;qa.prototype.DefaultInterpolation=kg;class np extends qa{constructor(e,n,r){super(e,n,r)}}np.prototype.ValueTypeName="bool";np.prototype.ValueBufferType=Array;np.prototype.DefaultInterpolation=Ig;np.prototype.InterpolantFactoryMethodLinear=void 0;np.prototype.InterpolantFactoryMethodSmooth=void 0;class V2 extends qa{}V2.prototype.ValueTypeName="color";class Hh extends qa{}Hh.prototype.ValueTypeName="number";class G6 extends iv{constructor(e,n,r,i){super(e,n,r,i)}interpolate_(e,n,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(r-n)/(i-n);let c=e*a;for(let d=c+a;c!==d;c+=4)qt.slerpFlat(s,0,o,c-a,o,c,l);return s}}class Vh extends qa{InterpolantFactoryMethodLinear(e){return new G6(this.times,this.values,this.getValueSize(),e)}}Vh.prototype.ValueTypeName="quaternion";Vh.prototype.InterpolantFactoryMethodSmooth=void 0;class rp extends qa{constructor(e,n,r){super(e,n,r)}}rp.prototype.ValueTypeName="string";rp.prototype.ValueBufferType=Array;rp.prototype.DefaultInterpolation=Ig;rp.prototype.InterpolantFactoryMethodLinear=void 0;rp.prototype.InterpolantFactoryMethodSmooth=void 0;class Gh extends qa{}Gh.prototype.ValueTypeName="vector";class Dg{constructor(e="",n=-1,r=[],i=qS){this.name=e,this.tracks=r,this.duration=n,this.blendMode=i,this.uuid=So(),this.duration<0&&this.resetDuration()}static parse(e){const n=[],r=e.tracks,i=1/(e.fps||1);for(let o=0,a=r.length;o!==a;++o)n.push(Xye(r[o]).scale(i));const s=new this(e.name,e.duration,n,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const n=[],r=e.tracks,i={name:e.name,duration:e.duration,tracks:n,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=r.length;s!==o;++s)n.push(qa.toJSON(r[s]));return i}static CreateFromMorphTargetSequence(e,n,r,i){const s=n.length,o=[];for(let a=0;a<s;a++){let l=[],c=[];l.push((a+s-1)%s,a,(a+1)%s),c.push(0,1,0);const d=B6(l);l=ZC(l,1,d),c=ZC(c,1,d),!i&&l[0]===0&&(l.push(s),c.push(c[0])),o.push(new Hh(".morphTargetInfluences["+n[a].name+"]",l,c).scale(1/r))}return new this(e,-1,o)}static findByName(e,n){let r=e;if(!Array.isArray(e)){const i=e;r=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<r.length;i++)if(r[i].name===n)return r[i];return null}static CreateClipsFromMorphTargetSequences(e,n,r){const i={},s=/^([\w-]*?)([\d]+)$/;for(let a=0,l=e.length;a<l;a++){const c=e[a],d=c.name.match(s);if(d&&d.length>1){const f=d[1];let m=i[f];m||(i[f]=m=[]),m.push(c)}}const o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],n,r));return o}static parseAnimation(e,n){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const r=function(f,m,y,x,S){if(y.length!==0){const _=[],w=[];B2(y,_,w,x),_.length!==0&&S.push(new f(m,_,w))}},i=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let f=0;f<c.length;f++){const m=c[f].keys;if(!(!m||m.length===0))if(m[0].morphTargets){const y={};let x;for(x=0;x<m.length;x++)if(m[x].morphTargets)for(let S=0;S<m[x].morphTargets.length;S++)y[m[x].morphTargets[S]]=-1;for(const S in y){const _=[],w=[];for(let A=0;A!==m[x].morphTargets.length;++A){const T=m[x];_.push(T.time),w.push(T.morphTarget===S?1:0)}i.push(new Hh(".morphTargetInfluence["+S+"]",_,w))}l=y.length*o}else{const y=".bones["+n[f].name+"]";r(Gh,y+".position",m,"pos",i),r(Vh,y+".quaternion",m,"rot",i),r(Gh,y+".scale",m,"scl",i)}}return i.length===0?null:new this(s,l,i,a)}resetDuration(){const e=this.tracks;let n=0;for(let r=0,i=e.length;r!==i;++r){const s=this.tracks[r];n=Math.max(n,s.times[s.times.length-1])}return this.duration=n,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let n=0;n<this.tracks.length;n++)e=e&&this.tracks[n].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let n=0;n<this.tracks.length;n++)e.push(this.tracks[n].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function $ye(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Hh;case"vector":case"vector2":case"vector3":case"vector4":return Gh;case"color":return V2;case"quaternion":return Vh;case"bool":case"boolean":return np;case"string":return rp}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}function Xye(t){if(t.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=$ye(t.type);if(t.times===void 0){const n=[],r=[];B2(t.keys,n,r,"value"),t.times=n,t.values=r}return e.parse!==void 0?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}const zc={enabled:!1,files:{},add:function(t,e){this.enabled!==!1&&(this.files[t]=e)},get:function(t){if(this.enabled!==!1)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class G2{constructor(e,n,r){const i=this;let s=!1,o=0,a=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=n,this.onError=r,this.itemStart=function(d){a++,s===!1&&i.onStart!==void 0&&i.onStart(d,o,a),s=!0},this.itemEnd=function(d){o++,i.onProgress!==void 0&&i.onProgress(d,o,a),o===a&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(d){i.onError!==void 0&&i.onError(d)},this.resolveURL=function(d){return l?l(d):d},this.setURLModifier=function(d){return l=d,this},this.addHandler=function(d,f){return c.push(d,f),this},this.removeHandler=function(d){const f=c.indexOf(d);return f!==-1&&c.splice(f,2),this},this.getHandler=function(d){for(let f=0,m=c.length;f<m;f+=2){const y=c[f],x=c[f+1];if(y.global&&(y.lastIndex=0),y.test(d))return x}return null}}}const W6=new G2;class Rs{constructor(e){this.manager=e!==void 0?e:W6,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,n){const r=this;return new Promise(function(i,s){r.load(e,i,n,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}Rs.DEFAULT_MATERIAL_NAME="__DEFAULT";const Tc={};class qye extends Error{constructor(e,n){super(e),this.response=n}}class Ga extends Rs{constructor(e){super(e)}load(e,n,r,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=zc.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{n&&n(s),this.manager.itemEnd(e)},0),s;if(Tc[e]!==void 0){Tc[e].push({onLoad:n,onProgress:r,onError:i});return}Tc[e]=[],Tc[e].push({onLoad:n,onProgress:r,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const d=Tc[e],f=c.body.getReader(),m=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),y=m?parseInt(m):0,x=y!==0;let S=0;const _=new ReadableStream({start(w){A();function A(){f.read().then(({done:T,value:C})=>{if(T)w.close();else{S+=C.byteLength;const O=new ProgressEvent("progress",{lengthComputable:x,loaded:S,total:y});for(let N=0,D=d.length;N<D;N++){const F=d[N];F.onProgress&&F.onProgress(O)}w.enqueue(C),A()}},T=>{w.error(T)})}}});return new Response(_)}else throw new qye(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(d=>new DOMParser().parseFromString(d,a));case"json":return c.json();default:if(a===void 0)return c.text();{const f=/charset="?([^;"\s]*)"?/i.exec(a),m=f&&f[1]?f[1].toLowerCase():void 0,y=new TextDecoder(m);return c.arrayBuffer().then(x=>y.decode(x))}}}).then(c=>{zc.add(e,c);const d=Tc[e];delete Tc[e];for(let f=0,m=d.length;f<m;f++){const y=d[f];y.onLoad&&y.onLoad(c)}}).catch(c=>{const d=Tc[e];if(d===void 0)throw this.manager.itemError(e),c;delete Tc[e];for(let f=0,m=d.length;f<m;f++){const y=d[f];y.onError&&y.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class Kye extends Rs{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new Ga(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{n(s.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},r,i)}parse(e){const n=[];for(let r=0;r<e.length;r++){const i=Dg.parse(e[r]);n.push(i)}return n}}class Yye extends Rs{constructor(e){super(e)}load(e,n,r,i){const s=this,o=[],a=new rM,l=new Ga(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(s.withCredentials);let c=0;function d(f){l.load(e[f],function(m){const y=s.parse(m,!0);o[f]={width:y.width,height:y.height,format:y.format,mipmaps:y.mipmaps},c+=1,c===6&&(y.mipmapCount===1&&(a.minFilter=Cr),a.image=o,a.format=y.format,a.needsUpdate=!0,n&&n(a))},r,i)}if(Array.isArray(e))for(let f=0,m=e.length;f<m;++f)d(f);else l.load(e,function(f){const m=s.parse(f,!0);if(m.isCubemap){const y=m.mipmaps.length/m.mipmapCount;for(let x=0;x<y;x++){o[x]={mipmaps:[]};for(let S=0;S<m.mipmapCount;S++)o[x].mipmaps.push(m.mipmaps[x*m.mipmapCount+S]),o[x].format=m.format,o[x].width=m.width,o[x].height=m.height}a.image=o}else a.image.width=m.width,a.image.height=m.height,a.mipmaps=m.mipmaps;m.mipmapCount===1&&(a.minFilter=Cr),a.format=m.format,a.needsUpdate=!0,n&&n(a)},r,i);return a}}class Ug extends Rs{constructor(e){super(e)}load(e,n,r,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=zc.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){n&&n(o),s.manager.itemEnd(e)},0),o;const a=Iy("img");function l(){d(),zc.add(e,this),n&&n(this),s.manager.itemEnd(e)}function c(f){d(),i&&i(f),s.manager.itemError(e),s.manager.itemEnd(e)}function d(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}}class Zye extends Rs{constructor(e){super(e)}load(e,n,r,i){const s=new ux;s.colorSpace=ji;const o=new Ug(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function l(c){o.load(e[c],function(d){s.images[c]=d,a++,a===6&&(s.needsUpdate=!0,n&&n(s))},void 0,i)}for(let c=0;c<e.length;++c)l(c);return s}}class Qye extends Rs{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new Pl,a=new Ga(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(s.withCredentials),a.load(e,function(l){let c;try{c=s.parse(l)}catch(d){if(i!==void 0)i(d);else{console.error(d);return}}c.image!==void 0?o.image=c.image:c.data!==void 0&&(o.image.width=c.width,o.image.height=c.height,o.image.data=c.data),o.wrapS=c.wrapS!==void 0?c.wrapS:_o,o.wrapT=c.wrapT!==void 0?c.wrapT:_o,o.magFilter=c.magFilter!==void 0?c.magFilter:Cr,o.minFilter=c.minFilter!==void 0?c.minFilter:Cr,o.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.colorSpace!==void 0&&(o.colorSpace=c.colorSpace),c.flipY!==void 0&&(o.flipY=c.flipY),c.format!==void 0&&(o.format=c.format),c.type!==void 0&&(o.type=c.type),c.mipmaps!==void 0&&(o.mipmaps=c.mipmaps,o.minFilter=qo),c.mipmapCount===1&&(o.minFilter=Cr),c.generateMipmaps!==void 0&&(o.generateMipmaps=c.generateMipmaps),o.needsUpdate=!0,n&&n(o,c)},r,i),o}}class $6 extends Rs{constructor(e){super(e)}load(e,n,r,i){const s=new dr,o=new Ug(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,n!==void 0&&n(s)},r,i),s}}class Od extends mn{constructor(e,n=1){super(),this.isLight=!0,this.type="Light",this.color=new ot(e),this.intensity=n}dispose(){}copy(e,n){return super.copy(e,n),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const n=super.toJSON(e);return n.object.color=this.color.getHex(),n.object.intensity=this.intensity,this.groundColor!==void 0&&(n.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(n.object.distance=this.distance),this.angle!==void 0&&(n.object.angle=this.angle),this.decay!==void 0&&(n.object.decay=this.decay),this.penumbra!==void 0&&(n.object.penumbra=this.penumbra),this.shadow!==void 0&&(n.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(n.object.target=this.target.uuid),n}}class X6 extends Od{constructor(e,n,r){super(e,r),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(mn.DEFAULT_UP),this.updateMatrix(),this.groundColor=new ot(n)}copy(e,n){return super.copy(e,n),this.groundColor.copy(e.groundColor),this}}const NA=new Ct,YD=new X,ZD=new X;class W2{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ve(512,512),this.map=null,this.mapPass=null,this.matrix=new Ct,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new dx,this._frameExtents=new Ve(1,1),this._viewportCount=1,this._viewports=[new Ln(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const n=this.camera,r=this.matrix;YD.setFromMatrixPosition(e.matrixWorld),n.position.copy(YD),ZD.setFromMatrixPosition(e.target.matrixWorld),n.lookAt(ZD),n.updateMatrixWorld(),NA.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(NA),r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(NA)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class Jye extends W2{constructor(){super(new Tr(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const n=this.camera,r=Og*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,s=e.distance||n.far;(r!==n.fov||i!==n.aspect||s!==n.far)&&(n.fov=r,n.aspect=i,n.far=s,n.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class $2 extends Od{constructor(e,n,r=0,i=Math.PI/3,s=0,o=2){super(e,n),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(mn.DEFAULT_UP),this.updateMatrix(),this.target=new mn,this.distance=r,this.angle=i,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new Jye}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,n){return super.copy(e,n),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const QD=new Ct,E0=new X,IA=new X;class exe extends W2{constructor(){super(new Tr(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Ve(4,2),this._viewportCount=6,this._viewports=[new Ln(2,1,1,1),new Ln(0,1,1,1),new Ln(3,1,1,1),new Ln(1,1,1,1),new Ln(3,0,1,1),new Ln(1,0,1,1)],this._cubeDirections=[new X(1,0,0),new X(-1,0,0),new X(0,0,1),new X(0,0,-1),new X(0,1,0),new X(0,-1,0)],this._cubeUps=[new X(0,1,0),new X(0,1,0),new X(0,1,0),new X(0,1,0),new X(0,0,1),new X(0,0,-1)]}updateMatrices(e,n=0){const r=this.camera,i=this.matrix,s=e.distance||r.far;s!==r.far&&(r.far=s,r.updateProjectionMatrix()),E0.setFromMatrixPosition(e.matrixWorld),r.position.copy(E0),IA.copy(r.position),IA.add(this._cubeDirections[n]),r.up.copy(this._cubeUps[n]),r.lookAt(IA),r.updateMatrixWorld(),i.makeTranslation(-E0.x,-E0.y,-E0.z),QD.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),this._frustum.setFromProjectionMatrix(QD)}}class X2 extends Od{constructor(e,n,r=0,i=2){super(e,n),this.isPointLight=!0,this.type="PointLight",this.distance=r,this.decay=i,this.shadow=new exe}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,n){return super.copy(e,n),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class txe extends W2{constructor(){super(new $c(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class q2 extends Od{constructor(e,n){super(e,n),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(mn.DEFAULT_UP),this.updateMatrix(),this.target=new mn,this.shadow=new txe}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class q6 extends Od{constructor(e,n){super(e,n),this.isAmbientLight=!0,this.type="AmbientLight"}}class K6 extends Od{constructor(e,n,r=10,i=10){super(e,n),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=r,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const n=super.toJSON(e);return n.object.width=this.width,n.object.height=this.height,n}}class Y6{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new X)}set(e){for(let n=0;n<9;n++)this.coefficients[n].copy(e[n]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,n){const r=e.x,i=e.y,s=e.z,o=this.coefficients;return n.copy(o[0]).multiplyScalar(.282095),n.addScaledVector(o[1],.488603*i),n.addScaledVector(o[2],.488603*s),n.addScaledVector(o[3],.488603*r),n.addScaledVector(o[4],1.092548*(r*i)),n.addScaledVector(o[5],1.092548*(i*s)),n.addScaledVector(o[6],.315392*(3*s*s-1)),n.addScaledVector(o[7],1.092548*(r*s)),n.addScaledVector(o[8],.546274*(r*r-i*i)),n}getIrradianceAt(e,n){const r=e.x,i=e.y,s=e.z,o=this.coefficients;return n.copy(o[0]).multiplyScalar(.886227),n.addScaledVector(o[1],2*.511664*i),n.addScaledVector(o[2],2*.511664*s),n.addScaledVector(o[3],2*.511664*r),n.addScaledVector(o[4],2*.429043*r*i),n.addScaledVector(o[5],2*.429043*i*s),n.addScaledVector(o[6],.743125*s*s-.247708),n.addScaledVector(o[7],2*.429043*r*s),n.addScaledVector(o[8],.429043*(r*r-i*i)),n}add(e){for(let n=0;n<9;n++)this.coefficients[n].add(e.coefficients[n]);return this}addScaledSH(e,n){for(let r=0;r<9;r++)this.coefficients[r].addScaledVector(e.coefficients[r],n);return this}scale(e){for(let n=0;n<9;n++)this.coefficients[n].multiplyScalar(e);return this}lerp(e,n){for(let r=0;r<9;r++)this.coefficients[r].lerp(e.coefficients[r],n);return this}equals(e){for(let n=0;n<9;n++)if(!this.coefficients[n].equals(e.coefficients[n]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,n=0){const r=this.coefficients;for(let i=0;i<9;i++)r[i].fromArray(e,n+i*3);return this}toArray(e=[],n=0){const r=this.coefficients;for(let i=0;i<9;i++)r[i].toArray(e,n+i*3);return e}static getBasisAt(e,n){const r=e.x,i=e.y,s=e.z;n[0]=.282095,n[1]=.488603*i,n[2]=.488603*s,n[3]=.488603*r,n[4]=1.092548*r*i,n[5]=1.092548*i*s,n[6]=.315392*(3*s*s-1),n[7]=1.092548*r*s,n[8]=.546274*(r*r-i*i)}}class Z6 extends Od{constructor(e=new Y6,n=1){super(void 0,n),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const n=super.toJSON(e);return n.object.sh=this.sh.toArray(),n}}class yM extends Rs{constructor(e){super(e),this.textures={}}load(e,n,r,i){const s=this,o=new Ga(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{n(s.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},r,i)}parse(e){const n=this.textures;function r(s){return n[s]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",s),n[s]}const i=this.createMaterialFromType(e.type);if(e.uuid!==void 0&&(i.uuid=e.uuid),e.name!==void 0&&(i.name=e.name),e.color!==void 0&&i.color!==void 0&&i.color.setHex(e.color),e.roughness!==void 0&&(i.roughness=e.roughness),e.metalness!==void 0&&(i.metalness=e.metalness),e.sheen!==void 0&&(i.sheen=e.sheen),e.sheenColor!==void 0&&(i.sheenColor=new ot().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(i.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(e.emissive),e.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(e.specular),e.specularIntensity!==void 0&&(i.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&i.specularColor!==void 0&&i.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(i.shininess=e.shininess),e.clearcoat!==void 0&&(i.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(i.dispersion=e.dispersion),e.iridescence!==void 0&&(i.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(i.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(i.transmission=e.transmission),e.thickness!==void 0&&(i.thickness=e.thickness),e.attenuationDistance!==void 0&&(i.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&i.attenuationColor!==void 0&&i.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(i.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(i.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(i.fog=e.fog),e.flatShading!==void 0&&(i.flatShading=e.flatShading),e.blending!==void 0&&(i.blending=e.blending),e.combine!==void 0&&(i.combine=e.combine),e.side!==void 0&&(i.side=e.side),e.shadowSide!==void 0&&(i.shadowSide=e.shadowSide),e.opacity!==void 0&&(i.opacity=e.opacity),e.transparent!==void 0&&(i.transparent=e.transparent),e.alphaTest!==void 0&&(i.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(i.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(i.depthFunc=e.depthFunc),e.depthTest!==void 0&&(i.depthTest=e.depthTest),e.depthWrite!==void 0&&(i.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(i.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(i.blendSrc=e.blendSrc),e.blendDst!==void 0&&(i.blendDst=e.blendDst),e.blendEquation!==void 0&&(i.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(i.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(i.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(i.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&i.blendColor!==void 0&&i.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(i.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(i.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(i.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(i.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(i.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(i.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(i.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(i.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(i.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(i.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(i.rotation=e.rotation),e.linewidth!==void 0&&(i.linewidth=e.linewidth),e.dashSize!==void 0&&(i.dashSize=e.dashSize),e.gapSize!==void 0&&(i.gapSize=e.gapSize),e.scale!==void 0&&(i.scale=e.scale),e.polygonOffset!==void 0&&(i.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(i.dithering=e.dithering),e.alphaToCoverage!==void 0&&(i.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(i.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(i.forceSinglePass=e.forceSinglePass),e.visible!==void 0&&(i.visible=e.visible),e.toneMapped!==void 0&&(i.toneMapped=e.toneMapped),e.userData!==void 0&&(i.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const o=e.uniforms[s];switch(i.uniforms[s]={},o.type){case"t":i.uniforms[s].value=r(o.value);break;case"c":i.uniforms[s].value=new ot().setHex(o.value);break;case"v2":i.uniforms[s].value=new Ve().fromArray(o.value);break;case"v3":i.uniforms[s].value=new X().fromArray(o.value);break;case"v4":i.uniforms[s].value=new Ln().fromArray(o.value);break;case"m3":i.uniforms[s].value=new Xt().fromArray(o.value);break;case"m4":i.uniforms[s].value=new Ct().fromArray(o.value);break;default:i.uniforms[s].value=o.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)i.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=r(e.map)),e.matcap!==void 0&&(i.matcap=r(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=r(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=r(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=r(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),i.normalScale=new Ve().fromArray(s)}return e.displacementMap!==void 0&&(i.displacementMap=r(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=r(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=r(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=r(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=r(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=r(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=r(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=r(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=r(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=r(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=r(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=r(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=r(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=r(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new Ve().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=r(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=r(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=r(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=r(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=r(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=r(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=r(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return yM.createMaterialFromType(e)}static createMaterialFromType(e){const n={ShadowMaterial:I6,SpriteMaterial:N2,RawShaderMaterial:k6,ShaderMaterial:Qo,PointsMaterial:nM,MeshPhysicalMaterial:na,MeshStandardMaterial:mx,MeshPhongMaterial:O6,MeshToonMaterial:L6,MeshNormalMaterial:D6,MeshLambertMaterial:U6,MeshDepthMaterial:C2,MeshDistanceMaterial:P2,MeshBasicMaterial:As,MeshMatcapMaterial:j6,LineDashedMaterial:F6,LineBasicMaterial:$r,Material:Gr};return new n[e]}}class Md{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),typeof TextDecoder<"u")return new TextDecoder().decode(e);let n="";for(let r=0,i=e.length;r<i;r++)n+=String.fromCharCode(e[r]);try{return decodeURIComponent(escape(n))}catch{return n}}static extractUrlBase(e){const n=e.lastIndexOf("/");return n===-1?"./":e.slice(0,n+1)}static resolveURL(e,n){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(n)&&/^\//.test(e)&&(n=n.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:n+e)}}class Q6 extends Zt{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class J6 extends Rs{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new Ga(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{n(s.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},r,i)}parse(e){const n={},r={};function i(y,x){if(n[x]!==void 0)return n[x];const _=y.interleavedBuffers[x],w=s(y,_.buffer),A=$m(_.type,w),T=new tp(A,_.stride);return T.uuid=_.uuid,n[x]=T,T}function s(y,x){if(r[x]!==void 0)return r[x];const _=y.arrayBuffers[x],w=new Uint32Array(_).buffer;return r[x]=w,w}const o=e.isInstancedBufferGeometry?new Q6:new Zt,a=e.data.index;if(a!==void 0){const y=$m(a.type,a.array);o.setIndex(new Qt(y,1))}const l=e.data.attributes;for(const y in l){const x=l[y];let S;if(x.isInterleavedBufferAttribute){const _=i(e.data,x.data);S=new Ul(_,x.itemSize,x.offset,x.normalized)}else{const _=$m(x.type,x.array),w=x.isInstancedBufferAttribute?zh:Qt;S=new w(_,x.itemSize,x.normalized)}x.name!==void 0&&(S.name=x.name),x.usage!==void 0&&S.setUsage(x.usage),o.setAttribute(y,S)}const c=e.data.morphAttributes;if(c)for(const y in c){const x=c[y],S=[];for(let _=0,w=x.length;_<w;_++){const A=x[_];let T;if(A.isInterleavedBufferAttribute){const C=i(e.data,A.data);T=new Ul(C,A.itemSize,A.offset,A.normalized)}else{const C=$m(A.type,A.array);T=new Qt(C,A.itemSize,A.normalized)}A.name!==void 0&&(T.name=A.name),S.push(T)}o.morphAttributes[y]=S}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);const f=e.data.groups||e.data.drawcalls||e.data.offsets;if(f!==void 0)for(let y=0,x=f.length;y!==x;++y){const S=f[y];o.addGroup(S.start,S.count,S.materialIndex)}const m=e.data.boundingSphere;if(m!==void 0){const y=new X;m.center!==void 0&&y.fromArray(m.center),o.boundingSphere=new Bi(y,m.radius)}return e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class nxe extends Rs{constructor(e){super(e)}load(e,n,r,i){const s=this,o=this.path===""?Md.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const a=new Ga(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){let c=null;try{c=JSON.parse(l)}catch(f){i!==void 0&&i(f),console.error("THREE:ObjectLoader: Can't parse "+e+".",f.message);return}const d=c.metadata;if(d===void 0||d.type===void 0||d.type.toLowerCase()==="geometry"){i!==void 0&&i(new Error("THREE.ObjectLoader: Can't load "+e)),console.error("THREE.ObjectLoader: Can't load "+e);return}s.parse(c,n)},r,i)}async loadAsync(e,n){const r=this,i=this.path===""?Md.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const s=new Ga(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const o=await s.loadAsync(e,n),a=JSON.parse(o),l=a.metadata;if(l===void 0||l.type===void 0||l.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await r.parseAsync(a)}parse(e,n){const r=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,i),o=this.parseImages(e.images,function(){n!==void 0&&n(c)}),a=this.parseTextures(e.textures,o),l=this.parseMaterials(e.materials,a),c=this.parseObject(e.object,s,l,a,r),d=this.parseSkeletons(e.skeletons,c);if(this.bindSkeletons(c,d),this.bindLightTargets(c),n!==void 0){let f=!1;for(const m in o)if(o[m].data instanceof HTMLImageElement){f=!0;break}f===!1&&n(c)}return c}async parseAsync(e){const n=this.parseAnimations(e.animations),r=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,r),s=await this.parseImagesAsync(e.images),o=this.parseTextures(e.textures,s),a=this.parseMaterials(e.materials,o),l=this.parseObject(e.object,i,a,o,n),c=this.parseSkeletons(e.skeletons,l);return this.bindSkeletons(l,c),this.bindLightTargets(l),l}parseShapes(e){const n={};if(e!==void 0)for(let r=0,i=e.length;r<i;r++){const s=new Th().fromJSON(e[r]);n[s.uuid]=s}return n}parseSkeletons(e,n){const r={},i={};if(n.traverse(function(s){s.isBone&&(i[s.uuid]=s)}),e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=new Id().fromJSON(e[s],i);r[a.uuid]=a}return r}parseGeometries(e,n){const r={};if(e!==void 0){const i=new J6;for(let s=0,o=e.length;s<o;s++){let a;const l=e[s];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":a=i.parse(l);break;default:l.type in KD?a=KD[l.type].fromJSON(l,n):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${l.type}"`)}a.uuid=l.uuid,l.name!==void 0&&(a.name=l.name),l.userData!==void 0&&(a.userData=l.userData),r[l.uuid]=a}}return r}parseMaterials(e,n){const r={},i={};if(e!==void 0){const s=new yM;s.setTextures(n);for(let o=0,a=e.length;o<a;o++){const l=e[o];r[l.uuid]===void 0&&(r[l.uuid]=s.parse(l)),i[l.uuid]=r[l.uuid]}}return i}parseAnimations(e){const n={};if(e!==void 0)for(let r=0;r<e.length;r++){const i=e[r],s=Dg.parse(i);n[s.uuid]=s}return n}parseImages(e,n){const r=this,i={};let s;function o(l){return r.manager.itemStart(l),s.load(l,function(){r.manager.itemEnd(l)},void 0,function(){r.manager.itemError(l),r.manager.itemEnd(l)})}function a(l){if(typeof l=="string"){const c=l,d=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:r.resourcePath+c;return o(d)}else return l.data?{data:$m(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){const l=new G2(n);s=new Ug(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,d=e.length;c<d;c++){const f=e[c],m=f.url;if(Array.isArray(m)){const y=[];for(let x=0,S=m.length;x<S;x++){const _=m[x],w=a(_);w!==null&&(w instanceof HTMLImageElement?y.push(w):y.push(new Pl(w.data,w.width,w.height)))}i[f.uuid]=new ah(y)}else{const y=a(f.url);i[f.uuid]=new ah(y)}}}return i}async parseImagesAsync(e){const n=this,r={};let i;async function s(o){if(typeof o=="string"){const a=o,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a)?a:n.resourcePath+a;return await i.loadAsync(l)}else return o.data?{data:$m(o.type,o.data),width:o.width,height:o.height}:null}if(e!==void 0&&e.length>0){i=new Ug(this.manager),i.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o<a;o++){const l=e[o],c=l.url;if(Array.isArray(c)){const d=[];for(let f=0,m=c.length;f<m;f++){const y=c[f],x=await s(y);x!==null&&(x instanceof HTMLImageElement?d.push(x):d.push(new Pl(x.data,x.width,x.height)))}r[l.uuid]=new ah(d)}else{const d=await s(l.url);r[l.uuid]=new ah(d)}}}return r}parseTextures(e,n){function r(s,o){return typeof s=="number"?s:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",s),o[s])}const i={};if(e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=e[s];a.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),n[a.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",a.image);const l=n[a.image],c=l.data;let d;Array.isArray(c)?(d=new ux,c.length===6&&(d.needsUpdate=!0)):(c&&c.data?d=new Pl:d=new dr,c&&(d.needsUpdate=!0)),d.source=l,d.uuid=a.uuid,a.name!==void 0&&(d.name=a.name),a.mapping!==void 0&&(d.mapping=r(a.mapping,rxe)),a.channel!==void 0&&(d.channel=a.channel),a.offset!==void 0&&d.offset.fromArray(a.offset),a.repeat!==void 0&&d.repeat.fromArray(a.repeat),a.center!==void 0&&d.center.fromArray(a.center),a.rotation!==void 0&&(d.rotation=a.rotation),a.wrap!==void 0&&(d.wrapS=r(a.wrap[0],JD),d.wrapT=r(a.wrap[1],JD)),a.format!==void 0&&(d.format=a.format),a.internalFormat!==void 0&&(d.internalFormat=a.internalFormat),a.type!==void 0&&(d.type=a.type),a.colorSpace!==void 0&&(d.colorSpace=a.colorSpace),a.minFilter!==void 0&&(d.minFilter=r(a.minFilter,eU)),a.magFilter!==void 0&&(d.magFilter=r(a.magFilter,eU)),a.anisotropy!==void 0&&(d.anisotropy=a.anisotropy),a.flipY!==void 0&&(d.flipY=a.flipY),a.generateMipmaps!==void 0&&(d.generateMipmaps=a.generateMipmaps),a.premultiplyAlpha!==void 0&&(d.premultiplyAlpha=a.premultiplyAlpha),a.unpackAlignment!==void 0&&(d.unpackAlignment=a.unpackAlignment),a.compareFunction!==void 0&&(d.compareFunction=a.compareFunction),a.userData!==void 0&&(d.userData=a.userData),i[a.uuid]=d}return i}parseObject(e,n,r,i,s){let o;function a(m){return n[m]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",m),n[m]}function l(m){if(m!==void 0){if(Array.isArray(m)){const y=[];for(let x=0,S=m.length;x<S;x++){const _=m[x];r[_]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",_),y.push(r[_])}return y}return r[m]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",m),r[m]}}function c(m){return i[m]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",m),i[m]}let d,f;switch(e.type){case"Scene":o=new R2,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new ot(e.background):o.background=c(e.background)),e.environment!==void 0&&(o.environment=c(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?o.fog=new JS(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new QS(e.fog.color,e.fog.density)),e.fog.name!==""&&(o.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(o.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(o.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&o.backgroundRotation.fromArray(e.backgroundRotation),e.environmentIntensity!==void 0&&(o.environmentIntensity=e.environmentIntensity),e.environmentRotation!==void 0&&o.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":o=new Tr(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(o.focus=e.focus),e.zoom!==void 0&&(o.zoom=e.zoom),e.filmGauge!==void 0&&(o.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(o.filmOffset=e.filmOffset),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"OrthographicCamera":o=new $c(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(o.zoom=e.zoom),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"AmbientLight":o=new q6(e.color,e.intensity);break;case"DirectionalLight":o=new q2(e.color,e.intensity),o.target=e.target||"";break;case"PointLight":o=new X2(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new K6(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new $2(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),o.target=e.target||"";break;case"HemisphereLight":o=new X6(e.color,e.groundColor,e.intensity);break;case"LightProbe":o=new Z6().fromJSON(e);break;case"SkinnedMesh":d=a(e.geometry),f=l(e.material),o=new eM(d,f),e.bindMode!==void 0&&(o.bindMode=e.bindMode),e.bindMatrix!==void 0&&o.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(o.skeleton=e.skeleton);break;case"Mesh":d=a(e.geometry),f=l(e.material),o=new yr(d,f);break;case"InstancedMesh":d=a(e.geometry),f=l(e.material);const m=e.count,y=e.instanceMatrix,x=e.instanceColor;o=new I2(d,f,m),o.instanceMatrix=new zh(new Float32Array(y.array),16),x!==void 0&&(o.instanceColor=new zh(new Float32Array(x.array),x.itemSize));break;case"BatchedMesh":d=a(e.geometry),f=l(e.material),o=new _6(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,f),o.geometry=d,o.perObjectFrustumCulled=e.perObjectFrustumCulled,o.sortObjects=e.sortObjects,o._drawRanges=e.drawRanges,o._reservedRanges=e.reservedRanges,o._visibility=e.visibility,o._active=e.active,o._bounds=e.bounds.map(S=>{const _=new os;_.min.fromArray(S.boxMin),_.max.fromArray(S.boxMax);const w=new Bi;return w.radius=S.sphereRadius,w.center.fromArray(S.sphereCenter),{boxInitialized:S.boxInitialized,box:_,sphereInitialized:S.sphereInitialized,sphere:w}}),o._maxInstanceCount=e.maxInstanceCount,o._maxVertexCount=e.maxVertexCount,o._maxIndexCount=e.maxIndexCount,o._geometryInitialized=e.geometryInitialized,o._geometryCount=e.geometryCount,o._matricesTexture=c(e.matricesTexture.uuid),e.colorsTexture!==void 0&&(o._colorsTexture=c(e.colorsTexture.uuid));break;case"LOD":o=new b6;break;case"Line":o=new jl(a(e.geometry),l(e.material));break;case"LineLoop":o=new k2(a(e.geometry),l(e.material));break;case"LineSegments":o=new Js(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":o=new O2(a(e.geometry),l(e.material));break;case"Sprite":o=new x6(l(e.material));break;case"Group":o=new Ts;break;case"Bone":o=new tM;break;default:o=new mn}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.up!==void 0&&o.up.fromArray(e.up),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(o.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){const m=e.children;for(let y=0;y<m.length;y++)o.add(this.parseObject(m[y],n,r,i,s))}if(e.animations!==void 0){const m=e.animations;for(let y=0;y<m.length;y++){const x=m[y];o.animations.push(s[x])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(o.autoUpdate=e.autoUpdate);const m=e.levels;for(let y=0;y<m.length;y++){const x=m[y],S=o.getObjectByProperty("uuid",x.object);S!==void 0&&o.addLevel(S,x.distance,x.hysteresis)}}return o}bindSkeletons(e,n){Object.keys(n).length!==0&&e.traverse(function(r){if(r.isSkinnedMesh===!0&&r.skeleton!==void 0){const i=n[r.skeleton];i===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",r.skeleton):r.bind(i,r.bindMatrix)}})}bindLightTargets(e){e.traverse(function(n){if(n.isDirectionalLight||n.isSpotLight){const r=n.target,i=e.getObjectByProperty("uuid",r);i!==void 0?n.target=i:n.target=new mn}})}}const rxe={UVMapping:zS,CubeReflectionMapping:Jc,CubeRefractionMapping:Cd,EquirectangularReflectionMapping:My,EquirectangularRefractionMapping:Ey,CubeUVReflectionMapping:Jg},JD={RepeatWrapping:Pd,ClampToEdgeWrapping:_o,MirroredRepeatWrapping:Rg},eU={NearestFilter:ri,NearestMipmapNearestFilter:BS,NearestMipmapLinearFilter:ih,LinearFilter:Cr,LinearMipmapNearestFilter:tg,LinearMipmapLinearFilter:qo};class eG extends Rs{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,n,r,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=zc.get(e);if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(c=>{n&&n(c),s.manager.itemEnd(e)}).catch(c=>{i&&i(c)});return}return setTimeout(function(){n&&n(o),s.manager.itemEnd(e)},0),o}const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader;const l=fetch(e,a).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return zc.add(e,c),n&&n(c),s.manager.itemEnd(e),c}).catch(function(c){i&&i(c),zc.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});zc.add(e,l),s.manager.itemStart(e)}}let __;class K2{static getContext(){return __===void 0&&(__=new(window.AudioContext||window.webkitAudioContext)),__}static setContext(e){__=e}}class ixe extends Rs{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new Ga(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{const c=l.slice(0);K2.getContext().decodeAudioData(c,function(f){n(f)}).catch(a)}catch(c){a(c)}},r,i);function a(l){i?i(l):console.error(l),s.manager.itemError(e)}}}const tU=new Ct,nU=new Ct,Of=new Ct;class sxe{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Tr,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Tr,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const n=this._cache;if(n.focus!==e.focus||n.fov!==e.fov||n.aspect!==e.aspect*this.aspect||n.near!==e.near||n.far!==e.far||n.zoom!==e.zoom||n.eyeSep!==this.eyeSep){n.focus=e.focus,n.fov=e.fov,n.aspect=e.aspect*this.aspect,n.near=e.near,n.far=e.far,n.zoom=e.zoom,n.eyeSep=this.eyeSep,Of.copy(e.projectionMatrix);const i=n.eyeSep/2,s=i*n.near/n.focus,o=n.near*Math.tan(Eh*n.fov*.5)/n.zoom;let a,l;nU.elements[12]=-i,tU.elements[12]=i,a=-o*n.aspect+s,l=o*n.aspect+s,Of.elements[0]=2*n.near/(l-a),Of.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(Of),a=-o*n.aspect-s,l=o*n.aspect-s,Of.elements[0]=2*n.near/(l-a),Of.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(Of)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(nU),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(tU)}}class Y2{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=rU(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const n=rU();e=(n-this.oldTime)/1e3,this.oldTime=n,this.elapsedTime+=e}return e}}function rU(){return performance.now()}const Lf=new X,iU=new qt,oxe=new X,Df=new X;class axe extends mn{constructor(){super(),this.type="AudioListener",this.context=K2.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Y2}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const n=this.context.listener,r=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Lf,iU,oxe),Df.set(0,0,-1).applyQuaternion(iU),n.positionX){const i=this.context.currentTime+this.timeDelta;n.positionX.linearRampToValueAtTime(Lf.x,i),n.positionY.linearRampToValueAtTime(Lf.y,i),n.positionZ.linearRampToValueAtTime(Lf.z,i),n.forwardX.linearRampToValueAtTime(Df.x,i),n.forwardY.linearRampToValueAtTime(Df.y,i),n.forwardZ.linearRampToValueAtTime(Df.z,i),n.upX.linearRampToValueAtTime(r.x,i),n.upY.linearRampToValueAtTime(r.y,i),n.upZ.linearRampToValueAtTime(r.z,i)}else n.setPosition(Lf.x,Lf.y,Lf.z),n.setOrientation(Df.x,Df.y,Df.z,r.x,r.y,r.z)}}let tG=class extends mn{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const n=this.context.createBufferSource();return n.buffer=this.buffer,n.loop=this.loop,n.loopStart=this.loopStart,n.loopEnd=this.loopEnd,n.onended=this.onEnded.bind(this),n.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=n,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,n=this.filters.length;e<n;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,n=this.filters.length;e<n;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}};const Uf=new X,sU=new qt,lxe=new X,jf=new X;class cxe extends tG{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){super.connect(),this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,n,r){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=n,this.panner.coneOuterGain=r,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(Uf,sU,lxe),jf.set(0,0,1).applyQuaternion(sU);const n=this.panner;if(n.positionX){const r=this.context.currentTime+this.listener.timeDelta;n.positionX.linearRampToValueAtTime(Uf.x,r),n.positionY.linearRampToValueAtTime(Uf.y,r),n.positionZ.linearRampToValueAtTime(Uf.z,r),n.orientationX.linearRampToValueAtTime(jf.x,r),n.orientationY.linearRampToValueAtTime(jf.y,r),n.orientationZ.linearRampToValueAtTime(jf.z,r)}else n.setPosition(Uf.x,Uf.y,Uf.z),n.setOrientation(jf.x,jf.y,jf.z)}}class uxe{constructor(e,n=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=n,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const n=this.getFrequencyData();for(let r=0;r<n.length;r++)e+=n[r];return e/n.length}}class nG{constructor(e,n,r){this.binding=e,this.valueSize=r;let i,s,o;switch(n){case"quaternion":i=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(r*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(r*5);break;default:i=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(r*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,n){const r=this.buffer,i=this.valueSize,s=e*i+i;let o=this.cumulativeWeight;if(o===0){for(let a=0;a!==i;++a)r[s+a]=r[a];o=n}else{o+=n;const a=n/o;this._mixBufferRegion(r,s,0,a,i)}this.cumulativeWeight=o}accumulateAdditive(e){const n=this.buffer,r=this.valueSize,i=r*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(n,i,0,e,r),this.cumulativeWeightAdditive+=e}apply(e){const n=this.valueSize,r=this.buffer,i=e*n+n,s=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=n*this._origIndex;this._mixBufferRegion(r,i,l,1-s,n)}o>0&&this._mixBufferRegionAdditive(r,i,this._addIndex*n,1,n);for(let l=n,c=n+n;l!==c;++l)if(r[l]!==r[l+n]){a.setValue(r,i);break}}saveOriginalState(){const e=this.binding,n=this.buffer,r=this.valueSize,i=r*this._origIndex;e.getValue(n,i);for(let s=r,o=i;s!==o;++s)n[s]=n[i+s%r];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,n=e+this.valueSize;for(let r=e;r<n;r++)this.buffer[r]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,n=this._addIndex*this.valueSize;for(let r=0;r<this.valueSize;r++)this.buffer[n+r]=this.buffer[e+r]}_select(e,n,r,i,s){if(i>=.5)for(let o=0;o!==s;++o)e[n+o]=e[r+o]}_slerp(e,n,r,i){qt.slerpFlat(e,n,e,n,e,r,i)}_slerpAdditive(e,n,r,i,s){const o=this._workIndex*s;qt.multiplyQuaternionsFlat(e,o,e,n,e,r),qt.slerpFlat(e,n,e,n,e,o,i)}_lerp(e,n,r,i,s){const o=1-i;for(let a=0;a!==s;++a){const l=n+a;e[l]=e[l]*o+e[r+a]*i}}_lerpAdditive(e,n,r,i,s){for(let o=0;o!==s;++o){const a=n+o;e[a]=e[a]+e[r+o]*i}}}const Z2="\\[\\]\\.:\\/",dxe=new RegExp("["+Z2+"]","g"),Q2="[^"+Z2+"]",fxe="[^"+Z2.replace("\\.","")+"]",hxe=/((?:WC+[\/:])*)/.source.replace("WC",Q2),pxe=/(WCOD+)?/.source.replace("WCOD",fxe),mxe=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Q2),gxe=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Q2),vxe=new RegExp("^"+hxe+pxe+mxe+gxe+"$"),yxe=["material","materials","bones","map"];class xxe{constructor(e,n,r){const i=r||Nn.parseTrackName(n);this._targetGroup=e,this._bindings=e.subscribe_(n,i)}getValue(e,n){this.bind();const r=this._targetGroup.nCachedObjects_,i=this._bindings[r];i!==void 0&&i.getValue(e,n)}setValue(e,n){const r=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=r.length;i!==s;++i)r[i].setValue(e,n)}bind(){const e=this._bindings;for(let n=this._targetGroup.nCachedObjects_,r=e.length;n!==r;++n)e[n].bind()}unbind(){const e=this._bindings;for(let n=this._targetGroup.nCachedObjects_,r=e.length;n!==r;++n)e[n].unbind()}}class Nn{constructor(e,n,r){this.path=n,this.parsedPath=r||Nn.parseTrackName(n),this.node=Nn.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,n,r){return e&&e.isAnimationObjectGroup?new Nn.Composite(e,n,r):new Nn(e,n,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(dxe,"")}static parseTrackName(e){const n=vxe.exec(e);if(n===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const r={nodeName:n[2],objectName:n[3],objectIndex:n[4],propertyName:n[5],propertyIndex:n[6]},i=r.nodeName&&r.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=r.nodeName.substring(i+1);yxe.indexOf(s)!==-1&&(r.nodeName=r.nodeName.substring(0,i),r.objectName=s)}if(r.propertyName===null||r.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,n){if(n===void 0||n===""||n==="."||n===-1||n===e.name||n===e.uuid)return e;if(e.skeleton){const r=e.skeleton.getBoneByName(n);if(r!==void 0)return r}if(e.children){const r=function(s){for(let o=0;o<s.length;o++){const a=s[o];if(a.name===n||a.uuid===n)return a;const l=r(a.children);if(l)return l}return null},i=r(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,n){e[n]=this.targetObject[this.propertyName]}_getValue_array(e,n){const r=this.resolvedProperty;for(let i=0,s=r.length;i!==s;++i)e[n++]=r[i]}_getValue_arrayElement(e,n){e[n]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,n){this.resolvedProperty.toArray(e,n)}_setValue_direct(e,n){this.targetObject[this.propertyName]=e[n]}_setValue_direct_setNeedsUpdate(e,n){this.targetObject[this.propertyName]=e[n],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,n){this.targetObject[this.propertyName]=e[n],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,n){const r=this.resolvedProperty;for(let i=0,s=r.length;i!==s;++i)r[i]=e[n++]}_setValue_array_setNeedsUpdate(e,n){const r=this.resolvedProperty;for(let i=0,s=r.length;i!==s;++i)r[i]=e[n++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,n){const r=this.resolvedProperty;for(let i=0,s=r.length;i!==s;++i)r[i]=e[n++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,n){this.resolvedProperty[this.propertyIndex]=e[n]}_setValue_arrayElement_setNeedsUpdate(e,n){this.resolvedProperty[this.propertyIndex]=e[n],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,n){this.resolvedProperty[this.propertyIndex]=e[n],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,n){this.resolvedProperty.fromArray(e,n)}_setValue_fromArray_setNeedsUpdate(e,n){this.resolvedProperty.fromArray(e,n),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,n){this.resolvedProperty.fromArray(e,n),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,n){this.bind(),this.getValue(e,n)}_setValue_unbound(e,n){this.bind(),this.setValue(e,n)}bind(){let e=this.node;const n=this.parsedPath,r=n.objectName,i=n.propertyName;let s=n.propertyIndex;if(e||(e=Nn.findNode(this.rootNode,n.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(r){let c=n.objectIndex;switch(r){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let d=0;d<e.length;d++)if(e[d].name===c){c=d;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[r]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[r]}if(c!==void 0){if(e[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}const o=e[i];if(o===void 0){const c=n.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+i+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?a=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(l=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Nn.Composite=xxe;Nn.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Nn.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Nn.prototype.GetterByBindingType=[Nn.prototype._getValue_direct,Nn.prototype._getValue_array,Nn.prototype._getValue_arrayElement,Nn.prototype._getValue_toArray];Nn.prototype.SetterByBindingTypeAndVersioning=[[Nn.prototype._setValue_direct,Nn.prototype._setValue_direct_setNeedsUpdate,Nn.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Nn.prototype._setValue_array,Nn.prototype._setValue_array_setNeedsUpdate,Nn.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Nn.prototype._setValue_arrayElement,Nn.prototype._setValue_arrayElement_setNeedsUpdate,Nn.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Nn.prototype._setValue_fromArray,Nn.prototype._setValue_fromArray_setNeedsUpdate,Nn.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class bxe{constructor(){this.isAnimationObjectGroup=!0,this.uuid=So(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let r=0,i=arguments.length;r!==i;++r)e[arguments[r].uuid]=r;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const n=this;this.stats={objects:{get total(){return n._objects.length},get inUse(){return this.total-n.nCachedObjects_}},get bindingsPerObject(){return n._bindings.length}}}add(){const e=this._objects,n=this._indicesByUUID,r=this._paths,i=this._parsedPaths,s=this._bindings,o=s.length;let a,l=e.length,c=this.nCachedObjects_;for(let d=0,f=arguments.length;d!==f;++d){const m=arguments[d],y=m.uuid;let x=n[y];if(x===void 0){x=l++,n[y]=x,e.push(m);for(let S=0,_=o;S!==_;++S)s[S].push(new Nn(m,r[S],i[S]))}else if(x<c){a=e[x];const S=--c,_=e[S];n[_.uuid]=x,e[x]=_,n[y]=S,e[S]=m;for(let w=0,A=o;w!==A;++w){const T=s[w],C=T[S];let O=T[x];T[x]=C,O===void 0&&(O=new Nn(m,r[w],i[w])),T[S]=O}}else e[x]!==a&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=c}remove(){const e=this._objects,n=this._indicesByUUID,r=this._bindings,i=r.length;let s=this.nCachedObjects_;for(let o=0,a=arguments.length;o!==a;++o){const l=arguments[o],c=l.uuid,d=n[c];if(d!==void 0&&d>=s){const f=s++,m=e[f];n[m.uuid]=d,e[d]=m,n[c]=f,e[f]=l;for(let y=0,x=i;y!==x;++y){const S=r[y],_=S[f],w=S[d];S[d]=_,S[f]=w}}}this.nCachedObjects_=s}uncache(){const e=this._objects,n=this._indicesByUUID,r=this._bindings,i=r.length;let s=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){const c=arguments[a],d=c.uuid,f=n[d];if(f!==void 0)if(delete n[d],f<s){const m=--s,y=e[m],x=--o,S=e[x];n[y.uuid]=f,e[f]=y,n[S.uuid]=m,e[m]=S,e.pop();for(let _=0,w=i;_!==w;++_){const A=r[_],T=A[m],C=A[x];A[f]=T,A[m]=C,A.pop()}}else{const m=--o,y=e[m];m>0&&(n[y.uuid]=f),e[f]=y,e.pop();for(let x=0,S=i;x!==S;++x){const _=r[x];_[f]=_[m],_.pop()}}}this.nCachedObjects_=s}subscribe_(e,n){const r=this._bindingsIndicesByPath;let i=r[e];const s=this._bindings;if(i!==void 0)return s[i];const o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,d=this.nCachedObjects_,f=new Array(c);i=s.length,r[e]=i,o.push(e),a.push(n),s.push(f);for(let m=d,y=l.length;m!==y;++m){const x=l[m];f[m]=new Nn(x,e,n)}return f}unsubscribe_(e){const n=this._bindingsIndicesByPath,r=n[e];if(r!==void 0){const i=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];n[c]=r,o[r]=l,o.pop(),s[r]=s[a],s.pop(),i[r]=i[a],i.pop()}}}class rG{constructor(e,n,r=null,i=n.blendMode){this._mixer=e,this._clip=n,this._localRoot=r,this.blendMode=i;const s=n.tracks,o=s.length,a=new Array(o),l={endingStart:sh,endingEnd:sh};for(let c=0;c!==o;++c){const d=s[c].createInterpolant(null);a[c]=d,d.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=HV,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,n){return this.loop=e,this.repetitions=n,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,n,r){if(e.fadeOut(n),this.fadeIn(n),r){const i=this._clip.duration,s=e._clip.duration,o=s/i,a=i/s;e.warp(1,o,n),this.warp(a,1,n)}return this}crossFadeTo(e,n,r){return e.crossFadeFrom(this,n,r)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,n,r){const i=this._mixer,s=i.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,c=a.sampleValues;return l[0]=s,l[1]=s+r,c[0]=e/o,c[1]=n/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,n,r,i){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*r;l<0||r===0?n=0:(this._startTime=null,n=r*l)}n*=this._updateTimeScale(e);const o=this._updateTime(n),a=this._updateWeight(e);if(a>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case y2:for(let d=0,f=l.length;d!==f;++d)l[d].evaluate(o),c[d].accumulateAdditive(a);break;case qS:default:for(let d=0,f=l.length;d!==f;++d)l[d].evaluate(o),c[d].accumulate(i,a)}}}_updateWeight(e){let n=0;if(this.enabled){n=this.weight;const r=this._weightInterpolant;if(r!==null){const i=r.evaluate(e)[0];n*=i,e>r.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=n,n}_updateTimeScale(e){let n=0;if(!this.paused){n=this.timeScale;const r=this._timeScaleInterpolant;if(r!==null){const i=r.evaluate(e)[0];n*=i,e>r.parameterPositions[1]&&(this.stopWarping(),n===0?this.paused=!0:this.timeScale=n)}}return this._effectiveTimeScale=n,n}_updateTime(e){const n=this._clip.duration,r=this.loop;let i=this.time+e,s=this._loopCount;const o=r===VV;if(e===0)return s===-1?i:o&&(s&1)===1?n-i:i;if(r===BV){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=n)i=n;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),i>=n||i<0){const a=Math.floor(i/n);i-=n*a,s+=Math.abs(a);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?n:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(o&&(s&1)===1)return n-i}return i}_setEndings(e,n,r){const i=this._interpolantSettings;r?(i.endingStart=oh,i.endingEnd=oh):(e?i.endingStart=this.zeroSlopeAtStart?oh:sh:i.endingStart=Ay,n?i.endingEnd=this.zeroSlopeAtEnd?oh:sh:i.endingEnd=Ay)}_scheduleFading(e,n,r){const i=this._mixer,s=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=n,a[1]=s+e,l[1]=r,this}}const _xe=new Float32Array(1);class wxe extends Bl{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,n){const r=e._localRoot||this._root,i=e._clip.tracks,s=i.length,o=e._propertyBindings,a=e._interpolants,l=r.uuid,c=this._bindingsByRootAndName;let d=c[l];d===void 0&&(d={},c[l]=d);for(let f=0;f!==s;++f){const m=i[f],y=m.name;let x=d[y];if(x!==void 0)++x.referenceCount,o[f]=x;else{if(x=o[f],x!==void 0){x._cacheIndex===null&&(++x.referenceCount,this._addInactiveBinding(x,l,y));continue}const S=n&&n._propertyBindings[f].binding.parsedPath;x=new nG(Nn.create(r,y,S),m.ValueTypeName,m.getValueSize()),++x.referenceCount,this._addInactiveBinding(x,l,y),o[f]=x}a[f].resultBuffer=x.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const r=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,r)}const n=e._propertyBindings;for(let r=0,i=n.length;r!==i;++r){const s=n[r];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const n=e._propertyBindings;for(let r=0,i=n.length;r!==i;++r){const s=n[r];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const n=e._cacheIndex;return n!==null&&n<this._nActiveActions}_addInactiveAction(e,n,r){const i=this._actions,s=this._actionsByClip;let o=s[n];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[n]=o;else{const a=o.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=i.length,i.push(e),o.actionByRoot[r]=e}_removeInactiveAction(e){const n=this._actions,r=n[n.length-1],i=e._cacheIndex;r._cacheIndex=i,n[i]=r,n.pop(),e._cacheIndex=null;const s=e._clip.uuid,o=this._actionsByClip,a=o[s],l=a.knownActions,c=l[l.length-1],d=e._byClipCacheIndex;c._byClipCacheIndex=d,l[d]=c,l.pop(),e._byClipCacheIndex=null;const f=a.actionByRoot,m=(e._localRoot||this._root).uuid;delete f[m],l.length===0&&delete o[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const n=e._propertyBindings;for(let r=0,i=n.length;r!==i;++r){const s=n[r];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const n=this._actions,r=e._cacheIndex,i=this._nActiveActions++,s=n[i];e._cacheIndex=i,n[i]=e,s._cacheIndex=r,n[r]=s}_takeBackAction(e){const n=this._actions,r=e._cacheIndex,i=--this._nActiveActions,s=n[i];e._cacheIndex=i,n[i]=e,s._cacheIndex=r,n[r]=s}_addInactiveBinding(e,n,r){const i=this._bindingsByRootAndName,s=this._bindings;let o=i[n];o===void 0&&(o={},i[n]=o),o[r]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const n=this._bindings,r=e.binding,i=r.rootNode.uuid,s=r.path,o=this._bindingsByRootAndName,a=o[i],l=n[n.length-1],c=e._cacheIndex;l._cacheIndex=c,n[c]=l,n.pop(),delete a[s],Object.keys(a).length===0&&delete o[i]}_lendBinding(e){const n=this._bindings,r=e._cacheIndex,i=this._nActiveBindings++,s=n[i];e._cacheIndex=i,n[i]=e,s._cacheIndex=r,n[r]=s}_takeBackBinding(e){const n=this._bindings,r=e._cacheIndex,i=--this._nActiveBindings,s=n[i];e._cacheIndex=i,n[i]=e,s._cacheIndex=r,n[r]=s}_lendControlInterpolant(){const e=this._controlInterpolants,n=this._nActiveControlInterpolants++;let r=e[n];return r===void 0&&(r=new H2(new Float32Array(2),new Float32Array(2),1,_xe),r.__cacheIndex=n,e[n]=r),r}_takeBackControlInterpolant(e){const n=this._controlInterpolants,r=e.__cacheIndex,i=--this._nActiveControlInterpolants,s=n[i];e.__cacheIndex=i,n[i]=e,s.__cacheIndex=r,n[r]=s}clipAction(e,n,r){const i=n||this._root,s=i.uuid;let o=typeof e=="string"?Dg.findByName(i,e):e;const a=o!==null?o.uuid:e,l=this._actionsByClip[a];let c=null;if(r===void 0&&(o!==null?r=o.blendMode:r=qS),l!==void 0){const f=l.actionByRoot[s];if(f!==void 0&&f.blendMode===r)return f;c=l.knownActions[0],o===null&&(o=c._clip)}if(o===null)return null;const d=new rG(this,o,n,r);return this._bindAction(d,c),this._addInactiveAction(d,a,s),d}existingAction(e,n){const r=n||this._root,i=r.uuid,s=typeof e=="string"?Dg.findByName(r,e):e,o=s?s.uuid:e,a=this._actionsByClip[o];return a!==void 0&&a.actionByRoot[i]||null}stopAllAction(){const e=this._actions,n=this._nActiveActions;for(let r=n-1;r>=0;--r)e[r].stop();return this}update(e){e*=this.timeScale;const n=this._actions,r=this._nActiveActions,i=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==r;++c)n[c]._update(i,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(o);return this}setTime(e){this.time=0;for(let n=0;n<this._actions.length;n++)this._actions[n].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const n=this._actions,r=e.uuid,i=this._actionsByClip,s=i[r];if(s!==void 0){const o=s.knownActions;for(let a=0,l=o.length;a!==l;++a){const c=o[a];this._deactivateAction(c);const d=c._cacheIndex,f=n[n.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,f._cacheIndex=d,n[d]=f,n.pop(),this._removeInactiveBindingsForAction(c)}delete i[r]}}uncacheRoot(e){const n=e.uuid,r=this._actionsByClip;for(const o in r){const a=r[o].actionByRoot,l=a[n];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}const i=this._bindingsByRootAndName,s=i[n];if(s!==void 0)for(const o in s){const a=s[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,n){const r=this.existingAction(e,n);r!==null&&(this._deactivateAction(r),this._removeInactiveAction(r))}}class J2{constructor(e){this.value=e}clone(){return new J2(this.value.clone===void 0?this.value:this.value.clone())}}let Sxe=0;class Mxe extends Bl{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:Sxe++}),this.name="",this.usage=Ry,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const n=this.uniforms.indexOf(e);return n!==-1&&this.uniforms.splice(n,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(e){this.name=e.name,this.usage=e.usage;const n=e.uniforms;this.uniforms.length=0;for(let r=0,i=n.length;r<i;r++){const s=Array.isArray(n[r])?n[r]:[n[r]];for(let o=0;o<s.length;o++)this.uniforms.push(s[o].clone())}return this}clone(){return new this.constructor().copy(this)}}class Exe extends tp{constructor(e,n,r=1){super(e,n),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const n=super.clone(e);return n.meshPerAttribute=this.meshPerAttribute,n}toJSON(e){const n=super.toJSON(e);return n.isInstancedInterleavedBuffer=!0,n.meshPerAttribute=this.meshPerAttribute,n}}class QC{constructor(e,n,r,i,s){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=n,this.itemSize=r,this.elementSize=i,this.count=s,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,n){return this.type=e,this.elementSize=n,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}const oU=new Ct;class iG{constructor(e,n,r=0,i=1/0){this.ray=new Jh(e,n),this.near=r,this.far=i,this.camera=null,this.layers=new Ah,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,n){this.ray.set(e,n)}setFromCamera(e,n){n.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(n.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(n).sub(this.ray.origin).normalize(),this.camera=n):n.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(n.near+n.far)/(n.near-n.far)).unproject(n),this.ray.direction.set(0,0,-1).transformDirection(n.matrixWorld),this.camera=n):console.error("THREE.Raycaster: Unsupported camera type: "+n.type)}setFromXRController(e){return oU.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(oU),this}intersectObject(e,n=!0,r=[]){return JC(e,this,r,n),r.sort(aU),r}intersectObjects(e,n=!0,r=[]){for(let i=0,s=e.length;i<s;i++)JC(e[i],this,r,n);return r.sort(aU),r}}function aU(t,e){return t.distance-e.distance}function JC(t,e,n,r){let i=!0;if(t.layers.test(e.layers)&&t.raycast(e,n)===!1&&(i=!1),i===!0&&r===!0){const s=t.children;for(let o=0,a=s.length;o<a;o++)JC(s[o],e,n,!0)}}class eP{constructor(e=1,n=0,r=0){return this.radius=e,this.phi=n,this.theta=r,this}set(e,n,r){return this.radius=e,this.phi=n,this.theta=r,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,n,r){return this.radius=Math.sqrt(e*e+n*n+r*r),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,r),this.phi=Math.acos(Ar(n/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class Axe{constructor(e=1,n=0,r=0){return this.radius=e,this.theta=n,this.y=r,this}set(e,n,r){return this.radius=e,this.theta=n,this.y=r,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,n,r){return this.radius=Math.sqrt(e*e+r*r),this.theta=Math.atan2(e,r),this.y=n,this}clone(){return new this.constructor().copy(this)}}class eN{constructor(e,n,r,i){eN.prototype.isMatrix2=!0,this.elements=[1,0,0,1],e!==void 0&&this.set(e,n,r,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,n=0){for(let r=0;r<4;r++)this.elements[r]=e[r+n];return this}set(e,n,r,i){const s=this.elements;return s[0]=e,s[2]=n,s[1]=r,s[3]=i,this}}const lU=new Ve;class Txe{constructor(e=new Ve(1/0,1/0),n=new Ve(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=n}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromPoints(e){this.makeEmpty();for(let n=0,r=e.length;n<r;n++)this.expandByPoint(e[n]);return this}setFromCenterAndSize(e,n){const r=lU.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,n){return n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,lU).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const cU=new X,w_=new X;class Cxe{constructor(e=new X,n=new X){this.start=e,this.end=n}set(e,n){return this.start.copy(e),this.end.copy(n),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,n){return this.delta(n).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,n){cU.subVectors(e,this.start),w_.subVectors(this.end,this.start);const r=w_.dot(w_);let s=w_.dot(cU)/r;return n&&(s=Ar(s,0,1)),s}closestPointToPoint(e,n,r){const i=this.closestPointToPointParameter(e,n);return this.delta(r).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const uU=new X;class Pxe extends mn{constructor(e,n){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=n,this.type="SpotLightHelper";const r=new Zt,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,l=32;o<l;o++,a++){const c=o/l*Math.PI*2,d=a/l*Math.PI*2;i.push(Math.cos(c),Math.sin(c),1,Math.cos(d),Math.sin(d),1)}r.setAttribute("position",new kt(i,3));const s=new $r({fog:!1,toneMapped:!1});this.cone=new Js(r,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const e=this.light.distance?this.light.distance:1e3,n=e*Math.tan(this.light.angle);this.cone.scale.set(n,n,e),uU.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(uU),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const ed=new X,S_=new Ct,kA=new Ct;class Rxe extends Js{constructor(e){const n=sG(e),r=new Zt,i=[],s=[],o=new ot(0,0,1),a=new ot(0,1,0);for(let c=0;c<n.length;c++){const d=n[c];d.parent&&d.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),s.push(o.r,o.g,o.b),s.push(a.r,a.g,a.b))}r.setAttribute("position",new kt(i,3)),r.setAttribute("color",new kt(s,3));const l=new $r({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(r,l),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=n,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const n=this.bones,r=this.geometry,i=r.getAttribute("position");kA.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<n.length;s++){const a=n[s];a.parent&&a.parent.isBone&&(S_.multiplyMatrices(kA,a.matrixWorld),ed.setFromMatrixPosition(S_),i.setXYZ(o,ed.x,ed.y,ed.z),S_.multiplyMatrices(kA,a.parent.matrixWorld),ed.setFromMatrixPosition(S_),i.setXYZ(o+1,ed.x,ed.y,ed.z),o+=2)}r.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function sG(t){const e=[];t.isBone===!0&&e.push(t);for(let n=0;n<t.children.length;n++)e.push.apply(e,sG(t.children[n]));return e}class Nxe extends yr{constructor(e,n,r){const i=new px(n,4,2),s=new As({wireframe:!0,fog:!1,toneMapped:!1});super(i,s),this.light=e,this.color=r,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const Ixe=new X,dU=new ot,fU=new ot;class kxe extends mn{constructor(e,n,r){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r,this.type="HemisphereLightHelper";const i=new hx(n);i.rotateY(Math.PI*.5),this.material=new As({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=i.getAttribute("position"),o=new Float32Array(s.count*3);i.setAttribute("color",new Qt(o,3)),this.add(new yr(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const n=e.geometry.getAttribute("color");dU.copy(this.light.color),fU.copy(this.light.groundColor);for(let r=0,i=n.count;r<i;r++){const s=r<i/2?dU:fU;n.setXYZ(r,s.r,s.g,s.b)}n.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(Ixe.setFromMatrixPosition(this.light.matrixWorld).negate())}}class Oxe extends Js{constructor(e=10,n=10,r=4473924,i=8947848){r=new ot(r),i=new ot(i);const s=n/2,o=e/n,a=e/2,l=[],c=[];for(let m=0,y=0,x=-a;m<=n;m++,x+=o){l.push(-a,0,x,a,0,x),l.push(x,0,-a,x,0,a);const S=m===s?r:i;S.toArray(c,y),y+=3,S.toArray(c,y),y+=3,S.toArray(c,y),y+=3,S.toArray(c,y),y+=3}const d=new Zt;d.setAttribute("position",new kt(l,3)),d.setAttribute("color",new kt(c,3));const f=new $r({vertexColors:!0,toneMapped:!1});super(d,f),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class Lxe extends Js{constructor(e=10,n=16,r=8,i=64,s=4473924,o=8947848){s=new ot(s),o=new ot(o);const a=[],l=[];if(n>1)for(let f=0;f<n;f++){const m=f/n*(Math.PI*2),y=Math.sin(m)*e,x=Math.cos(m)*e;a.push(0,0,0),a.push(y,0,x);const S=f&1?s:o;l.push(S.r,S.g,S.b),l.push(S.r,S.g,S.b)}for(let f=0;f<r;f++){const m=f&1?s:o,y=e-e/r*f;for(let x=0;x<i;x++){let S=x/i*(Math.PI*2),_=Math.sin(S)*y,w=Math.cos(S)*y;a.push(_,0,w),l.push(m.r,m.g,m.b),S=(x+1)/i*(Math.PI*2),_=Math.sin(S)*y,w=Math.cos(S)*y,a.push(_,0,w),l.push(m.r,m.g,m.b)}}const c=new Zt;c.setAttribute("position",new kt(a,3)),c.setAttribute("color",new kt(l,3));const d=new $r({vertexColors:!0,toneMapped:!1});super(c,d),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const hU=new X,M_=new X,pU=new X;class Dxe extends mn{constructor(e,n,r){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r,this.type="DirectionalLightHelper",n===void 0&&(n=1);let i=new Zt;i.setAttribute("position",new kt([-n,n,0,n,n,0,n,-n,0,-n,-n,0,-n,n,0],3));const s=new $r({fog:!1,toneMapped:!1});this.lightPlane=new jl(i,s),this.add(this.lightPlane),i=new Zt,i.setAttribute("position",new kt([0,0,0,0,0,1],3)),this.targetLine=new jl(i,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),hU.setFromMatrixPosition(this.light.matrixWorld),M_.setFromMatrixPosition(this.light.target.matrixWorld),pU.subVectors(M_,hU),this.lightPlane.lookAt(M_),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(M_),this.targetLine.scale.z=pU.length()}}const E_=new X,wr=new cx;class Uxe extends Js{constructor(e){const n=new Zt,r=new $r({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],s=[],o={};a("n1","n2"),a("n2","n4"),a("n4","n3"),a("n3","n1"),a("f1","f2"),a("f2","f4"),a("f4","f3"),a("f3","f1"),a("n1","f1"),a("n2","f2"),a("n3","f3"),a("n4","f4"),a("p","n1"),a("p","n2"),a("p","n3"),a("p","n4"),a("u1","u2"),a("u2","u3"),a("u3","u1"),a("c","t"),a("p","c"),a("cn1","cn2"),a("cn3","cn4"),a("cf1","cf2"),a("cf3","cf4");function a(x,S){l(x),l(S)}function l(x){i.push(0,0,0),s.push(0,0,0),o[x]===void 0&&(o[x]=[]),o[x].push(i.length/3-1)}n.setAttribute("position",new kt(i,3)),n.setAttribute("color",new kt(s,3)),super(n,r),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update();const c=new ot(16755200),d=new ot(16711680),f=new ot(43775),m=new ot(16777215),y=new ot(3355443);this.setColors(c,d,f,m,y)}setColors(e,n,r,i,s){const a=this.geometry.getAttribute("color");a.setXYZ(0,e.r,e.g,e.b),a.setXYZ(1,e.r,e.g,e.b),a.setXYZ(2,e.r,e.g,e.b),a.setXYZ(3,e.r,e.g,e.b),a.setXYZ(4,e.r,e.g,e.b),a.setXYZ(5,e.r,e.g,e.b),a.setXYZ(6,e.r,e.g,e.b),a.setXYZ(7,e.r,e.g,e.b),a.setXYZ(8,e.r,e.g,e.b),a.setXYZ(9,e.r,e.g,e.b),a.setXYZ(10,e.r,e.g,e.b),a.setXYZ(11,e.r,e.g,e.b),a.setXYZ(12,e.r,e.g,e.b),a.setXYZ(13,e.r,e.g,e.b),a.setXYZ(14,e.r,e.g,e.b),a.setXYZ(15,e.r,e.g,e.b),a.setXYZ(16,e.r,e.g,e.b),a.setXYZ(17,e.r,e.g,e.b),a.setXYZ(18,e.r,e.g,e.b),a.setXYZ(19,e.r,e.g,e.b),a.setXYZ(20,e.r,e.g,e.b),a.setXYZ(21,e.r,e.g,e.b),a.setXYZ(22,e.r,e.g,e.b),a.setXYZ(23,e.r,e.g,e.b),a.setXYZ(24,n.r,n.g,n.b),a.setXYZ(25,n.r,n.g,n.b),a.setXYZ(26,n.r,n.g,n.b),a.setXYZ(27,n.r,n.g,n.b),a.setXYZ(28,n.r,n.g,n.b),a.setXYZ(29,n.r,n.g,n.b),a.setXYZ(30,n.r,n.g,n.b),a.setXYZ(31,n.r,n.g,n.b),a.setXYZ(32,r.r,r.g,r.b),a.setXYZ(33,r.r,r.g,r.b),a.setXYZ(34,r.r,r.g,r.b),a.setXYZ(35,r.r,r.g,r.b),a.setXYZ(36,r.r,r.g,r.b),a.setXYZ(37,r.r,r.g,r.b),a.setXYZ(38,i.r,i.g,i.b),a.setXYZ(39,i.r,i.g,i.b),a.setXYZ(40,s.r,s.g,s.b),a.setXYZ(41,s.r,s.g,s.b),a.setXYZ(42,s.r,s.g,s.b),a.setXYZ(43,s.r,s.g,s.b),a.setXYZ(44,s.r,s.g,s.b),a.setXYZ(45,s.r,s.g,s.b),a.setXYZ(46,s.r,s.g,s.b),a.setXYZ(47,s.r,s.g,s.b),a.setXYZ(48,s.r,s.g,s.b),a.setXYZ(49,s.r,s.g,s.b),a.needsUpdate=!0}update(){const e=this.geometry,n=this.pointMap,r=1,i=1;wr.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),kr("c",n,e,wr,0,0,-1),kr("t",n,e,wr,0,0,1),kr("n1",n,e,wr,-r,-i,-1),kr("n2",n,e,wr,r,-i,-1),kr("n3",n,e,wr,-r,i,-1),kr("n4",n,e,wr,r,i,-1),kr("f1",n,e,wr,-r,-i,1),kr("f2",n,e,wr,r,-i,1),kr("f3",n,e,wr,-r,i,1),kr("f4",n,e,wr,r,i,1),kr("u1",n,e,wr,r*.7,i*1.1,-1),kr("u2",n,e,wr,-r*.7,i*1.1,-1),kr("u3",n,e,wr,0,i*2,-1),kr("cf1",n,e,wr,-r,0,1),kr("cf2",n,e,wr,r,0,1),kr("cf3",n,e,wr,0,-i,1),kr("cf4",n,e,wr,0,i,1),kr("cn1",n,e,wr,-r,0,-1),kr("cn2",n,e,wr,r,0,-1),kr("cn3",n,e,wr,0,-i,-1),kr("cn4",n,e,wr,0,i,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function kr(t,e,n,r,i,s,o){E_.set(i,s,o).unproject(r);const a=e[t];if(a!==void 0){const l=n.getAttribute("position");for(let c=0,d=a.length;c<d;c++)l.setXYZ(a[c],E_.x,E_.y,E_.z)}}const A_=new os;class jxe extends Js{constructor(e,n=16776960){const r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),s=new Zt;s.setIndex(new Qt(r,1)),s.setAttribute("position",new Qt(i,3)),super(s,new $r({color:n,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(e!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&A_.setFromObject(this.object),A_.isEmpty())return;const n=A_.min,r=A_.max,i=this.geometry.attributes.position,s=i.array;s[0]=r.x,s[1]=r.y,s[2]=r.z,s[3]=n.x,s[4]=r.y,s[5]=r.z,s[6]=n.x,s[7]=n.y,s[8]=r.z,s[9]=r.x,s[10]=n.y,s[11]=r.z,s[12]=r.x,s[13]=r.y,s[14]=n.z,s[15]=n.x,s[16]=r.y,s[17]=n.z,s[18]=n.x,s[19]=n.y,s[20]=n.z,s[21]=r.x,s[22]=n.y,s[23]=n.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,n){return super.copy(e,n),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Fxe extends Js{constructor(e,n=16776960){const r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new Zt;s.setIndex(new Qt(r,1)),s.setAttribute("position",new kt(i,3)),super(s,new $r({color:n,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const n=this.box;n.isEmpty()||(n.getCenter(this.position),n.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class zxe extends jl{constructor(e,n=1,r=16776960){const i=r,s=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],o=new Zt;o.setAttribute("position",new kt(s,3)),o.computeBoundingSphere(),super(o,new $r({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=n;const a=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],l=new Zt;l.setAttribute("position",new kt(a,3)),l.computeBoundingSphere(),this.add(new yr(l,new As({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const mU=new X;let T_,OA;class Bxe extends mn{constructor(e=new X(0,0,1),n=new X(0,0,0),r=1,i=16776960,s=r*.2,o=s*.2){super(),this.type="ArrowHelper",T_===void 0&&(T_=new Zt,T_.setAttribute("position",new kt([0,0,0,0,1,0],3)),OA=new rv(0,.5,1,5,1),OA.translate(0,-.5,0)),this.position.copy(n),this.line=new jl(T_,new $r({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new yr(OA,new As({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(r,s,o)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{mU.set(e.z,0,-e.x).normalize();const n=Math.acos(e.y);this.quaternion.setFromAxisAngle(mU,n)}}setLength(e,n=e*.2,r=n*.2){this.line.scale.set(1,Math.max(1e-4,e-n),1),this.line.updateMatrix(),this.cone.scale.set(r,n,r),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class oG extends Js{constructor(e=1){const n=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],r=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new Zt;i.setAttribute("position",new kt(n,3)),i.setAttribute("color",new kt(r,3));const s=new $r({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,n,r){const i=new ot,s=this.geometry.attributes.color.array;return i.set(e),i.toArray(s,0),i.toArray(s,3),i.set(n),i.toArray(s,6),i.toArray(s,9),i.set(r),i.toArray(s,12),i.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Hxe{constructor(){this.type="ShapePath",this.color=new ot,this.subPaths=[],this.currentPath=null}moveTo(e,n){return this.currentPath=new ky,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,n),this}lineTo(e,n){return this.currentPath.lineTo(e,n),this}quadraticCurveTo(e,n,r,i){return this.currentPath.quadraticCurveTo(e,n,r,i),this}bezierCurveTo(e,n,r,i,s,o){return this.currentPath.bezierCurveTo(e,n,r,i,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function n(w){const A=[];for(let T=0,C=w.length;T<C;T++){const O=w[T],N=new Th;N.curves=O.curves,A.push(N)}return A}function r(w,A){const T=A.length;let C=!1;for(let O=T-1,N=0;N<T;O=N++){let D=A[O],F=A[N],V=F.x-D.x,k=F.y-D.y;if(Math.abs(k)>Number.EPSILON){if(k<0&&(D=A[N],V=-V,F=A[O],k=-k),w.y<D.y||w.y>F.y)continue;if(w.y===D.y){if(w.x===D.x)return!0}else{const j=k*(w.x-D.x)-V*(w.y-D.y);if(j===0)return!0;if(j<0)continue;C=!C}}else{if(w.y!==D.y)continue;if(F.x<=w.x&&w.x<=D.x||D.x<=w.x&&w.x<=F.x)return!0}}return C}const i=Rl.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,a,l;const c=[];if(s.length===1)return a=s[0],l=new Th,l.curves=a.curves,c.push(l),c;let d=!i(s[0].getPoints());d=e?!d:d;const f=[],m=[];let y=[],x=0,S;m[x]=void 0,y[x]=[];for(let w=0,A=s.length;w<A;w++)a=s[w],S=a.getPoints(),o=i(S),o=e?!o:o,o?(!d&&m[x]&&x++,m[x]={s:new Th,p:S},m[x].s.curves=a.curves,d&&x++,y[x]=[]):y[x].push({h:a,p:S[0]});if(!m[0])return n(s);if(m.length>1){let w=!1,A=0;for(let T=0,C=m.length;T<C;T++)f[T]=[];for(let T=0,C=m.length;T<C;T++){const O=y[T];for(let N=0;N<O.length;N++){const D=O[N];let F=!0;for(let V=0;V<m.length;V++)r(D.p,m[V].p)&&(T!==V&&A++,F?(F=!1,f[V].push(D)):w=!0);F&&f[T].push(D)}}A>0&&w===!1&&(y=f)}let _;for(let w=0,A=m.length;w<A;w++){l=m[w].s,c.push(l),_=y[w];for(let T=0,C=_.length;T<C;T++)l.holes.push(_[T].h)}return c}}class Vxe extends Bl{constructor(e,n=null){super(),this.object=e,this.domElement=n,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(){}disconnect(){}dispose(){}update(){}}class Gxe extends Va{constructor(e=1,n=1,r=1,i={}){console.warn('THREE.WebGLMultipleRenderTargets has been deprecated and will be removed in r172. Use THREE.WebGLRenderTarget and set the "count" parameter to enable MRT.'),super(e,n,{...i,count:r}),this.isWebGLMultipleRenderTargets=!0}get texture(){return this.textures}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Td}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Td);const Wxe=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:l2,AddEquation:ud,AddOperation:kV,AdditiveAnimationBlendMode:y2,AdditiveBlending:FC,AgXToneMapping:jV,AlphaFormat:f2,AlwaysCompare:e6,AlwaysDepth:Jw,AlwaysStencilFunc:VC,AmbientLight:q6,AnimationAction:rG,AnimationClip:Dg,AnimationLoader:Kye,AnimationMixer:wxe,AnimationObjectGroup:bxe,AnimationUtils:Wye,ArcCurve:w6,ArrayCamera:g6,ArrowHelper:Bxe,AttachedBindMode:HC,Audio:tG,AudioAnalyser:uxe,AudioContext:K2,AudioListener:axe,AudioLoader:ixe,AxesHelper:oG,BackSide:ss,BasicDepthPacking:WV,BasicShadowMap:hV,BatchedMesh:_6,Bone:tM,BooleanKeyframeTrack:np,Box2:Txe,Box3:os,Box3Helper:Fxe,BoxGeometry:ep,BoxHelper:jxe,BufferAttribute:Qt,BufferGeometry:Zt,BufferGeometryLoader:J6,ByteType:c2,Cache:zc,Camera:cx,CameraHelper:Uxe,CanvasTexture:mye,CapsuleGeometry:sM,CatmullRomCurve3:S6,CineonToneMapping:DV,CircleGeometry:oM,ClampToEdgeWrapping:_o,Clock:Y2,Color:ot,ColorKeyframeTrack:V2,ColorManagement:In,CompressedArrayTexture:hye,CompressedCubeTexture:pye,CompressedTexture:rM,CompressedTextureLoader:Yye,ConeGeometry:aM,ConstantAlphaFactor:RV,ConstantColorFactor:CV,Controls:Vxe,CubeCamera:l6,CubeReflectionMapping:Jc,CubeRefractionMapping:Cd,CubeTexture:ux,CubeTextureLoader:Zye,CubeUVReflectionMapping:Jg,CubicBezierCurve:D2,CubicBezierCurve3:M6,CubicInterpolant:H6,CullFaceBack:jC,CullFaceFront:fV,CullFaceFrontBack:$fe,CullFaceNone:dV,Curve:Xa,CurvePath:A6,CustomBlending:pV,CustomToneMapping:UV,CylinderGeometry:rv,Cylindrical:Axe,Data3DTexture:w2,DataArrayTexture:YS,DataTexture:Pl,DataTextureLoader:Qye,DataUtils:npe,DecrementStencilOp:rhe,DecrementWrapStencilOp:she,DefaultLoadingManager:W6,DepthFormat:Mh,DepthStencilFormat:Fh,DepthTexture:T2,DetachedBindMode:zV,DirectionalLight:q2,DirectionalLightHelper:Dxe,DiscreteInterpolant:V6,DisplayP3ColorSpace:KS,DodecahedronGeometry:lM,DoubleSide:xo,DstAlphaFactor:SV,DstColorFactor:EV,DynamicCopyUsage:xhe,DynamicDrawUsage:t6,DynamicReadUsage:ghe,EdgesGeometry:T6,EllipseCurve:iM,EqualCompare:YV,EqualDepth:t1,EqualStencilFunc:che,EquirectangularReflectionMapping:My,EquirectangularRefractionMapping:Ey,Euler:as,EventDispatcher:Bl,ExtrudeGeometry:uM,FileLoader:Ga,Float16BufferAttribute:lpe,Float32BufferAttribute:kt,FloatType:Zs,Fog:JS,FogExp2:QS,FramebufferTexture:fye,FrontSide:Dl,Frustum:dx,GLBufferAttribute:QC,GLSL1:_he,GLSL3:GC,GreaterCompare:ZV,GreaterDepth:r1,GreaterEqualCompare:JV,GreaterEqualDepth:n1,GreaterEqualStencilFunc:hhe,GreaterStencilFunc:dhe,GridHelper:Oxe,Group:Ts,HalfFloatType:ev,HemisphereLight:X6,HemisphereLightHelper:kxe,IcosahedronGeometry:dM,ImageBitmapLoader:eG,ImageLoader:Ug,ImageUtils:i6,IncrementStencilOp:nhe,IncrementWrapStencilOp:ihe,InstancedBufferAttribute:zh,InstancedBufferGeometry:Q6,InstancedInterleavedBuffer:Exe,InstancedMesh:I2,Int16BufferAttribute:ope,Int32BufferAttribute:ape,Int8BufferAttribute:rpe,IntType:HS,InterleavedBuffer:tp,InterleavedBufferAttribute:Ul,Interpolant:iv,InterpolateDiscrete:Ig,InterpolateLinear:kg,InterpolateSmooth:W_,InvertStencilOp:ohe,KeepStencilOp:Kf,KeyframeTrack:qa,LOD:b6,LatheGeometry:fx,Layers:Ah,LessCompare:KV,LessDepth:e1,LessEqualCompare:b2,LessEqualDepth:Uh,LessEqualStencilFunc:uhe,LessStencilFunc:lhe,Light:Od,LightProbe:Z6,Line:jl,Line3:Cxe,LineBasicMaterial:$r,LineCurve:U2,LineCurve3:E6,LineDashedMaterial:F6,LineLoop:k2,LineSegments:Js,LinearDisplayP3ColorSpace:lx,LinearFilter:Cr,LinearInterpolant:H2,LinearMipMapLinearFilter:Yfe,LinearMipMapNearestFilter:Kfe,LinearMipmapLinearFilter:qo,LinearMipmapNearestFilter:tg,LinearSRGBColorSpace:xi,LinearToneMapping:OV,LinearTransfer:Ty,Loader:Rs,LoaderUtils:Md,LoadingManager:G2,LoopOnce:BV,LoopPingPong:VV,LoopRepeat:HV,LuminanceAlphaFormat:m2,LuminanceFormat:p2,MOUSE:Xf,Material:Gr,MaterialLoader:yM,MathUtils:gr,Matrix2:eN,Matrix3:Xt,Matrix4:Ct,MaxEquation:yV,Mesh:yr,MeshBasicMaterial:As,MeshDepthMaterial:C2,MeshDistanceMaterial:P2,MeshLambertMaterial:U6,MeshMatcapMaterial:j6,MeshNormalMaterial:D6,MeshPhongMaterial:O6,MeshPhysicalMaterial:na,MeshStandardMaterial:mx,MeshToonMaterial:L6,MinEquation:vV,MirroredRepeatWrapping:Rg,MixOperation:IV,MultiplyBlending:BC,MultiplyOperation:ox,NearestFilter:ri,NearestMipMapLinearFilter:qfe,NearestMipMapNearestFilter:Xfe,NearestMipmapLinearFilter:ih,NearestMipmapNearestFilter:BS,NeutralToneMapping:FV,NeverCompare:qV,NeverDepth:Qw,NeverStencilFunc:ahe,NoBlending:Wc,NoColorSpace:Lc,NoToneMapping:Cl,NormalAnimationBlendMode:qS,NormalBlending:Sh,NotEqualCompare:QV,NotEqualDepth:i1,NotEqualStencilFunc:fhe,NumberKeyframeTrack:Hh,Object3D:mn,ObjectLoader:nxe,ObjectSpaceNormalMap:XV,OctahedronGeometry:hx,OneFactor:bV,OneMinusConstantAlphaFactor:NV,OneMinusConstantColorFactor:PV,OneMinusDstAlphaFactor:MV,OneMinusDstColorFactor:AV,OneMinusSrcAlphaFactor:Zw,OneMinusSrcColorFactor:wV,OrthographicCamera:$c,P3Primaries:Py,PCFShadowMap:FS,PCFSoftShadowMap:W0,PMREMGenerator:WC,Path:ky,PerspectiveCamera:Tr,Plane:Nc,PlaneGeometry:tv,PlaneHelper:zxe,PointLight:X2,PointLightHelper:Nxe,Points:O2,PointsMaterial:nM,PolarGridHelper:Lxe,PolyhedronGeometry:kd,PositionalAudio:cxe,PropertyBinding:Nn,PropertyMixer:nG,QuadraticBezierCurve:j2,QuadraticBezierCurve3:F2,Quaternion:qt,QuaternionKeyframeTrack:Vh,QuaternionLinearInterpolant:G6,RED_GREEN_RGTC2_Format:P1,RED_RGTC1_Format:v2,REVISION:Td,RGBADepthPacking:$V,RGBAFormat:is,RGBAIntegerFormat:XS,RGBA_ASTC_10x10_Format:S1,RGBA_ASTC_10x5_Format:b1,RGBA_ASTC_10x6_Format:_1,RGBA_ASTC_10x8_Format:w1,RGBA_ASTC_12x10_Format:M1,RGBA_ASTC_12x12_Format:E1,RGBA_ASTC_4x4_Format:f1,RGBA_ASTC_5x4_Format:h1,RGBA_ASTC_5x5_Format:p1,RGBA_ASTC_6x5_Format:m1,RGBA_ASTC_6x6_Format:g1,RGBA_ASTC_8x5_Format:v1,RGBA_ASTC_8x6_Format:y1,RGBA_ASTC_8x8_Format:x1,RGBA_BPTC_Format:Y0,RGBA_ETC2_EAC_Format:d1,RGBA_PVRTC_2BPPV1_Format:l1,RGBA_PVRTC_4BPPV1_Format:a1,RGBA_S3TC_DXT1_Format:X0,RGBA_S3TC_DXT3_Format:q0,RGBA_S3TC_DXT5_Format:K0,RGBDepthPacking:Qfe,RGBFormat:h2,RGBIntegerFormat:Zfe,RGB_BPTC_SIGNED_Format:A1,RGB_BPTC_UNSIGNED_Format:T1,RGB_ETC1_Format:c1,RGB_ETC2_Format:u1,RGB_PVRTC_2BPPV1_Format:o1,RGB_PVRTC_4BPPV1_Format:s1,RGB_S3TC_DXT1_Format:$0,RGDepthPacking:Jfe,RGFormat:g2,RGIntegerFormat:$S,RawShaderMaterial:k6,Ray:Jh,Raycaster:iG,Rec709Primaries:Cy,RectAreaLight:K6,RedFormat:WS,RedIntegerFormat:ax,ReinhardToneMapping:LV,RenderTarget:s6,RepeatWrapping:Pd,ReplaceStencilOp:the,ReverseSubtractEquation:gV,RingGeometry:fM,SIGNED_RED_GREEN_RGTC2_Format:R1,SIGNED_RED_RGTC1_Format:C1,SRGBColorSpace:ji,SRGBTransfer:Jn,Scene:R2,ShaderChunk:hn,ShaderLib:Da,ShaderMaterial:Qo,ShadowMaterial:I6,Shape:Th,ShapeGeometry:hM,ShapePath:Hxe,ShapeUtils:Rl,ShortType:u2,Skeleton:Id,SkeletonHelper:Rxe,SkinnedMesh:eM,Source:ah,Sphere:Bi,SphereGeometry:px,Spherical:eP,SphericalHarmonics3:Y6,SplineCurve:z2,SpotLight:$2,SpotLightHelper:Pxe,Sprite:x6,SpriteMaterial:N2,SrcAlphaFactor:Yw,SrcAlphaSaturateFactor:TV,SrcColorFactor:_V,StaticCopyUsage:yhe,StaticDrawUsage:Ry,StaticReadUsage:mhe,StereoCamera:sxe,StreamCopyUsage:bhe,StreamDrawUsage:phe,StreamReadUsage:vhe,StringKeyframeTrack:rp,SubtractEquation:mV,SubtractiveBlending:zC,TOUCH:qf,TangentSpaceNormalMap:lu,TetrahedronGeometry:pM,Texture:dr,TextureLoader:$6,TextureUtils:W0e,TorusGeometry:mM,TorusKnotGeometry:gM,Triangle:qs,TriangleFanDrawMode:N1,TriangleStripDrawMode:x2,TrianglesDrawMode:GV,TubeGeometry:vM,UVMapping:zS,Uint16BufferAttribute:S2,Uint32BufferAttribute:M2,Uint8BufferAttribute:ipe,Uint8ClampedBufferAttribute:spe,Uniform:J2,UniformsGroup:Mxe,UniformsLib:ht,UniformsUtils:E2,UnsignedByteType:Ha,UnsignedInt248Type:jh,UnsignedInt5999Type:d2,UnsignedIntType:eu,UnsignedShort4444Type:VS,UnsignedShort5551Type:GS,UnsignedShortType:Ng,VSMShadowMap:Oa,Vector2:Ve,Vector3:X,Vector4:Ln,VectorKeyframeTrack:Gh,VideoTexture:dye,WebGL3DRenderTarget:$he,WebGLArrayRenderTarget:Whe,WebGLCoordinateSystem:Ml,WebGLCubeRenderTarget:c6,WebGLMultipleRenderTargets:Gxe,WebGLRenderTarget:Va,WebGLRenderer:v6,WebGLUtils:m6,WebGPUCoordinateSystem:Ny,WireframeGeometry:N6,WrapAroundEnding:Ay,ZeroCurvatureEnding:sh,ZeroFactor:xV,ZeroSlopeEnding:oh,ZeroStencilOp:ehe,createCanvasElement:r6},Symbol.toStringTag,{value:"Module"}));var LA={exports:{}},td={};/**
|
||
* @license React
|
||
* react-reconciler-constants.production.min.js
|
||
*
|
||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var gU;function $xe(){return gU||(gU=1,td.ConcurrentRoot=1,td.ContinuousEventPriority=4,td.DefaultEventPriority=16,td.DiscreteEventPriority=1,td.IdleEventPriority=536870912,td.LegacyRoot=0),td}var vU;function Xxe(){return vU||(vU=1,LA.exports=$xe()),LA.exports}var Km=Xxe();function qxe(t){let e;const n=new Set,r=(c,d)=>{const f=typeof c=="function"?c(e):c;if(f!==e){const m=e;e=d?f:Object.assign({},e,f),n.forEach(y=>y(e,m))}},i=()=>e,s=(c,d=i,f=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let m=d(e);function y(){const x=d(e);if(!f(m,x)){const S=m;c(m=x,S)}}return n.add(y),()=>n.delete(y)},l={setState:r,getState:i,subscribe:(c,d,f)=>d||f?s(c,d,f):(n.add(c),()=>n.delete(c)),destroy:()=>n.clear()};return e=t(r,i,l),l}const Kxe=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),yU=Kxe?R.useEffect:R.useLayoutEffect;function Yxe(t){const e=typeof t=="function"?qxe(t):t,n=(r=e.getState,i=Object.is)=>{const[,s]=R.useReducer(_=>_+1,0),o=e.getState(),a=R.useRef(o),l=R.useRef(r),c=R.useRef(i),d=R.useRef(!1),f=R.useRef();f.current===void 0&&(f.current=r(o));let m,y=!1;(a.current!==o||l.current!==r||c.current!==i||d.current)&&(m=r(o),y=!i(f.current,m)),yU(()=>{y&&(f.current=m),a.current=o,l.current=r,c.current=i,d.current=!1});const x=R.useRef(o);yU(()=>{const _=()=>{try{const A=e.getState(),T=l.current(A);c.current(f.current,T)||(a.current=A,f.current=T,s())}catch{d.current=!0,s()}},w=e.subscribe(_);return e.getState()!==x.current&&_(),w},[]);const S=y?m:f.current;return R.useDebugValue(S),S};return Object.assign(n,e),n[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const r=[n,e];return{next(){const i=r.length<=0;return{value:r.shift(),done:i}}}},n}var DA={exports:{}},UA={exports:{}},jA={};/**
|
||
* @license React
|
||
* scheduler.production.min.js
|
||
*
|
||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var xU;function Zxe(){return xU||(xU=1,(function(t){function e(B,K){var q=B.length;B.push(K);e:for(;0<q;){var $=q-1>>>1,Z=B[$];if(0<i(Z,K))B[$]=K,B[q]=Z,q=$;else break e}}function n(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var K=B[0],q=B.pop();if(q!==K){B[0]=q;e:for(var $=0,Z=B.length,ge=Z>>>1;$<ge;){var ae=2*($+1)-1,fe=B[ae],_e=ae+1,Se=B[_e];if(0>i(fe,q))_e<Z&&0>i(Se,fe)?(B[$]=Se,B[_e]=q,$=_e):(B[$]=fe,B[ae]=q,$=ae);else if(_e<Z&&0>i(Se,q))B[$]=Se,B[_e]=q,$=_e;else break e}}return K}function i(B,K){var q=B.sortIndex-K.sortIndex;return q!==0?q:B.id-K.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],c=[],d=1,f=null,m=3,y=!1,x=!1,S=!1,_=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function T(B){for(var K=n(c);K!==null;){if(K.callback===null)r(c);else if(K.startTime<=B)r(c),K.sortIndex=K.expirationTime,e(l,K);else break;K=n(c)}}function C(B){if(S=!1,T(B),!x)if(n(l)!==null)x=!0,oe(O);else{var K=n(c);K!==null&&ce(C,K.startTime-B)}}function O(B,K){x=!1,S&&(S=!1,w(F),F=-1),y=!0;var q=m;try{for(T(K),f=n(l);f!==null&&(!(f.expirationTime>K)||B&&!j());){var $=f.callback;if(typeof $=="function"){f.callback=null,m=f.priorityLevel;var Z=$(f.expirationTime<=K);K=t.unstable_now(),typeof Z=="function"?f.callback=Z:f===n(l)&&r(l),T(K)}else r(l);f=n(l)}if(f!==null)var ge=!0;else{var ae=n(c);ae!==null&&ce(C,ae.startTime-K),ge=!1}return ge}finally{f=null,m=q,y=!1}}var N=!1,D=null,F=-1,V=5,k=-1;function j(){return!(t.unstable_now()-k<V)}function H(){if(D!==null){var B=t.unstable_now();k=B;var K=!0;try{K=D(!0,B)}finally{K?ne():(N=!1,D=null)}}else N=!1}var ne;if(typeof A=="function")ne=function(){A(H)};else if(typeof MessageChannel<"u"){var te=new MessageChannel,pe=te.port2;te.port1.onmessage=H,ne=function(){pe.postMessage(null)}}else ne=function(){_(H,0)};function oe(B){D=B,N||(N=!0,ne())}function ce(B,K){F=_(function(){B(t.unstable_now())},K)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(B){B.callback=null},t.unstable_continueExecution=function(){x||y||(x=!0,oe(O))},t.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):V=0<B?Math.floor(1e3/B):5},t.unstable_getCurrentPriorityLevel=function(){return m},t.unstable_getFirstCallbackNode=function(){return n(l)},t.unstable_next=function(B){switch(m){case 1:case 2:case 3:var K=3;break;default:K=m}var q=m;m=K;try{return B()}finally{m=q}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(B,K){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var q=m;m=B;try{return K()}finally{m=q}},t.unstable_scheduleCallback=function(B,K,q){var $=t.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?$+q:$):q=$,B){case 1:var Z=-1;break;case 2:Z=250;break;case 5:Z=1073741823;break;case 4:Z=1e4;break;default:Z=5e3}return Z=q+Z,B={id:d++,callback:K,priorityLevel:B,startTime:q,expirationTime:Z,sortIndex:-1},q>$?(B.sortIndex=q,e(c,B),n(l)===null&&B===n(c)&&(S?(w(F),F=-1):S=!0,ce(C,q-$))):(B.sortIndex=Z,e(l,B),x||y||(x=!0,oe(O))),B},t.unstable_shouldYield=j,t.unstable_wrapCallback=function(B){var K=m;return function(){var q=m;m=K;try{return B.apply(this,arguments)}finally{m=q}}}})(jA)),jA}var bU;function Qxe(){return bU||(bU=1,UA.exports=Zxe()),UA.exports}/**
|
||
* @license React
|
||
* react-reconciler.production.min.js
|
||
*
|
||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var FA,_U;function Jxe(){return _U||(_U=1,FA=function(e){var n={},r=Wh(),i=Qxe(),s=Object.assign;function o(p){for(var g="https://reactjs.org/docs/error-decoder.html?invariant="+p,M=1;M<arguments.length;M++)g+="&args[]="+encodeURIComponent(arguments[M]);return"Minified React error #"+p+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var a=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,l=Symbol.for("react.element"),c=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),m=Symbol.for("react.profiler"),y=Symbol.for("react.provider"),x=Symbol.for("react.context"),S=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),w=Symbol.for("react.suspense_list"),A=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),C=Symbol.for("react.offscreen"),O=Symbol.iterator;function N(p){return p===null||typeof p!="object"?null:(p=O&&p[O]||p["@@iterator"],typeof p=="function"?p:null)}function D(p){if(p==null)return null;if(typeof p=="function")return p.displayName||p.name||null;if(typeof p=="string")return p;switch(p){case d:return"Fragment";case c:return"Portal";case m:return"Profiler";case f:return"StrictMode";case _:return"Suspense";case w:return"SuspenseList"}if(typeof p=="object")switch(p.$$typeof){case x:return(p.displayName||"Context")+".Consumer";case y:return(p._context.displayName||"Context")+".Provider";case S:var g=p.render;return p=p.displayName,p||(p=g.displayName||g.name||"",p=p!==""?"ForwardRef("+p+")":"ForwardRef"),p;case A:return g=p.displayName||null,g!==null?g:D(p.type)||"Memo";case T:g=p._payload,p=p._init;try{return D(p(g))}catch{}}return null}function F(p){var g=p.type;switch(p.tag){case 24:return"Cache";case 9:return(g.displayName||"Context")+".Consumer";case 10:return(g._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return p=g.render,p=p.displayName||p.name||"",g.displayName||(p!==""?"ForwardRef("+p+")":"ForwardRef");case 7:return"Fragment";case 5:return g;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return D(g);case 8:return g===f?"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 g=="function")return g.displayName||g.name||null;if(typeof g=="string")return g}return null}function V(p){var g=p,M=p;if(p.alternate)for(;g.return;)g=g.return;else{p=g;do g=p,(g.flags&4098)!==0&&(M=g.return),p=g.return;while(p)}return g.tag===3?M:null}function k(p){if(V(p)!==p)throw Error(o(188))}function j(p){var g=p.alternate;if(!g){if(g=V(p),g===null)throw Error(o(188));return g!==p?null:p}for(var M=p,P=g;;){var L=M.return;if(L===null)break;var z=L.alternate;if(z===null){if(P=L.return,P!==null){M=P;continue}break}if(L.child===z.child){for(z=L.child;z;){if(z===M)return k(L),p;if(z===P)return k(L),g;z=z.sibling}throw Error(o(188))}if(M.return!==P.return)M=L,P=z;else{for(var ie=!1,ye=L.child;ye;){if(ye===M){ie=!0,M=L,P=z;break}if(ye===P){ie=!0,P=L,M=z;break}ye=ye.sibling}if(!ie){for(ye=z.child;ye;){if(ye===M){ie=!0,M=z,P=L;break}if(ye===P){ie=!0,P=z,M=L;break}ye=ye.sibling}if(!ie)throw Error(o(189))}}if(M.alternate!==P)throw Error(o(190))}if(M.tag!==3)throw Error(o(188));return M.stateNode.current===M?p:g}function H(p){return p=j(p),p!==null?ne(p):null}function ne(p){if(p.tag===5||p.tag===6)return p;for(p=p.child;p!==null;){var g=ne(p);if(g!==null)return g;p=p.sibling}return null}function te(p){if(p.tag===5||p.tag===6)return p;for(p=p.child;p!==null;){if(p.tag!==4){var g=te(p);if(g!==null)return g}p=p.sibling}return null}var pe=Array.isArray,oe=e.getPublicInstance,ce=e.getRootHostContext,B=e.getChildHostContext,K=e.prepareForCommit,q=e.resetAfterCommit,$=e.createInstance,Z=e.appendInitialChild,ge=e.finalizeInitialChildren,ae=e.prepareUpdate,fe=e.shouldSetTextContent,_e=e.createTextInstance,Se=e.scheduleTimeout,$e=e.cancelTimeout,Me=e.noTimeout,He=e.isPrimaryRenderer,Xe=e.supportsMutation,ue=e.supportsPersistence,Q=e.supportsHydration,Ge=e.getInstanceFromNode,Ue=e.preparePortalMount,We=e.getCurrentEventPriority,Qe=e.detachDeletedInstance,xt=e.supportsMicrotasks,at=e.scheduleMicrotask,ee=e.supportsTestSelectors,W=e.findFiberRoot,Ee=e.getBoundingRect,Be=e.getTextContent,le=e.isHiddenSubtree,Ce=e.matchAccessibilityRole,lt=e.setFocusIfFocusable,rt=e.setupIntersectionObserver,ft=e.appendChild,nn=e.appendChildToContainer,qe=e.commitTextUpdate,dt=e.commitMount,Dt=e.commitUpdate,Ut=e.insertBefore,pt=e.insertInContainerBefore,de=e.removeChild,J=e.removeChildFromContainer,Ae=e.resetTextContent,re=e.hideInstance,Fe=e.hideTextInstance,Te=e.unhideInstance,Le=e.unhideTextInstance,Ke=e.clearContainer,ut=e.cloneInstance,Kt=e.createContainerChildSet,un=e.appendChildToContainerChildSet,Cn=e.finalizeContainerChildren,Jt=e.replaceContainerChildren,Hn=e.cloneHiddenInstance,hr=e.cloneHiddenTextInstance,Si=e.canHydrateInstance,ra=e.canHydrateTextInstance,Mi=e.canHydrateSuspenseInstance,Ka=e.isSuspenseInstancePending,Ns=e.isSuspenseInstanceFallback,ia=e.registerSuspenseInstanceRetry,Ei=e.getNextHydratableSibling,Ao=e.getFirstHydratableChild,sa=e.getFirstHydratableChildWithinContainer,cu=e.getFirstHydratableChildWithinSuspenseInstance,uu=e.hydrateInstance,To=e.hydrateTextInstance,du=e.hydrateSuspenseInstance,Hl=e.getNextHydratableInstanceAfterSuspenseInstance,Y=e.commitHydratedContainer,xe=e.commitHydratedSuspenseInstance,Re=e.clearSuspenseBoundary,ke=e.clearSuspenseBoundaryFromContainer,we=e.shouldDeleteUnhydratedTailInstances,et=e.didNotMatchHydratedContainerTextInstance,vt=e.didNotMatchHydratedTextInstance,st;function Mt(p){if(st===void 0)try{throw Error()}catch(M){var g=M.stack.trim().match(/\n( *(at )?)/);st=g&&g[1]||""}return`
|
||
`+st+p}var Ft=!1;function Ht(p,g){if(!p||Ft)return"";Ft=!0;var M=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(g)if(g=function(){throw Error()},Object.defineProperty(g.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(g,[])}catch(tt){var P=tt}Reflect.construct(p,[],g)}else{try{g.call()}catch(tt){P=tt}p.call(g.prototype)}else{try{throw Error()}catch(tt){P=tt}p()}}catch(tt){if(tt&&P&&typeof tt.stack=="string"){for(var L=tt.stack.split(`
|
||
`),z=P.stack.split(`
|
||
`),ie=L.length-1,ye=z.length-1;1<=ie&&0<=ye&&L[ie]!==z[ye];)ye--;for(;1<=ie&&0<=ye;ie--,ye--)if(L[ie]!==z[ye]){if(ie!==1||ye!==1)do if(ie--,ye--,0>ye||L[ie]!==z[ye]){var ze=`
|
||
`+L[ie].replace(" at new "," at ");return p.displayName&&ze.includes("<anonymous>")&&(ze=ze.replace("<anonymous>",p.displayName)),ze}while(1<=ie&&0<=ye);break}}}finally{Ft=!1,Error.prepareStackTrace=M}return(p=p?p.displayName||p.name:"")?Mt(p):""}var Pt=Object.prototype.hasOwnProperty,Sn=[],Mn=-1;function yn(p){return{current:p}}function Yt(p){0>Mn||(p.current=Sn[Mn],Sn[Mn]=null,Mn--)}function Lt(p,g){Mn++,Sn[Mn]=p.current,p.current=g}var mt={},xn=yn(mt),en=yn(!1),Pr=mt;function li(p,g){var M=p.type.contextTypes;if(!M)return mt;var P=p.stateNode;if(P&&P.__reactInternalMemoizedUnmaskedChildContext===g)return P.__reactInternalMemoizedMaskedChildContext;var L={},z;for(z in M)L[z]=g[z];return P&&(p=p.stateNode,p.__reactInternalMemoizedUnmaskedChildContext=g,p.__reactInternalMemoizedMaskedChildContext=L),L}function kn(p){return p=p.childContextTypes,p!=null}function Is(){Yt(en),Yt(xn)}function Vn(p,g,M){if(xn.current!==mt)throw Error(o(168));Lt(xn,g),Lt(en,M)}function eo(p,g,M){var P=p.stateNode;if(g=g.childContextTypes,typeof P.getChildContext!="function")return M;P=P.getChildContext();for(var L in P)if(!(L in g))throw Error(o(108,F(p)||"Unknown",L));return s({},M,P)}function Ya(p){return p=(p=p.stateNode)&&p.__reactInternalMemoizedMergedChildContext||mt,Pr=xn.current,Lt(xn,p),Lt(en,en.current),!0}function Xr(p,g,M){var P=p.stateNode;if(!P)throw Error(o(169));M?(p=eo(p,g,Pr),P.__reactInternalMemoizedMergedChildContext=p,Yt(en),Yt(xn),Lt(xn,p)):Yt(en),Lt(en,M)}var ci=Math.clz32?Math.clz32:xM,Ld=Math.log,Za=Math.LN2;function xM(p){return p>>>=0,p===0?32:31-(Ld(p)/Za|0)|0}var fu=64,Pn=4194304;function hu(p){switch(p&-p){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 p&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return p&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return p}}function Dd(p,g){var M=p.pendingLanes;if(M===0)return 0;var P=0,L=p.suspendedLanes,z=p.pingedLanes,ie=M&268435455;if(ie!==0){var ye=ie&~L;ye!==0?P=hu(ye):(z&=ie,z!==0&&(P=hu(z)))}else ie=M&~L,ie!==0?P=hu(ie):z!==0&&(P=hu(z));if(P===0)return 0;if(g!==0&&g!==P&&(g&L)===0&&(L=P&-P,z=g&-g,L>=z||L===16&&(z&4194240)!==0))return g;if((P&4)!==0&&(P|=M&16),g=p.entangledLanes,g!==0)for(p=p.entanglements,g&=P;0<g;)M=31-ci(g),L=1<<M,P|=p[M],g&=~L;return P}function sv(p,g){switch(p){case 1:case 2:case 4:return g+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 g+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 vx(p,g){for(var M=p.suspendedLanes,P=p.pingedLanes,L=p.expirationTimes,z=p.pendingLanes;0<z;){var ie=31-ci(z),ye=1<<ie,ze=L[ie];ze===-1?((ye&M)===0||(ye&P)!==0)&&(L[ie]=sv(ye,g)):ze<=g&&(p.expiredLanes|=ye),z&=~ye}}function ip(p){return p=p.pendingLanes&-1073741825,p!==0?p:p&1073741824?1073741824:0}function sp(p){for(var g=[],M=0;31>M;M++)g.push(p);return g}function Vl(p,g,M){p.pendingLanes|=g,g!==536870912&&(p.suspendedLanes=0,p.pingedLanes=0),p=p.eventTimes,g=31-ci(g),p[g]=M}function op(p,g){var M=p.pendingLanes&~g;p.pendingLanes=g,p.suspendedLanes=0,p.pingedLanes=0,p.expiredLanes&=g,p.mutableReadLanes&=g,p.entangledLanes&=g,g=p.entanglements;var P=p.eventTimes;for(p=p.expirationTimes;0<M;){var L=31-ci(M),z=1<<L;g[L]=0,P[L]=-1,p[L]=-1,M&=~z}}function Co(p,g){var M=p.entangledLanes|=g;for(p=p.entanglements;M;){var P=31-ci(M),L=1<<P;L&g|p[P]&g&&(p[P]|=g),M&=~L}}var dn=0;function oa(p){return p&=-p,1<p?4<p?(p&268435455)!==0?16:536870912:4:1}var Gl=i.unstable_scheduleCallback,pu=i.unstable_cancelCallback,Qa=i.unstable_shouldYield,bM=i.unstable_requestPaint,Rr=i.unstable_now,Wl=i.unstable_ImmediatePriority,_M=i.unstable_UserBlockingPriority,ap=i.unstable_NormalPriority,lp=i.unstable_IdlePriority,Ud=null,Po=null;function jd(p){if(Po&&typeof Po.onCommitFiberRoot=="function")try{Po.onCommitFiberRoot(Ud,p,void 0,(p.current.flags&128)===128)}catch{}}function Fd(p,g){return p===g&&(p!==0||1/p===1/g)||p!==p&&g!==g}var Ai=typeof Object.is=="function"?Object.is:Fd,ks=null,cp=!1,ov=!1;function up(p){ks===null?ks=[p]:ks.push(p)}function dp(p){cp=!0,up(p)}function Os(){if(!ov&&ks!==null){ov=!0;var p=0,g=dn;try{var M=ks;for(dn=1;p<M.length;p++){var P=M[p];do P=P(!0);while(P!==null)}ks=null,cp=!1}catch(L){throw ks!==null&&(ks=ks.slice(p+1)),Gl(Wl,Os),L}finally{dn=g,ov=!1}}return null}var yx=a.ReactCurrentBatchConfig;function to(p,g){if(Ai(p,g))return!0;if(typeof p!="object"||p===null||typeof g!="object"||g===null)return!1;var M=Object.keys(p),P=Object.keys(g);if(M.length!==P.length)return!1;for(P=0;P<M.length;P++){var L=M[P];if(!Pt.call(g,L)||!Ai(p[L],g[L]))return!1}return!0}function av(p){switch(p.tag){case 5:return Mt(p.type);case 16:return Mt("Lazy");case 13:return Mt("Suspense");case 19:return Mt("SuspenseList");case 0:case 2:case 15:return p=Ht(p.type,!1),p;case 11:return p=Ht(p.type.render,!1),p;case 1:return p=Ht(p.type,!0),p;default:return""}}function Wi(p,g){if(p&&p.defaultProps){g=s({},g),p=p.defaultProps;for(var M in p)g[M]===void 0&&(g[M]=p[M]);return g}return g}var zd=yn(null),$l=null,aa=null,fp=null;function Ti(){fp=aa=$l=null}function Xl(p,g,M){He?(Lt(zd,g._currentValue),g._currentValue=M):(Lt(zd,g._currentValue2),g._currentValue2=M)}function Bd(p){var g=zd.current;Yt(zd),He?p._currentValue=g:p._currentValue2=g}function ql(p,g,M){for(;p!==null;){var P=p.alternate;if((p.childLanes&g)!==g?(p.childLanes|=g,P!==null&&(P.childLanes|=g)):P!==null&&(P.childLanes&g)!==g&&(P.childLanes|=g),p===M)break;p=p.return}}function mu(p,g){$l=p,fp=aa=null,p=p.dependencies,p!==null&&p.firstContext!==null&&((p.lanes&g)!==0&&(Fr=!0),p.firstContext=null)}function $i(p){var g=He?p._currentValue:p._currentValue2;if(fp!==p)if(p={context:p,memoizedValue:g,next:null},aa===null){if($l===null)throw Error(o(308));aa=p,$l.dependencies={lanes:0,firstContext:p}}else aa=aa.next=p;return g}var Ls=null,Ds=!1;function gu(p){p.updateQueue={baseState:p.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function lv(p,g){p=p.updateQueue,g.updateQueue===p&&(g.updateQueue={baseState:p.baseState,firstBaseUpdate:p.firstBaseUpdate,lastBaseUpdate:p.lastBaseUpdate,shared:p.shared,effects:p.effects})}function la(p,g){return{eventTime:p,lane:g,tag:0,payload:null,callback:null,next:null}}function Ja(p,g){var M=p.updateQueue;M!==null&&(M=M.shared,mr!==null&&(p.mode&1)!==0&&(an&2)===0?(p=M.interleaved,p===null?(g.next=g,Ls===null?Ls=[M]:Ls.push(M)):(g.next=p.next,p.next=g),M.interleaved=g):(p=M.pending,p===null?g.next=g:(g.next=p.next,p.next=g),M.pending=g))}function hp(p,g,M){if(g=g.updateQueue,g!==null&&(g=g.shared,(M&4194240)!==0)){var P=g.lanes;P&=p.pendingLanes,M|=P,g.lanes=M,Co(p,M)}}function pp(p,g){var M=p.updateQueue,P=p.alternate;if(P!==null&&(P=P.updateQueue,M===P)){var L=null,z=null;if(M=M.firstBaseUpdate,M!==null){do{var ie={eventTime:M.eventTime,lane:M.lane,tag:M.tag,payload:M.payload,callback:M.callback,next:null};z===null?L=z=ie:z=z.next=ie,M=M.next}while(M!==null);z===null?L=z=g:z=z.next=g}else L=z=g;M={baseState:P.baseState,firstBaseUpdate:L,lastBaseUpdate:z,shared:P.shared,effects:P.effects},p.updateQueue=M;return}p=M.lastBaseUpdate,p===null?M.firstBaseUpdate=g:p.next=g,M.lastBaseUpdate=g}function mp(p,g,M,P){var L=p.updateQueue;Ds=!1;var z=L.firstBaseUpdate,ie=L.lastBaseUpdate,ye=L.shared.pending;if(ye!==null){L.shared.pending=null;var ze=ye,tt=ze.next;ze.next=null,ie===null?z=tt:ie.next=tt,ie=ze;var St=p.alternate;St!==null&&(St=St.updateQueue,ye=St.lastBaseUpdate,ye!==ie&&(ye===null?St.firstBaseUpdate=tt:ye.next=tt,St.lastBaseUpdate=ze))}if(z!==null){var rn=L.baseState;ie=0,St=tt=ze=null,ye=z;do{var Bt=ye.lane,ln=ye.eventTime;if((P&Bt)===Bt){St!==null&&(St=St.next={eventTime:ln,lane:0,tag:ye.tag,payload:ye.payload,callback:ye.callback,next:null});e:{var bt=p,Jr=ye;switch(Bt=g,ln=M,Jr.tag){case 1:if(bt=Jr.payload,typeof bt=="function"){rn=bt.call(ln,rn,Bt);break e}rn=bt;break e;case 3:bt.flags=bt.flags&-65537|128;case 0:if(bt=Jr.payload,Bt=typeof bt=="function"?bt.call(ln,rn,Bt):bt,Bt==null)break e;rn=s({},rn,Bt);break e;case 2:Ds=!0}}ye.callback!==null&&ye.lane!==0&&(p.flags|=64,Bt=L.effects,Bt===null?L.effects=[ye]:Bt.push(ye))}else ln={eventTime:ln,lane:Bt,tag:ye.tag,payload:ye.payload,callback:ye.callback,next:null},St===null?(tt=St=ln,ze=rn):St=St.next=ln,ie|=Bt;if(ye=ye.next,ye===null){if(ye=L.shared.pending,ye===null)break;Bt=ye,ye=Bt.next,Bt.next=null,L.lastBaseUpdate=Bt,L.shared.pending=null}}while(!0);if(St===null&&(ze=rn),L.baseState=ze,L.firstBaseUpdate=tt,L.lastBaseUpdate=St,g=L.shared.interleaved,g!==null){L=g;do ie|=L.lane,L=L.next;while(L!==g)}else z===null&&(L.shared.lanes=0);ko|=ie,p.lanes=ie,p.memoizedState=rn}}function xx(p,g,M){if(p=g.effects,g.effects=null,p!==null)for(g=0;g<p.length;g++){var P=p[g],L=P.callback;if(L!==null){if(P.callback=null,P=M,typeof L!="function")throw Error(o(191,L));L.call(P)}}}var bx=new r.Component().refs;function cv(p,g,M,P){g=p.memoizedState,M=M(P,g),M=M==null?g:s({},g,M),p.memoizedState=M,p.lanes===0&&(p.updateQueue.baseState=M)}var gp={isMounted:function(p){return(p=p._reactInternals)?V(p)===p:!1},enqueueSetState:function(p,g,M){p=p._reactInternals;var P=Rn(),L=lo(p),z=la(P,L);z.payload=g,M!=null&&(z.callback=M),Ja(p,z),g=fi(p,L,P),g!==null&&hp(g,p,L)},enqueueReplaceState:function(p,g,M){p=p._reactInternals;var P=Rn(),L=lo(p),z=la(P,L);z.tag=1,z.payload=g,M!=null&&(z.callback=M),Ja(p,z),g=fi(p,L,P),g!==null&&hp(g,p,L)},enqueueForceUpdate:function(p,g){p=p._reactInternals;var M=Rn(),P=lo(p),L=la(M,P);L.tag=2,g!=null&&(L.callback=g),Ja(p,L),g=fi(p,P,M),g!==null&&hp(g,p,P)}};function uv(p,g,M,P,L,z,ie){return p=p.stateNode,typeof p.shouldComponentUpdate=="function"?p.shouldComponentUpdate(P,z,ie):g.prototype&&g.prototype.isPureReactComponent?!to(M,P)||!to(L,z):!0}function _x(p,g,M){var P=!1,L=mt,z=g.contextType;return typeof z=="object"&&z!==null?z=$i(z):(L=kn(g)?Pr:xn.current,P=g.contextTypes,z=(P=P!=null)?li(p,L):mt),g=new g(M,z),p.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,g.updater=gp,p.stateNode=g,g._reactInternals=p,P&&(p=p.stateNode,p.__reactInternalMemoizedUnmaskedChildContext=L,p.__reactInternalMemoizedMaskedChildContext=z),g}function wx(p,g,M,P){p=g.state,typeof g.componentWillReceiveProps=="function"&&g.componentWillReceiveProps(M,P),typeof g.UNSAFE_componentWillReceiveProps=="function"&&g.UNSAFE_componentWillReceiveProps(M,P),g.state!==p&&gp.enqueueReplaceState(g,g.state,null)}function dv(p,g,M,P){var L=p.stateNode;L.props=M,L.state=p.memoizedState,L.refs=bx,gu(p);var z=g.contextType;typeof z=="object"&&z!==null?L.context=$i(z):(z=kn(g)?Pr:xn.current,L.context=li(p,z)),L.state=p.memoizedState,z=g.getDerivedStateFromProps,typeof z=="function"&&(cv(p,g,z,M),L.state=p.memoizedState),typeof g.getDerivedStateFromProps=="function"||typeof L.getSnapshotBeforeUpdate=="function"||typeof L.UNSAFE_componentWillMount!="function"&&typeof L.componentWillMount!="function"||(g=L.state,typeof L.componentWillMount=="function"&&L.componentWillMount(),typeof L.UNSAFE_componentWillMount=="function"&&L.UNSAFE_componentWillMount(),g!==L.state&&gp.enqueueReplaceState(L,L.state,null),mp(p,M,L,P),L.state=p.memoizedState),typeof L.componentDidMount=="function"&&(p.flags|=4194308)}var vu=[],el=0,vp=null,yp=0,Us=[],us=0,Kl=null,ca=1,ua="";function Yl(p,g){vu[el++]=yp,vu[el++]=vp,vp=p,yp=g}function Sx(p,g,M){Us[us++]=ca,Us[us++]=ua,Us[us++]=Kl,Kl=p;var P=ca;p=ua;var L=32-ci(P)-1;P&=~(1<<L),M+=1;var z=32-ci(g)+L;if(30<z){var ie=L-L%5;z=(P&(1<<ie)-1).toString(32),P>>=ie,L-=ie,ca=1<<32-ci(g)+L|M<<L|P,ua=z+p}else ca=1<<z|M<<L|P,ua=p}function fv(p){p.return!==null&&(Yl(p,1),Sx(p,1,0))}function hv(p){for(;p===vp;)vp=vu[--el],vu[el]=null,yp=vu[--el],vu[el]=null;for(;p===Kl;)Kl=Us[--us],Us[us]=null,ua=Us[--us],Us[us]=null,ca=Us[--us],Us[us]=null}var Ci=null,qr=null,Zn=!1,yu=!1,js=null;function pv(p,g){var M=vs(5,null,null,0);M.elementType="DELETED",M.stateNode=g,M.return=p,g=p.deletions,g===null?(p.deletions=[M],p.flags|=16):g.push(M)}function mv(p,g){switch(p.tag){case 5:return g=Si(g,p.type,p.pendingProps),g!==null?(p.stateNode=g,Ci=p,qr=Ao(g),!0):!1;case 6:return g=ra(g,p.pendingProps),g!==null?(p.stateNode=g,Ci=p,qr=null,!0):!1;case 13:if(g=Mi(g),g!==null){var M=Kl!==null?{id:ca,overflow:ua}:null;return p.memoizedState={dehydrated:g,treeContext:M,retryLane:1073741824},M=vs(18,null,null,0),M.stateNode=g,M.return=p,p.child=M,Ci=p,qr=null,!0}return!1;default:return!1}}function xp(p){return(p.mode&1)!==0&&(p.flags&128)===0}function tl(p){if(Zn){var g=qr;if(g){var M=g;if(!mv(p,g)){if(xp(p))throw Error(o(418));g=Ei(M);var P=Ci;g&&mv(p,g)?pv(P,M):(p.flags=p.flags&-4097|2,Zn=!1,Ci=p)}}else{if(xp(p))throw Error(o(418));p.flags=p.flags&-4097|2,Zn=!1,Ci=p}}}function Mx(p){for(p=p.return;p!==null&&p.tag!==5&&p.tag!==3&&p.tag!==13;)p=p.return;Ci=p}function Hd(p){if(!Q||p!==Ci)return!1;if(!Zn)return Mx(p),Zn=!0,!1;if(p.tag!==3&&(p.tag!==5||we(p.type)&&!fe(p.type,p.memoizedProps))){var g=qr;if(g){if(xp(p)){for(p=qr;p;)p=Ei(p);throw Error(o(418))}for(;g;)pv(p,g),g=Ei(g)}}if(Mx(p),p.tag===13){if(!Q)throw Error(o(316));if(p=p.memoizedState,p=p!==null?p.dehydrated:null,!p)throw Error(o(317));qr=Hl(p)}else qr=Ci?Ei(p.stateNode):null;return!0}function xu(){Q&&(qr=Ci=null,yu=Zn=!1)}function bp(p){js===null?js=[p]:js.push(p)}function bu(p,g,M){if(p=M.ref,p!==null&&typeof p!="function"&&typeof p!="object"){if(M._owner){if(M=M._owner,M){if(M.tag!==1)throw Error(o(309));var P=M.stateNode}if(!P)throw Error(o(147,p));var L=P,z=""+p;return g!==null&&g.ref!==null&&typeof g.ref=="function"&&g.ref._stringRef===z?g.ref:(g=function(ie){var ye=L.refs;ye===bx&&(ye=L.refs={}),ie===null?delete ye[z]:ye[z]=ie},g._stringRef=z,g)}if(typeof p!="string")throw Error(o(284));if(!M._owner)throw Error(o(290,p))}return p}function nl(p,g){throw p=Object.prototype.toString.call(g),Error(o(31,p==="[object Object]"?"object with keys {"+Object.keys(g).join(", ")+"}":p))}function _u(p){var g=p._init;return g(p._payload)}function Ex(p){function g(Ie,be){if(p){var je=Ie.deletions;je===null?(Ie.deletions=[be],Ie.flags|=16):je.push(be)}}function M(Ie,be){if(!p)return null;for(;be!==null;)g(Ie,be),be=be.sibling;return null}function P(Ie,be){for(Ie=new Map;be!==null;)be.key!==null?Ie.set(be.key,be):Ie.set(be.index,be),be=be.sibling;return Ie}function L(Ie,be){return Ie=Ma(Ie,be),Ie.index=0,Ie.sibling=null,Ie}function z(Ie,be,je){return Ie.index=je,p?(je=Ie.alternate,je!==null?(je=je.index,je<be?(Ie.flags|=2,be):je):(Ie.flags|=2,be)):(Ie.flags|=1048576,be)}function ie(Ie){return p&&Ie.alternate===null&&(Ie.flags|=2),Ie}function ye(Ie,be,je,gt){return be===null||be.tag!==6?(be=Xp(je,Ie.mode,gt),be.return=Ie,be):(be=L(be,je),be.return=Ie,be)}function ze(Ie,be,je,gt){var It=je.type;return It===d?St(Ie,be,je.props.children,gt,je.key):be!==null&&(be.elementType===It||typeof It=="object"&&It!==null&&It.$$typeof===T&&_u(It)===be.type)?(gt=L(be,je.props),gt.ref=bu(Ie,be,je),gt.return=Ie,gt):(gt=$p(je.type,je.key,je.props,null,Ie.mode,gt),gt.ref=bu(Ie,be,je),gt.return=Ie,gt)}function tt(Ie,be,je,gt){return be===null||be.tag!==4||be.stateNode.containerInfo!==je.containerInfo||be.stateNode.implementation!==je.implementation?(be=qp(je,Ie.mode,gt),be.return=Ie,be):(be=L(be,je.children||[]),be.return=Ie,be)}function St(Ie,be,je,gt,It){return be===null||be.tag!==7?(be=yc(je,Ie.mode,gt,It),be.return=Ie,be):(be=L(be,je),be.return=Ie,be)}function rn(Ie,be,je){if(typeof be=="string"&&be!==""||typeof be=="number")return be=Xp(""+be,Ie.mode,je),be.return=Ie,be;if(typeof be=="object"&&be!==null){switch(be.$$typeof){case l:return je=$p(be.type,be.key,be.props,null,Ie.mode,je),je.ref=bu(Ie,null,be),je.return=Ie,je;case c:return be=qp(be,Ie.mode,je),be.return=Ie,be;case T:var gt=be._init;return rn(Ie,gt(be._payload),je)}if(pe(be)||N(be))return be=yc(be,Ie.mode,je,null),be.return=Ie,be;nl(Ie,be)}return null}function Bt(Ie,be,je,gt){var It=be!==null?be.key:null;if(typeof je=="string"&&je!==""||typeof je=="number")return It!==null?null:ye(Ie,be,""+je,gt);if(typeof je=="object"&&je!==null){switch(je.$$typeof){case l:return je.key===It?ze(Ie,be,je,gt):null;case c:return je.key===It?tt(Ie,be,je,gt):null;case T:return It=je._init,Bt(Ie,be,It(je._payload),gt)}if(pe(je)||N(je))return It!==null?null:St(Ie,be,je,gt,null);nl(Ie,je)}return null}function ln(Ie,be,je,gt,It){if(typeof gt=="string"&>!==""||typeof gt=="number")return Ie=Ie.get(je)||null,ye(be,Ie,""+gt,It);if(typeof gt=="object"&>!==null){switch(gt.$$typeof){case l:return Ie=Ie.get(gt.key===null?je:gt.key)||null,ze(be,Ie,gt,It);case c:return Ie=Ie.get(gt.key===null?je:gt.key)||null,tt(be,Ie,gt,It);case T:var on=gt._init;return ln(Ie,be,je,on(gt._payload),It)}if(pe(gt)||N(gt))return Ie=Ie.get(je)||null,St(be,Ie,gt,It,null);nl(be,gt)}return null}function bt(Ie,be,je,gt){for(var It=null,on=null,sn=be,En=be=0,br=null;sn!==null&&En<je.length;En++){sn.index>En?(br=sn,sn=null):br=sn.sibling;var bn=Bt(Ie,sn,je[En],gt);if(bn===null){sn===null&&(sn=br);break}p&&sn&&bn.alternate===null&&g(Ie,sn),be=z(bn,be,En),on===null?It=bn:on.sibling=bn,on=bn,sn=br}if(En===je.length)return M(Ie,sn),Zn&&Yl(Ie,En),It;if(sn===null){for(;En<je.length;En++)sn=rn(Ie,je[En],gt),sn!==null&&(be=z(sn,be,En),on===null?It=sn:on.sibling=sn,on=sn);return Zn&&Yl(Ie,En),It}for(sn=P(Ie,sn);En<je.length;En++)br=ln(sn,Ie,En,je[En],gt),br!==null&&(p&&br.alternate!==null&&sn.delete(br.key===null?En:br.key),be=z(br,be,En),on===null?It=br:on.sibling=br,on=br);return p&&sn.forEach(function(Ea){return g(Ie,Ea)}),Zn&&Yl(Ie,En),It}function Jr(Ie,be,je,gt){var It=N(je);if(typeof It!="function")throw Error(o(150));if(je=It.call(je),je==null)throw Error(o(151));for(var on=It=null,sn=be,En=be=0,br=null,bn=je.next();sn!==null&&!bn.done;En++,bn=je.next()){sn.index>En?(br=sn,sn=null):br=sn.sibling;var Ea=Bt(Ie,sn,bn.value,gt);if(Ea===null){sn===null&&(sn=br);break}p&&sn&&Ea.alternate===null&&g(Ie,sn),be=z(Ea,be,En),on===null?It=Ea:on.sibling=Ea,on=Ea,sn=br}if(bn.done)return M(Ie,sn),Zn&&Yl(Ie,En),It;if(sn===null){for(;!bn.done;En++,bn=je.next())bn=rn(Ie,bn.value,gt),bn!==null&&(be=z(bn,be,En),on===null?It=bn:on.sibling=bn,on=bn);return Zn&&Yl(Ie,En),It}for(sn=P(Ie,sn);!bn.done;En++,bn=je.next())bn=ln(sn,Ie,En,bn.value,gt),bn!==null&&(p&&bn.alternate!==null&&sn.delete(bn.key===null?En:bn.key),be=z(bn,be,En),on===null?It=bn:on.sibling=bn,on=bn);return p&&sn.forEach(function($v){return g(Ie,$v)}),Zn&&Yl(Ie,En),It}function ys(Ie,be,je,gt){if(typeof je=="object"&&je!==null&&je.type===d&&je.key===null&&(je=je.props.children),typeof je=="object"&&je!==null){switch(je.$$typeof){case l:e:{for(var It=je.key,on=be;on!==null;){if(on.key===It){if(It=je.type,It===d){if(on.tag===7){M(Ie,on.sibling),be=L(on,je.props.children),be.return=Ie,Ie=be;break e}}else if(on.elementType===It||typeof It=="object"&&It!==null&&It.$$typeof===T&&_u(It)===on.type){M(Ie,on.sibling),be=L(on,je.props),be.ref=bu(Ie,on,je),be.return=Ie,Ie=be;break e}M(Ie,on);break}else g(Ie,on);on=on.sibling}je.type===d?(be=yc(je.props.children,Ie.mode,gt,je.key),be.return=Ie,Ie=be):(gt=$p(je.type,je.key,je.props,null,Ie.mode,gt),gt.ref=bu(Ie,be,je),gt.return=Ie,Ie=gt)}return ie(Ie);case c:e:{for(on=je.key;be!==null;){if(be.key===on)if(be.tag===4&&be.stateNode.containerInfo===je.containerInfo&&be.stateNode.implementation===je.implementation){M(Ie,be.sibling),be=L(be,je.children||[]),be.return=Ie,Ie=be;break e}else{M(Ie,be);break}else g(Ie,be);be=be.sibling}be=qp(je,Ie.mode,gt),be.return=Ie,Ie=be}return ie(Ie);case T:return on=je._init,ys(Ie,be,on(je._payload),gt)}if(pe(je))return bt(Ie,be,je,gt);if(N(je))return Jr(Ie,be,je,gt);nl(Ie,je)}return typeof je=="string"&&je!==""||typeof je=="number"?(je=""+je,be!==null&&be.tag===6?(M(Ie,be.sibling),be=L(be,je),be.return=Ie,Ie=be):(M(Ie,be),be=Xp(je,Ie.mode,gt),be.return=Ie,Ie=be),ie(Ie)):M(Ie,be)}return ys}var da=Ex(!0),Ax=Ex(!1),wu={},Xi=yn(wu),Zl=yn(wu),Ql=yn(wu);function no(p){if(p===wu)throw Error(o(174));return p}function _p(p,g){Lt(Ql,g),Lt(Zl,p),Lt(Xi,wu),p=ce(g),Yt(Xi),Lt(Xi,p)}function Su(){Yt(Xi),Yt(Zl),Yt(Ql)}function Tx(p){var g=no(Ql.current),M=no(Xi.current);g=B(M,p.type,g),M!==g&&(Lt(Zl,p),Lt(Xi,g))}function gv(p){Zl.current===p&&(Yt(Xi),Yt(Zl))}var tr=yn(0);function wp(p){for(var g=p;g!==null;){if(g.tag===13){var M=g.memoizedState;if(M!==null&&(M=M.dehydrated,M===null||Ka(M)||Ns(M)))return g}else if(g.tag===19&&g.memoizedProps.revealOrder!==void 0){if((g.flags&128)!==0)return g}else if(g.child!==null){g.child.return=g,g=g.child;continue}if(g===p)break;for(;g.sibling===null;){if(g.return===null||g.return===p)return null;g=g.return}g.sibling.return=g.return,g=g.sibling}return null}var ds=[];function Jl(){for(var p=0;p<ds.length;p++){var g=ds[p];He?g._workInProgressVersionPrimary=null:g._workInProgressVersionSecondary=null}ds.length=0}var Vd=a.ReactCurrentDispatcher,fs=a.ReactCurrentBatchConfig,ec=0,nr=null,Dr=null,Ur=null,Sp=!1,Ro=!1,tc=0,Gd=0;function jr(){throw Error(o(321))}function Mp(p,g){if(g===null)return!1;for(var M=0;M<g.length&&M<p.length;M++)if(!Ai(p[M],g[M]))return!1;return!0}function Mu(p,g,M,P,L,z){if(ec=z,nr=g,g.memoizedState=null,g.updateQueue=null,g.lanes=0,Vd.current=p===null||p.memoizedState===null?wv:Sv,p=M(P,L),Ro){z=0;do{if(Ro=!1,tc=0,25<=z)throw Error(o(301));z+=1,Ur=Dr=null,g.updateQueue=null,Vd.current=Mv,p=M(P,L)}while(Ro)}if(Vd.current=Cu,g=Dr!==null&&Dr.next!==null,ec=0,Ur=Dr=nr=null,Sp=!1,g)throw Error(o(300));return p}function rl(){var p=tc!==0;return tc=0,p}function ro(){var p={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ur===null?nr.memoizedState=Ur=p:Ur=Ur.next=p,Ur}function io(){if(Dr===null){var p=nr.alternate;p=p!==null?p.memoizedState:null}else p=Dr.next;var g=Ur===null?nr.memoizedState:Ur.next;if(g!==null)Ur=g,Dr=p;else{if(p===null)throw Error(o(310));Dr=p,p={memoizedState:Dr.memoizedState,baseState:Dr.baseState,baseQueue:Dr.baseQueue,queue:Dr.queue,next:null},Ur===null?nr.memoizedState=Ur=p:Ur=Ur.next=p}return Ur}function No(p,g){return typeof g=="function"?g(p):g}function Wd(p){var g=io(),M=g.queue;if(M===null)throw Error(o(311));M.lastRenderedReducer=p;var P=Dr,L=P.baseQueue,z=M.pending;if(z!==null){if(L!==null){var ie=L.next;L.next=z.next,z.next=ie}P.baseQueue=L=z,M.pending=null}if(L!==null){z=L.next,P=P.baseState;var ye=ie=null,ze=null,tt=z;do{var St=tt.lane;if((ec&St)===St)ze!==null&&(ze=ze.next={lane:0,action:tt.action,hasEagerState:tt.hasEagerState,eagerState:tt.eagerState,next:null}),P=tt.hasEagerState?tt.eagerState:p(P,tt.action);else{var rn={lane:St,action:tt.action,hasEagerState:tt.hasEagerState,eagerState:tt.eagerState,next:null};ze===null?(ye=ze=rn,ie=P):ze=ze.next=rn,nr.lanes|=St,ko|=St}tt=tt.next}while(tt!==null&&tt!==z);ze===null?ie=P:ze.next=ye,Ai(P,g.memoizedState)||(Fr=!0),g.memoizedState=P,g.baseState=ie,g.baseQueue=ze,M.lastRenderedState=P}if(p=M.interleaved,p!==null){L=p;do z=L.lane,nr.lanes|=z,ko|=z,L=L.next;while(L!==p)}else L===null&&(M.lanes=0);return[g.memoizedState,M.dispatch]}function $d(p){var g=io(),M=g.queue;if(M===null)throw Error(o(311));M.lastRenderedReducer=p;var P=M.dispatch,L=M.pending,z=g.memoizedState;if(L!==null){M.pending=null;var ie=L=L.next;do z=p(z,ie.action),ie=ie.next;while(ie!==L);Ai(z,g.memoizedState)||(Fr=!0),g.memoizedState=z,g.baseQueue===null&&(g.baseState=z),M.lastRenderedState=z}return[z,P]}function vv(){}function yv(p,g){var M=nr,P=io(),L=g(),z=!Ai(P.memoizedState,L);if(z&&(P.memoizedState=L,Fr=!0),P=P.queue,Eu(fa.bind(null,M,P,p),[p]),P.getSnapshot!==g||z||Ur!==null&&Ur.memoizedState.tag&1){if(M.flags|=2048,qd(9,bv.bind(null,M,P,L,g),void 0,null),mr===null)throw Error(o(349));(ec&30)!==0||xv(M,g,L)}return L}function xv(p,g,M){p.flags|=16384,p={getSnapshot:g,value:M},g=nr.updateQueue,g===null?(g={lastEffect:null,stores:null},nr.updateQueue=g,g.stores=[p]):(M=g.stores,M===null?g.stores=[p]:M.push(p))}function bv(p,g,M,P){g.value=M,g.getSnapshot=P,Ep(g)&&fi(p,1,-1)}function fa(p,g,M){return M(function(){Ep(g)&&fi(p,1,-1)})}function Ep(p){var g=p.getSnapshot;p=p.value;try{var M=g();return!Ai(p,M)}catch{return!0}}function Xd(p){var g=ro();return typeof p=="function"&&(p=p()),g.memoizedState=g.baseState=p,p={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:No,lastRenderedState:p},g.queue=p,p=p.dispatch=wM.bind(null,nr,p),[g.memoizedState,p]}function qd(p,g,M,P){return p={tag:p,create:g,destroy:M,deps:P,next:null},g=nr.updateQueue,g===null?(g={lastEffect:null,stores:null},nr.updateQueue=g,g.lastEffect=p.next=p):(M=g.lastEffect,M===null?g.lastEffect=p.next=p:(P=M.next,M.next=p,p.next=P,g.lastEffect=p)),p}function Cx(){return io().memoizedState}function il(p,g,M,P){var L=ro();nr.flags|=p,L.memoizedState=qd(1|g,M,void 0,P===void 0?null:P)}function Ap(p,g,M,P){var L=io();P=P===void 0?null:P;var z=void 0;if(Dr!==null){var ie=Dr.memoizedState;if(z=ie.destroy,P!==null&&Mp(P,ie.deps)){L.memoizedState=qd(g,M,z,P);return}}nr.flags|=p,L.memoizedState=qd(1|g,M,z,P)}function Tp(p,g){return il(8390656,8,p,g)}function Eu(p,g){return Ap(2048,8,p,g)}function Wn(p,g){return Ap(4,2,p,g)}function Cp(p,g){return Ap(4,4,p,g)}function Kd(p,g){if(typeof g=="function")return p=p(),g(p),function(){g(null)};if(g!=null)return p=p(),g.current=p,function(){g.current=null}}function Au(p,g,M){return M=M!=null?M.concat([p]):null,Ap(4,4,Kd.bind(null,g,p),M)}function Pp(){}function Rp(p,g){var M=io();g=g===void 0?null:g;var P=M.memoizedState;return P!==null&&g!==null&&Mp(g,P[1])?P[0]:(M.memoizedState=[p,g],p)}function Tu(p,g){var M=io();g=g===void 0?null:g;var P=M.memoizedState;return P!==null&&g!==null&&Mp(g,P[1])?P[0]:(p=p(),M.memoizedState=[p,g],p)}function Np(p,g){var M=dn;dn=M!==0&&4>M?M:4,p(!0);var P=fs.transition;fs.transition={};try{p(!1),g()}finally{dn=M,fs.transition=P}}function nc(){return io().memoizedState}function Px(p,g,M){var P=lo(p);M={lane:P,action:M,hasEagerState:!1,eagerState:null,next:null},Rx(p)?_v(g,M):(Yd(p,g,M),M=Rn(),p=fi(p,P,M),p!==null&&Zd(p,g,P))}function wM(p,g,M){var P=lo(p),L={lane:P,action:M,hasEagerState:!1,eagerState:null,next:null};if(Rx(p))_v(g,L);else{Yd(p,g,L);var z=p.alternate;if(p.lanes===0&&(z===null||z.lanes===0)&&(z=g.lastRenderedReducer,z!==null))try{var ie=g.lastRenderedState,ye=z(ie,M);if(L.hasEagerState=!0,L.eagerState=ye,Ai(ye,ie))return}catch{}finally{}M=Rn(),p=fi(p,P,M),p!==null&&Zd(p,g,P)}}function Rx(p){var g=p.alternate;return p===nr||g!==null&&g===nr}function _v(p,g){Ro=Sp=!0;var M=p.pending;M===null?g.next=g:(g.next=M.next,M.next=g),p.pending=g}function Yd(p,g,M){mr!==null&&(p.mode&1)!==0&&(an&2)===0?(p=g.interleaved,p===null?(M.next=M,Ls===null?Ls=[g]:Ls.push(g)):(M.next=p.next,p.next=M),g.interleaved=M):(p=g.pending,p===null?M.next=M:(M.next=p.next,p.next=M),g.pending=M)}function Zd(p,g,M){if((M&4194240)!==0){var P=g.lanes;P&=p.pendingLanes,M|=P,g.lanes=M,Co(p,M)}}var Cu={readContext:$i,useCallback:jr,useContext:jr,useEffect:jr,useImperativeHandle:jr,useInsertionEffect:jr,useLayoutEffect:jr,useMemo:jr,useReducer:jr,useRef:jr,useState:jr,useDebugValue:jr,useDeferredValue:jr,useTransition:jr,useMutableSource:jr,useSyncExternalStore:jr,useId:jr,unstable_isNewReconciler:!1},wv={readContext:$i,useCallback:function(p,g){return ro().memoizedState=[p,g===void 0?null:g],p},useContext:$i,useEffect:Tp,useImperativeHandle:function(p,g,M){return M=M!=null?M.concat([p]):null,il(4194308,4,Kd.bind(null,g,p),M)},useLayoutEffect:function(p,g){return il(4194308,4,p,g)},useInsertionEffect:function(p,g){return il(4,2,p,g)},useMemo:function(p,g){var M=ro();return g=g===void 0?null:g,p=p(),M.memoizedState=[p,g],p},useReducer:function(p,g,M){var P=ro();return g=M!==void 0?M(g):g,P.memoizedState=P.baseState=g,p={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:p,lastRenderedState:g},P.queue=p,p=p.dispatch=Px.bind(null,nr,p),[P.memoizedState,p]},useRef:function(p){var g=ro();return p={current:p},g.memoizedState=p},useState:Xd,useDebugValue:Pp,useDeferredValue:function(p){var g=Xd(p),M=g[0],P=g[1];return Tp(function(){var L=fs.transition;fs.transition={};try{P(p)}finally{fs.transition=L}},[p]),M},useTransition:function(){var p=Xd(!1),g=p[0];return p=Np.bind(null,p[1]),ro().memoizedState=p,[g,p]},useMutableSource:function(){},useSyncExternalStore:function(p,g,M){var P=nr,L=ro();if(Zn){if(M===void 0)throw Error(o(407));M=M()}else{if(M=g(),mr===null)throw Error(o(349));(ec&30)!==0||xv(P,g,M)}L.memoizedState=M;var z={value:M,getSnapshot:g};return L.queue=z,Tp(fa.bind(null,P,z,p),[p]),P.flags|=2048,qd(9,bv.bind(null,P,z,M,g),void 0,null),M},useId:function(){var p=ro(),g=mr.identifierPrefix;if(Zn){var M=ua,P=ca;M=(P&~(1<<32-ci(P)-1)).toString(32)+M,g=":"+g+"R"+M,M=tc++,0<M&&(g+="H"+M.toString(32)),g+=":"}else M=Gd++,g=":"+g+"r"+M.toString(32)+":";return p.memoizedState=g},unstable_isNewReconciler:!1},Sv={readContext:$i,useCallback:Rp,useContext:$i,useEffect:Eu,useImperativeHandle:Au,useInsertionEffect:Wn,useLayoutEffect:Cp,useMemo:Tu,useReducer:Wd,useRef:Cx,useState:function(){return Wd(No)},useDebugValue:Pp,useDeferredValue:function(p){var g=Wd(No),M=g[0],P=g[1];return Eu(function(){var L=fs.transition;fs.transition={};try{P(p)}finally{fs.transition=L}},[p]),M},useTransition:function(){var p=Wd(No)[0],g=io().memoizedState;return[p,g]},useMutableSource:vv,useSyncExternalStore:yv,useId:nc,unstable_isNewReconciler:!1},Mv={readContext:$i,useCallback:Rp,useContext:$i,useEffect:Eu,useImperativeHandle:Au,useInsertionEffect:Wn,useLayoutEffect:Cp,useMemo:Tu,useReducer:$d,useRef:Cx,useState:function(){return $d(No)},useDebugValue:Pp,useDeferredValue:function(p){var g=$d(No),M=g[0],P=g[1];return Eu(function(){var L=fs.transition;fs.transition={};try{P(p)}finally{fs.transition=L}},[p]),M},useTransition:function(){var p=$d(No)[0],g=io().memoizedState;return[p,g]},useMutableSource:vv,useSyncExternalStore:yv,useId:nc,unstable_isNewReconciler:!1};function Ev(p,g){try{var M="",P=g;do M+=av(P),P=P.return;while(P);var L=M}catch(z){L=`
|
||
Error generating stack: `+z.message+`
|
||
`+z.stack}return{value:p,source:g,stack:L}}function Ip(p,g){try{console.error(g.value)}catch(M){setTimeout(function(){throw M})}}var SM=typeof WeakMap=="function"?WeakMap:Map;function Nx(p,g,M){M=la(-1,M),M.tag=3,M.payload={element:null};var P=g.value;return M.callback=function(){Ou||(Ou=!0,Kn=P),Ip(p,g)},M}function kp(p,g,M){M=la(-1,M),M.tag=3;var P=p.type.getDerivedStateFromError;if(typeof P=="function"){var L=g.value;M.payload=function(){return P(L)},M.callback=function(){Ip(p,g)}}var z=p.stateNode;return z!==null&&typeof z.componentDidCatch=="function"&&(M.callback=function(){Ip(p,g),typeof P!="function"&&(ao===null?ao=new Set([this]):ao.add(this));var ie=g.stack;this.componentDidCatch(g.value,{componentStack:ie!==null?ie:""})}),M}function ha(p,g,M){var P=p.pingCache;if(P===null){P=p.pingCache=new SM;var L=new Set;P.set(g,L)}else L=P.get(g),L===void 0&&(L=new Set,P.set(g,L));L.has(M)||(L.add(M),p=Vv.bind(null,p,g,M),g.then(p,p))}function Av(p){do{var g;if((g=p.tag===13)&&(g=p.memoizedState,g=g!==null?g.dehydrated!==null:!0),g)return p;p=p.return}while(p!==null);return null}function rc(p,g,M,P,L){return(p.mode&1)===0?(p===g?p.flags|=65536:(p.flags|=128,M.flags|=131072,M.flags&=-52805,M.tag===1&&(M.alternate===null?M.tag=17:(g=la(-1,1),g.tag=2,Ja(M,g))),M.lanes|=1),p):(p.flags|=65536,p.lanes=L,p)}function Nr(p){p.flags|=4}function Pu(p,g){if(p!==null&&p.child===g.child)return!0;if((g.flags&16)!==0)return!1;for(p=g.child;p!==null;){if((p.flags&12854)!==0||(p.subtreeFlags&12854)!==0)return!1;p=p.sibling}return!0}var hs,ic,Op,Lp;if(Xe)hs=function(p,g){for(var M=g.child;M!==null;){if(M.tag===5||M.tag===6)Z(p,M.stateNode);else if(M.tag!==4&&M.child!==null){M.child.return=M,M=M.child;continue}if(M===g)break;for(;M.sibling===null;){if(M.return===null||M.return===g)return;M=M.return}M.sibling.return=M.return,M=M.sibling}},ic=function(){},Op=function(p,g,M,P,L){if(p=p.memoizedProps,p!==P){var z=g.stateNode,ie=no(Xi.current);M=ae(z,M,p,P,L,ie),(g.updateQueue=M)&&Nr(g)}},Lp=function(p,g,M,P){M!==P&&Nr(g)};else if(ue){hs=function(p,g,M,P){for(var L=g.child;L!==null;){if(L.tag===5){var z=L.stateNode;M&&P&&(z=Hn(z,L.type,L.memoizedProps,L)),Z(p,z)}else if(L.tag===6)z=L.stateNode,M&&P&&(z=hr(z,L.memoizedProps,L)),Z(p,z);else if(L.tag!==4){if(L.tag===22&&L.memoizedState!==null)z=L.child,z!==null&&(z.return=L),hs(p,L,!0,!0);else if(L.child!==null){L.child.return=L,L=L.child;continue}}if(L===g)break;for(;L.sibling===null;){if(L.return===null||L.return===g)return;L=L.return}L.sibling.return=L.return,L=L.sibling}};var sl=function(p,g,M,P){for(var L=g.child;L!==null;){if(L.tag===5){var z=L.stateNode;M&&P&&(z=Hn(z,L.type,L.memoizedProps,L)),un(p,z)}else if(L.tag===6)z=L.stateNode,M&&P&&(z=hr(z,L.memoizedProps,L)),un(p,z);else if(L.tag!==4){if(L.tag===22&&L.memoizedState!==null)z=L.child,z!==null&&(z.return=L),sl(p,L,!0,!0);else if(L.child!==null){L.child.return=L,L=L.child;continue}}if(L===g)break;for(;L.sibling===null;){if(L.return===null||L.return===g)return;L=L.return}L.sibling.return=L.return,L=L.sibling}};ic=function(p,g){var M=g.stateNode;if(!Pu(p,g)){p=M.containerInfo;var P=Kt(p);sl(P,g,!1,!1),M.pendingChildren=P,Nr(g),Cn(p,P)}},Op=function(p,g,M,P,L){var z=p.stateNode,ie=p.memoizedProps;if((p=Pu(p,g))&&ie===P)g.stateNode=z;else{var ye=g.stateNode,ze=no(Xi.current),tt=null;ie!==P&&(tt=ae(ye,M,ie,P,L,ze)),p&&tt===null?g.stateNode=z:(z=ut(z,tt,M,ie,P,g,p,ye),ge(z,M,P,L,ze)&&Nr(g),g.stateNode=z,p?Nr(g):hs(z,g,!1,!1))}},Lp=function(p,g,M,P){M!==P?(p=no(Ql.current),M=no(Xi.current),g.stateNode=_e(P,p,M,g),Nr(g)):g.stateNode=p.stateNode}}else ic=function(){},Op=function(){},Lp=function(){};function pa(p,g){if(!Zn)switch(p.tailMode){case"hidden":g=p.tail;for(var M=null;g!==null;)g.alternate!==null&&(M=g),g=g.sibling;M===null?p.tail=null:M.sibling=null;break;case"collapsed":M=p.tail;for(var P=null;M!==null;)M.alternate!==null&&(P=M),M=M.sibling;P===null?g||p.tail===null?p.tail=null:p.tail.sibling=null:P.sibling=null}}function pr(p){var g=p.alternate!==null&&p.alternate.child===p.child,M=0,P=0;if(g)for(var L=p.child;L!==null;)M|=L.lanes|L.childLanes,P|=L.subtreeFlags&14680064,P|=L.flags&14680064,L.return=p,L=L.sibling;else for(L=p.child;L!==null;)M|=L.lanes|L.childLanes,P|=L.subtreeFlags,P|=L.flags,L.return=p,L=L.sibling;return p.subtreeFlags|=P,p.childLanes=M,g}function Dp(p,g,M){var P=g.pendingProps;switch(hv(g),g.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return pr(g),null;case 1:return kn(g.type)&&Is(),pr(g),null;case 3:return P=g.stateNode,Su(),Yt(en),Yt(xn),Jl(),P.pendingContext&&(P.context=P.pendingContext,P.pendingContext=null),(p===null||p.child===null)&&(Hd(g)?Nr(g):p===null||p.memoizedState.isDehydrated&&(g.flags&256)===0||(g.flags|=1024,js!==null&&(df(js),js=null))),ic(p,g),pr(g),null;case 5:gv(g),M=no(Ql.current);var L=g.type;if(p!==null&&g.stateNode!=null)Op(p,g,L,P,M),p.ref!==g.ref&&(g.flags|=512,g.flags|=2097152);else{if(!P){if(g.stateNode===null)throw Error(o(166));return pr(g),null}if(p=no(Xi.current),Hd(g)){if(!Q)throw Error(o(175));p=uu(g.stateNode,g.type,g.memoizedProps,M,p,g,!yu),g.updateQueue=p,p!==null&&Nr(g)}else{var z=$(L,P,M,p,g);hs(z,g,!1,!1),g.stateNode=z,ge(z,L,P,M,p)&&Nr(g)}g.ref!==null&&(g.flags|=512,g.flags|=2097152)}return pr(g),null;case 6:if(p&&g.stateNode!=null)Lp(p,g,p.memoizedProps,P);else{if(typeof P!="string"&&g.stateNode===null)throw Error(o(166));if(p=no(Ql.current),M=no(Xi.current),Hd(g)){if(!Q)throw Error(o(176));if(p=g.stateNode,P=g.memoizedProps,(M=To(p,P,g,!yu))&&(L=Ci,L!==null))switch(z=(L.mode&1)!==0,L.tag){case 3:et(L.stateNode.containerInfo,p,P,z);break;case 5:vt(L.type,L.memoizedProps,L.stateNode,p,P,z)}M&&Nr(g)}else g.stateNode=_e(P,p,M,g)}return pr(g),null;case 13:if(Yt(tr),P=g.memoizedState,Zn&&qr!==null&&(g.mode&1)!==0&&(g.flags&128)===0){for(p=qr;p;)p=Ei(p);return xu(),g.flags|=98560,g}if(P!==null&&P.dehydrated!==null){if(P=Hd(g),p===null){if(!P)throw Error(o(318));if(!Q)throw Error(o(344));if(p=g.memoizedState,p=p!==null?p.dehydrated:null,!p)throw Error(o(317));du(p,g)}else xu(),(g.flags&128)===0&&(g.memoizedState=null),g.flags|=4;return pr(g),null}return js!==null&&(df(js),js=null),(g.flags&128)!==0?(g.lanes=M,g):(P=P!==null,M=!1,p===null?Hd(g):M=p.memoizedState!==null,P&&!M&&(g.child.flags|=8192,(g.mode&1)!==0&&(p===null||(tr.current&1)!==0?lr===0&&(lr=3):Vp())),g.updateQueue!==null&&(g.flags|=4),pr(g),null);case 4:return Su(),ic(p,g),p===null&&Ue(g.stateNode.containerInfo),pr(g),null;case 10:return Bd(g.type._context),pr(g),null;case 17:return kn(g.type)&&Is(),pr(g),null;case 19:if(Yt(tr),L=g.memoizedState,L===null)return pr(g),null;if(P=(g.flags&128)!==0,z=L.rendering,z===null)if(P)pa(L,!1);else{if(lr!==0||p!==null&&(p.flags&128)!==0)for(p=g.child;p!==null;){if(z=wp(p),z!==null){for(g.flags|=128,pa(L,!1),p=z.updateQueue,p!==null&&(g.updateQueue=p,g.flags|=4),g.subtreeFlags=0,p=M,P=g.child;P!==null;)M=P,L=p,M.flags&=14680066,z=M.alternate,z===null?(M.childLanes=0,M.lanes=L,M.child=null,M.subtreeFlags=0,M.memoizedProps=null,M.memoizedState=null,M.updateQueue=null,M.dependencies=null,M.stateNode=null):(M.childLanes=z.childLanes,M.lanes=z.lanes,M.child=z.child,M.subtreeFlags=0,M.deletions=null,M.memoizedProps=z.memoizedProps,M.memoizedState=z.memoizedState,M.updateQueue=z.updateQueue,M.type=z.type,L=z.dependencies,M.dependencies=L===null?null:{lanes:L.lanes,firstContext:L.firstContext}),P=P.sibling;return Lt(tr,tr.current&1|2),g.child}p=p.sibling}L.tail!==null&&Rr()>ll&&(g.flags|=128,P=!0,pa(L,!1),g.lanes=4194304)}else{if(!P)if(p=wp(z),p!==null){if(g.flags|=128,P=!0,p=p.updateQueue,p!==null&&(g.updateQueue=p,g.flags|=4),pa(L,!0),L.tail===null&&L.tailMode==="hidden"&&!z.alternate&&!Zn)return pr(g),null}else 2*Rr()-L.renderingStartTime>ll&&M!==1073741824&&(g.flags|=128,P=!0,pa(L,!1),g.lanes=4194304);L.isBackwards?(z.sibling=g.child,g.child=z):(p=L.last,p!==null?p.sibling=z:g.child=z,L.last=z)}return L.tail!==null?(g=L.tail,L.rendering=g,L.tail=g.sibling,L.renderingStartTime=Rr(),g.sibling=null,p=tr.current,Lt(tr,P?p&1|2:p&1),g):(pr(g),null);case 22:case 23:return ff(),P=g.memoizedState!==null,p!==null&&p.memoizedState!==null!==P&&(g.flags|=8192),P&&(g.mode&1)!==0?(di&1073741824)!==0&&(pr(g),Xe&&g.subtreeFlags&6&&(g.flags|=8192)):pr(g),null;case 24:return null;case 25:return null}throw Error(o(156,g.tag))}var Tv=a.ReactCurrentOwner,Fr=!1;function ar(p,g,M,P){g.child=p===null?Ax(g,null,M,P):da(g,p.child,M,P)}function $n(p,g,M,P,L){M=M.render;var z=g.ref;return mu(g,L),P=Mu(p,g,M,P,z,L),M=rl(),p!==null&&!Fr?(g.updateQueue=p.updateQueue,g.flags&=-2053,p.lanes&=~L,qi(p,g,L)):(Zn&&M&&fv(g),g.flags|=1,ar(p,g,P,L),g.child)}function Gn(p,g,M,P,L){if(p===null){var z=M.type;return typeof z=="function"&&!Wp(z)&&z.defaultProps===void 0&&M.compare===null&&M.defaultProps===void 0?(g.tag=15,g.type=z,ma(p,g,z,P,L)):(p=$p(M.type,null,P,g,g.mode,L),p.ref=g.ref,p.return=g,g.child=p)}if(z=p.child,(p.lanes&L)===0){var ie=z.memoizedProps;if(M=M.compare,M=M!==null?M:to,M(ie,P)&&p.ref===g.ref)return qi(p,g,L)}return g.flags|=1,p=Ma(z,P),p.ref=g.ref,p.return=g,g.child=p}function ma(p,g,M,P,L){if(p!==null&&to(p.memoizedProps,P)&&p.ref===g.ref)if(Fr=!1,(p.lanes&L)!==0)(p.flags&131072)!==0&&(Fr=!0);else return g.lanes=p.lanes,qi(p,g,L);return ga(p,g,M,P,L)}function Kr(p,g,M){var P=g.pendingProps,L=P.children,z=p!==null?p.memoizedState:null;if(P.mode==="hidden")if((g.mode&1)===0)g.memoizedState={baseLanes:0,cachePool:null},Lt(hc,di),di|=M;else if((M&1073741824)!==0)g.memoizedState={baseLanes:0,cachePool:null},P=z!==null?z.baseLanes:M,Lt(hc,di),di|=P;else return p=z!==null?z.baseLanes|M:M,g.lanes=g.childLanes=1073741824,g.memoizedState={baseLanes:p,cachePool:null},g.updateQueue=null,Lt(hc,di),di|=p,null;else z!==null?(P=z.baseLanes|M,g.memoizedState=null):P=M,Lt(hc,di),di|=P;return ar(p,g,L,M),g.child}function Pi(p,g){var M=g.ref;(p===null&&M!==null||p!==null&&p.ref!==M)&&(g.flags|=512,g.flags|=2097152)}function ga(p,g,M,P,L){var z=kn(M)?Pr:xn.current;return z=li(g,z),mu(g,L),M=Mu(p,g,M,P,z,L),P=rl(),p!==null&&!Fr?(g.updateQueue=p.updateQueue,g.flags&=-2053,p.lanes&=~L,qi(p,g,L)):(Zn&&P&&fv(g),g.flags|=1,ar(p,g,M,L),g.child)}function sc(p,g,M,P,L){if(kn(M)){var z=!0;Ya(g)}else z=!1;if(mu(g,L),g.stateNode===null)p!==null&&(p.alternate=null,g.alternate=null,g.flags|=2),_x(g,M,P),dv(g,M,P,L),P=!0;else if(p===null){var ie=g.stateNode,ye=g.memoizedProps;ie.props=ye;var ze=ie.context,tt=M.contextType;typeof tt=="object"&&tt!==null?tt=$i(tt):(tt=kn(M)?Pr:xn.current,tt=li(g,tt));var St=M.getDerivedStateFromProps,rn=typeof St=="function"||typeof ie.getSnapshotBeforeUpdate=="function";rn||typeof ie.UNSAFE_componentWillReceiveProps!="function"&&typeof ie.componentWillReceiveProps!="function"||(ye!==P||ze!==tt)&&wx(g,ie,P,tt),Ds=!1;var Bt=g.memoizedState;ie.state=Bt,mp(g,P,ie,L),ze=g.memoizedState,ye!==P||Bt!==ze||en.current||Ds?(typeof St=="function"&&(cv(g,M,St,P),ze=g.memoizedState),(ye=Ds||uv(g,M,ye,P,Bt,ze,tt))?(rn||typeof ie.UNSAFE_componentWillMount!="function"&&typeof ie.componentWillMount!="function"||(typeof ie.componentWillMount=="function"&&ie.componentWillMount(),typeof ie.UNSAFE_componentWillMount=="function"&&ie.UNSAFE_componentWillMount()),typeof ie.componentDidMount=="function"&&(g.flags|=4194308)):(typeof ie.componentDidMount=="function"&&(g.flags|=4194308),g.memoizedProps=P,g.memoizedState=ze),ie.props=P,ie.state=ze,ie.context=tt,P=ye):(typeof ie.componentDidMount=="function"&&(g.flags|=4194308),P=!1)}else{ie=g.stateNode,lv(p,g),ye=g.memoizedProps,tt=g.type===g.elementType?ye:Wi(g.type,ye),ie.props=tt,rn=g.pendingProps,Bt=ie.context,ze=M.contextType,typeof ze=="object"&&ze!==null?ze=$i(ze):(ze=kn(M)?Pr:xn.current,ze=li(g,ze));var ln=M.getDerivedStateFromProps;(St=typeof ln=="function"||typeof ie.getSnapshotBeforeUpdate=="function")||typeof ie.UNSAFE_componentWillReceiveProps!="function"&&typeof ie.componentWillReceiveProps!="function"||(ye!==rn||Bt!==ze)&&wx(g,ie,P,ze),Ds=!1,Bt=g.memoizedState,ie.state=Bt,mp(g,P,ie,L);var bt=g.memoizedState;ye!==rn||Bt!==bt||en.current||Ds?(typeof ln=="function"&&(cv(g,M,ln,P),bt=g.memoizedState),(tt=Ds||uv(g,M,tt,P,Bt,bt,ze)||!1)?(St||typeof ie.UNSAFE_componentWillUpdate!="function"&&typeof ie.componentWillUpdate!="function"||(typeof ie.componentWillUpdate=="function"&&ie.componentWillUpdate(P,bt,ze),typeof ie.UNSAFE_componentWillUpdate=="function"&&ie.UNSAFE_componentWillUpdate(P,bt,ze)),typeof ie.componentDidUpdate=="function"&&(g.flags|=4),typeof ie.getSnapshotBeforeUpdate=="function"&&(g.flags|=1024)):(typeof ie.componentDidUpdate!="function"||ye===p.memoizedProps&&Bt===p.memoizedState||(g.flags|=4),typeof ie.getSnapshotBeforeUpdate!="function"||ye===p.memoizedProps&&Bt===p.memoizedState||(g.flags|=1024),g.memoizedProps=P,g.memoizedState=bt),ie.props=P,ie.state=bt,ie.context=ze,P=tt):(typeof ie.componentDidUpdate!="function"||ye===p.memoizedProps&&Bt===p.memoizedState||(g.flags|=4),typeof ie.getSnapshotBeforeUpdate!="function"||ye===p.memoizedProps&&Bt===p.memoizedState||(g.flags|=1024),P=!1)}return ui(p,g,M,P,z,L)}function ui(p,g,M,P,L,z){Pi(p,g);var ie=(g.flags&128)!==0;if(!P&&!ie)return L&&Xr(g,M,!1),qi(p,g,z);P=g.stateNode,Tv.current=g;var ye=ie&&typeof M.getDerivedStateFromError!="function"?null:P.render();return g.flags|=1,p!==null&&ie?(g.child=da(g,p.child,null,z),g.child=da(g,null,ye,z)):ar(p,g,ye,z),g.memoizedState=P.state,L&&Xr(g,M,!0),g.child}function Qd(p){var g=p.stateNode;g.pendingContext?Vn(p,g.pendingContext,g.pendingContext!==g.context):g.context&&Vn(p,g.context,!1),_p(p,g.containerInfo)}function Cv(p,g,M,P,L){return xu(),bp(L),g.flags|=256,ar(p,g,M,P),g.child}var Jd={dehydrated:null,treeContext:null,retryLane:0};function oc(p){return{baseLanes:p,cachePool:null}}function Pv(p,g,M){var P=g.pendingProps,L=tr.current,z=!1,ie=(g.flags&128)!==0,ye;if((ye=ie)||(ye=p!==null&&p.memoizedState===null?!1:(L&2)!==0),ye?(z=!0,g.flags&=-129):(p===null||p.memoizedState!==null)&&(L|=1),Lt(tr,L&1),p===null)return tl(g),p=g.memoizedState,p!==null&&(p=p.dehydrated,p!==null)?((g.mode&1)===0?g.lanes=1:Ns(p)?g.lanes=8:g.lanes=1073741824,null):(L=P.children,p=P.fallback,z?(P=g.mode,z=g.child,L={mode:"hidden",children:L},(P&1)===0&&z!==null?(z.childLanes=0,z.pendingProps=L):z=mf(L,P,0,null),p=yc(p,P,M,null),z.return=g,p.return=g,z.sibling=p,g.child=z,g.child.memoizedState=oc(M),g.memoizedState=Jd,p):so(g,L));if(L=p.memoizedState,L!==null){if(ye=L.dehydrated,ye!==null){if(ie)return g.flags&256?(g.flags&=-257,tf(p,g,M,Error(o(422)))):g.memoizedState!==null?(g.child=p.child,g.flags|=128,null):(z=P.fallback,L=g.mode,P=mf({mode:"visible",children:P.children},L,0,null),z=yc(z,L,M,null),z.flags|=2,P.return=g,z.return=g,P.sibling=z,g.child=P,(g.mode&1)!==0&&da(g,p.child,null,M),g.child.memoizedState=oc(M),g.memoizedState=Jd,z);if((g.mode&1)===0)g=tf(p,g,M,null);else if(Ns(ye))g=tf(p,g,M,Error(o(419)));else if(P=(M&p.childLanes)!==0,Fr||P){if(P=mr,P!==null){switch(M&-M){case 4:z=2;break;case 16:z=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:z=32;break;case 536870912:z=268435456;break;default:z=0}P=(z&(P.suspendedLanes|M))!==0?0:z,P!==0&&P!==L.retryLane&&(L.retryLane=P,fi(p,P,-1))}Vp(),g=tf(p,g,M,Error(o(421)))}else Ka(ye)?(g.flags|=128,g.child=p.child,g=Dx.bind(null,p),ia(ye,g),g=null):(M=L.treeContext,Q&&(qr=cu(ye),Ci=g,Zn=!0,js=null,yu=!1,M!==null&&(Us[us++]=ca,Us[us++]=ua,Us[us++]=Kl,ca=M.id,ua=M.overflow,Kl=g)),g=so(g,g.pendingProps.children),g.flags|=4096);return g}return z?(P=Up(p,g,P.children,P.fallback,M),z=g.child,L=p.child.memoizedState,z.memoizedState=L===null?oc(M):{baseLanes:L.baseLanes|M,cachePool:null},z.childLanes=p.childLanes&~M,g.memoizedState=Jd,P):(M=ef(p,g,P.children,M),g.memoizedState=null,M)}return z?(P=Up(p,g,P.children,P.fallback,M),z=g.child,L=p.child.memoizedState,z.memoizedState=L===null?oc(M):{baseLanes:L.baseLanes|M,cachePool:null},z.childLanes=p.childLanes&~M,g.memoizedState=Jd,P):(M=ef(p,g,P.children,M),g.memoizedState=null,M)}function so(p,g){return g=mf({mode:"visible",children:g},p.mode,0,null),g.return=p,p.child=g}function ef(p,g,M,P){var L=p.child;return p=L.sibling,M=Ma(L,{mode:"visible",children:M}),(g.mode&1)===0&&(M.lanes=P),M.return=g,M.sibling=null,p!==null&&(P=g.deletions,P===null?(g.deletions=[p],g.flags|=16):P.push(p)),g.child=M}function Up(p,g,M,P,L){var z=g.mode;p=p.child;var ie=p.sibling,ye={mode:"hidden",children:M};return(z&1)===0&&g.child!==p?(M=g.child,M.childLanes=0,M.pendingProps=ye,g.deletions=null):(M=Ma(p,ye),M.subtreeFlags=p.subtreeFlags&14680064),ie!==null?P=Ma(ie,P):(P=yc(P,z,L,null),P.flags|=2),P.return=g,M.return=g,M.sibling=P,g.child=M,P}function tf(p,g,M,P){return P!==null&&bp(P),da(g,p.child,null,M),p=so(g,g.pendingProps.children),p.flags|=2,g.memoizedState=null,p}function Ix(p,g,M){p.lanes|=g;var P=p.alternate;P!==null&&(P.lanes|=g),ql(p.return,g,M)}function Io(p,g,M,P,L){var z=p.memoizedState;z===null?p.memoizedState={isBackwards:g,rendering:null,renderingStartTime:0,last:P,tail:M,tailMode:L}:(z.isBackwards=g,z.rendering=null,z.renderingStartTime=0,z.last=P,z.tail=M,z.tailMode=L)}function ac(p,g,M){var P=g.pendingProps,L=P.revealOrder,z=P.tail;if(ar(p,g,P.children,M),P=tr.current,(P&2)!==0)P=P&1|2,g.flags|=128;else{if(p!==null&&(p.flags&128)!==0)e:for(p=g.child;p!==null;){if(p.tag===13)p.memoizedState!==null&&Ix(p,M,g);else if(p.tag===19)Ix(p,M,g);else if(p.child!==null){p.child.return=p,p=p.child;continue}if(p===g)break e;for(;p.sibling===null;){if(p.return===null||p.return===g)break e;p=p.return}p.sibling.return=p.return,p=p.sibling}P&=1}if(Lt(tr,P),(g.mode&1)===0)g.memoizedState=null;else switch(L){case"forwards":for(M=g.child,L=null;M!==null;)p=M.alternate,p!==null&&wp(p)===null&&(L=M),M=M.sibling;M=L,M===null?(L=g.child,g.child=null):(L=M.sibling,M.sibling=null),Io(g,!1,L,M,z);break;case"backwards":for(M=null,L=g.child,g.child=null;L!==null;){if(p=L.alternate,p!==null&&wp(p)===null){g.child=L;break}p=L.sibling,L.sibling=M,M=L,L=p}Io(g,!0,M,null,z);break;case"together":Io(g,!1,null,null,void 0);break;default:g.memoizedState=null}return g.child}function qi(p,g,M){if(p!==null&&(g.dependencies=p.dependencies),ko|=g.lanes,(M&g.childLanes)===0)return null;if(p!==null&&g.child!==p.child)throw Error(o(153));if(g.child!==null){for(p=g.child,M=Ma(p,p.pendingProps),g.child=M,M.return=g;p.sibling!==null;)p=p.sibling,M=M.sibling=Ma(p,p.pendingProps),M.return=g;M.sibling=null}return g.child}function jp(p,g,M){switch(g.tag){case 3:Qd(g),xu();break;case 5:Tx(g);break;case 1:kn(g.type)&&Ya(g);break;case 4:_p(g,g.stateNode.containerInfo);break;case 10:Xl(g,g.type._context,g.memoizedProps.value);break;case 13:var P=g.memoizedState;if(P!==null)return P.dehydrated!==null?(Lt(tr,tr.current&1),g.flags|=128,null):(M&g.child.childLanes)!==0?Pv(p,g,M):(Lt(tr,tr.current&1),p=qi(p,g,M),p!==null?p.sibling:null);Lt(tr,tr.current&1);break;case 19:if(P=(M&g.childLanes)!==0,(p.flags&128)!==0){if(P)return ac(p,g,M);g.flags|=128}var L=g.memoizedState;if(L!==null&&(L.rendering=null,L.tail=null,L.lastEffect=null),Lt(tr,tr.current),P)break;return null;case 22:case 23:return g.lanes=0,Kr(p,g,M)}return qi(p,g,M)}function Fp(p,g){switch(hv(g),g.tag){case 1:return kn(g.type)&&Is(),p=g.flags,p&65536?(g.flags=p&-65537|128,g):null;case 3:return Su(),Yt(en),Yt(xn),Jl(),p=g.flags,(p&65536)!==0&&(p&128)===0?(g.flags=p&-65537|128,g):null;case 5:return gv(g),null;case 13:if(Yt(tr),p=g.memoizedState,p!==null&&p.dehydrated!==null){if(g.alternate===null)throw Error(o(340));xu()}return p=g.flags,p&65536?(g.flags=p&-65537|128,g):null;case 19:return Yt(tr),null;case 4:return Su(),null;case 10:return Bd(g.type._context),null;case 22:case 23:return ff(),null;case 24:return null;default:return null}}var Ri=!1,zr=!1,lc=typeof WeakSet=="function"?WeakSet:Set,ct=null;function Fs(p,g){var M=p.ref;if(M!==null)if(typeof M=="function")try{M(null)}catch(P){Ii(p,g,P)}else M.current=null}function va(p,g,M){try{M()}catch(P){Ii(p,g,P)}}var Rv=!1;function Nv(p,g){for(K(p.containerInfo),ct=g;ct!==null;)if(p=ct,g=p.child,(p.subtreeFlags&1028)!==0&&g!==null)g.return=p,ct=g;else for(;ct!==null;){p=ct;try{var M=p.alternate;if((p.flags&1024)!==0)switch(p.tag){case 0:case 11:case 15:break;case 1:if(M!==null){var P=M.memoizedProps,L=M.memoizedState,z=p.stateNode,ie=z.getSnapshotBeforeUpdate(p.elementType===p.type?P:Wi(p.type,P),L);z.__reactInternalSnapshotBeforeUpdate=ie}break;case 3:Xe&&Ke(p.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(ye){Ii(p,p.return,ye)}if(g=p.sibling,g!==null){g.return=p.return,ct=g;break}ct=p.return}return M=Rv,Rv=!1,M}function ya(p,g,M){var P=g.updateQueue;if(P=P!==null?P.lastEffect:null,P!==null){var L=P=P.next;do{if((L.tag&p)===p){var z=L.destroy;L.destroy=void 0,z!==void 0&&va(g,M,z)}L=L.next}while(L!==P)}}function Yr(p,g){if(g=g.updateQueue,g=g!==null?g.lastEffect:null,g!==null){var M=g=g.next;do{if((M.tag&p)===p){var P=M.create;M.destroy=P()}M=M.next}while(M!==g)}}function Ni(p){var g=p.ref;if(g!==null){var M=p.stateNode;switch(p.tag){case 5:p=oe(M);break;default:p=M}typeof g=="function"?g(p):g.current=p}}function qn(p,g,M){if(Po&&typeof Po.onCommitFiberUnmount=="function")try{Po.onCommitFiberUnmount(Ud,g)}catch{}switch(g.tag){case 0:case 11:case 14:case 15:if(p=g.updateQueue,p!==null&&(p=p.lastEffect,p!==null)){var P=p=p.next;do{var L=P,z=L.destroy;L=L.tag,z!==void 0&&((L&2)!==0||(L&4)!==0)&&va(g,M,z),P=P.next}while(P!==p)}break;case 1:if(Fs(g,M),p=g.stateNode,typeof p.componentWillUnmount=="function")try{p.props=g.memoizedProps,p.state=g.memoizedState,p.componentWillUnmount()}catch(ie){Ii(g,M,ie)}break;case 5:Fs(g,M);break;case 4:Xe?Ov(p,g,M):ue&&ue&&(g=g.stateNode.containerInfo,M=Kt(g),Jt(g,M))}}function zs(p,g,M){for(var P=g;;)if(qn(p,P,M),P.child===null||Xe&&P.tag===4){if(P===g)break;for(;P.sibling===null;){if(P.return===null||P.return===g)return;P=P.return}P.sibling.return=P.return,P=P.sibling}else P.child.return=P,P=P.child}function Iv(p){var g=p.alternate;g!==null&&(p.alternate=null,Iv(g)),p.child=null,p.deletions=null,p.sibling=null,p.tag===5&&(g=p.stateNode,g!==null&&Qe(g)),p.stateNode=null,p.return=null,p.dependencies=null,p.memoizedProps=null,p.memoizedState=null,p.pendingProps=null,p.stateNode=null,p.updateQueue=null}function kv(p){return p.tag===5||p.tag===3||p.tag===4}function zp(p){e:for(;;){for(;p.sibling===null;){if(p.return===null||kv(p.return))return null;p=p.return}for(p.sibling.return=p.return,p=p.sibling;p.tag!==5&&p.tag!==6&&p.tag!==18;){if(p.flags&2||p.child===null||p.tag===4)continue e;p.child.return=p,p=p.child}if(!(p.flags&2))return p.stateNode}}function Bp(p){if(Xe){e:{for(var g=p.return;g!==null;){if(kv(g))break e;g=g.return}throw Error(o(160))}var M=g;switch(M.tag){case 5:g=M.stateNode,M.flags&32&&(Ae(g),M.flags&=-33),M=zp(p),Ru(p,M,g);break;case 3:case 4:g=M.stateNode.containerInfo,M=zp(p),Hp(p,M,g);break;default:throw Error(o(161))}}}function Hp(p,g,M){var P=p.tag;if(P===5||P===6)p=p.stateNode,g?pt(M,p,g):nn(M,p);else if(P!==4&&(p=p.child,p!==null))for(Hp(p,g,M),p=p.sibling;p!==null;)Hp(p,g,M),p=p.sibling}function Ru(p,g,M){var P=p.tag;if(P===5||P===6)p=p.stateNode,g?Ut(M,p,g):ft(M,p);else if(P!==4&&(p=p.child,p!==null))for(Ru(p,g,M),p=p.sibling;p!==null;)Ru(p,g,M),p=p.sibling}function Ov(p,g,M){for(var P=g,L=!1,z,ie;;){if(!L){L=P.return;e:for(;;){if(L===null)throw Error(o(160));switch(z=L.stateNode,L.tag){case 5:ie=!1;break e;case 3:z=z.containerInfo,ie=!0;break e;case 4:z=z.containerInfo,ie=!0;break e}L=L.return}L=!0}if(P.tag===5||P.tag===6)zs(p,P,M),ie?J(z,P.stateNode):de(z,P.stateNode);else if(P.tag===18)ie?ke(z,P.stateNode):Re(z,P.stateNode);else if(P.tag===4){if(P.child!==null){z=P.stateNode.containerInfo,ie=!0,P.child.return=P,P=P.child;continue}}else if(qn(p,P,M),P.child!==null){P.child.return=P,P=P.child;continue}if(P===g)break;for(;P.sibling===null;){if(P.return===null||P.return===g)return;P=P.return,P.tag===4&&(L=!1)}P.sibling.return=P.return,P=P.sibling}}function ol(p,g){if(Xe){switch(g.tag){case 0:case 11:case 14:case 15:ya(3,g,g.return),Yr(3,g),ya(5,g,g.return);return;case 1:return;case 5:var M=g.stateNode;if(M!=null){var P=g.memoizedProps;p=p!==null?p.memoizedProps:P;var L=g.type,z=g.updateQueue;g.updateQueue=null,z!==null&&Dt(M,z,L,p,P,g)}return;case 6:if(g.stateNode===null)throw Error(o(162));M=g.memoizedProps,qe(g.stateNode,p!==null?p.memoizedProps:M,M);return;case 3:Q&&p!==null&&p.memoizedState.isDehydrated&&Y(g.stateNode.containerInfo);return;case 12:return;case 13:Nu(g);return;case 19:Nu(g);return;case 17:return}throw Error(o(163))}switch(g.tag){case 0:case 11:case 14:case 15:ya(3,g,g.return),Yr(3,g),ya(5,g,g.return);return;case 12:return;case 13:Nu(g);return;case 19:Nu(g);return;case 3:Q&&p!==null&&p.memoizedState.isDehydrated&&Y(g.stateNode.containerInfo);break;case 22:case 23:return}e:if(ue){switch(g.tag){case 1:case 5:case 6:break e;case 3:case 4:g=g.stateNode,Jt(g.containerInfo,g.pendingChildren);break e}throw Error(o(163))}}function Nu(p){var g=p.updateQueue;if(g!==null){p.updateQueue=null;var M=p.stateNode;M===null&&(M=p.stateNode=new lc),g.forEach(function(P){var L=Ux.bind(null,p,P);M.has(P)||(M.add(P),P.then(L,L))})}}function MM(p,g){for(ct=g;ct!==null;){g=ct;var M=g.deletions;if(M!==null)for(var P=0;P<M.length;P++){var L=M[P];try{var z=p;Xe?Ov(z,L,g):zs(z,L,g);var ie=L.alternate;ie!==null&&(ie.return=null),L.return=null}catch(It){Ii(L,g,It)}}if(M=g.child,(g.subtreeFlags&12854)!==0&&M!==null)M.return=g,ct=M;else for(;ct!==null;){g=ct;try{var ye=g.flags;if(ye&32&&Xe&&Ae(g.stateNode),ye&512){var ze=g.alternate;if(ze!==null){var tt=ze.ref;tt!==null&&(typeof tt=="function"?tt(null):tt.current=null)}}if(ye&8192)switch(g.tag){case 13:if(g.memoizedState!==null){var St=g.alternate;(St===null||St.memoizedState===null)&&(cf=Rr())}break;case 22:var rn=g.memoizedState!==null,Bt=g.alternate,ln=Bt!==null&&Bt.memoizedState!==null;if(M=g,Xe){e:if(P=M,L=rn,z=null,Xe)for(var bt=P;;){if(bt.tag===5){if(z===null){z=bt;var Jr=bt.stateNode;L?re(Jr):Te(bt.stateNode,bt.memoizedProps)}}else if(bt.tag===6){if(z===null){var ys=bt.stateNode;L?Fe(ys):Le(ys,bt.memoizedProps)}}else if((bt.tag!==22&&bt.tag!==23||bt.memoizedState===null||bt===P)&&bt.child!==null){bt.child.return=bt,bt=bt.child;continue}if(bt===P)break;for(;bt.sibling===null;){if(bt.return===null||bt.return===P)break e;z===bt&&(z=null),bt=bt.return}z===bt&&(z=null),bt.sibling.return=bt.return,bt=bt.sibling}}if(rn&&!ln&&(M.mode&1)!==0){ct=M;for(var Ie=M.child;Ie!==null;){for(M=ct=Ie;ct!==null;){P=ct;var be=P.child;switch(P.tag){case 0:case 11:case 14:case 15:ya(4,P,P.return);break;case 1:Fs(P,P.return);var je=P.stateNode;if(typeof je.componentWillUnmount=="function"){var gt=P.return;try{je.props=P.memoizedProps,je.state=P.memoizedState,je.componentWillUnmount()}catch(It){Ii(P,gt,It)}}break;case 5:Fs(P,P.return);break;case 22:if(P.memoizedState!==null){Dv(M);continue}}be!==null?(be.return=P,ct=be):Dv(M)}Ie=Ie.sibling}}}switch(ye&4102){case 2:Bp(g),g.flags&=-3;break;case 6:Bp(g),g.flags&=-3,ol(g.alternate,g);break;case 4096:g.flags&=-4097;break;case 4100:g.flags&=-4097,ol(g.alternate,g);break;case 4:ol(g.alternate,g)}}catch(It){Ii(g,g.return,It)}if(M=g.sibling,M!==null){M.return=g.return,ct=M;break}ct=g.return}}}function nf(p,g,M){ct=p,rf(p)}function rf(p,g,M){for(var P=(p.mode&1)!==0;ct!==null;){var L=ct,z=L.child;if(L.tag===22&&P){var ie=L.memoizedState!==null||Ri;if(!ie){var ye=L.alternate,ze=ye!==null&&ye.memoizedState!==null||zr;ye=Ri;var tt=zr;if(Ri=ie,(zr=ze)&&!tt)for(ct=L;ct!==null;)ie=ct,ze=ie.child,ie.tag===22&&ie.memoizedState!==null?cc(L):ze!==null?(ze.return=ie,ct=ze):cc(L);for(;z!==null;)ct=z,rf(z),z=z.sibling;ct=L,Ri=ye,zr=tt}Lv(p)}else(L.subtreeFlags&8772)!==0&&z!==null?(z.return=L,ct=z):Lv(p)}}function Lv(p){for(;ct!==null;){var g=ct;if((g.flags&8772)!==0){var M=g.alternate;try{if((g.flags&8772)!==0)switch(g.tag){case 0:case 11:case 15:zr||Yr(5,g);break;case 1:var P=g.stateNode;if(g.flags&4&&!zr)if(M===null)P.componentDidMount();else{var L=g.elementType===g.type?M.memoizedProps:Wi(g.type,M.memoizedProps);P.componentDidUpdate(L,M.memoizedState,P.__reactInternalSnapshotBeforeUpdate)}var z=g.updateQueue;z!==null&&xx(g,z,P);break;case 3:var ie=g.updateQueue;if(ie!==null){if(M=null,g.child!==null)switch(g.child.tag){case 5:M=oe(g.child.stateNode);break;case 1:M=g.child.stateNode}xx(g,ie,M)}break;case 5:var ye=g.stateNode;M===null&&g.flags&4&&dt(ye,g.type,g.memoizedProps,g);break;case 6:break;case 4:break;case 12:break;case 13:if(Q&&g.memoizedState===null){var ze=g.alternate;if(ze!==null){var tt=ze.memoizedState;if(tt!==null){var St=tt.dehydrated;St!==null&&xe(St)}}}break;case 19:case 17:case 21:case 22:case 23:break;default:throw Error(o(163))}zr||g.flags&512&&Ni(g)}catch(rn){Ii(g,g.return,rn)}}if(g===p){ct=null;break}if(M=g.sibling,M!==null){M.return=g.return,ct=M;break}ct=g.return}}function Dv(p){for(;ct!==null;){var g=ct;if(g===p){ct=null;break}var M=g.sibling;if(M!==null){M.return=g.return,ct=M;break}ct=g.return}}function cc(p){for(;ct!==null;){var g=ct;try{switch(g.tag){case 0:case 11:case 15:var M=g.return;try{Yr(4,g)}catch(ze){Ii(g,M,ze)}break;case 1:var P=g.stateNode;if(typeof P.componentDidMount=="function"){var L=g.return;try{P.componentDidMount()}catch(ze){Ii(g,L,ze)}}var z=g.return;try{Ni(g)}catch(ze){Ii(g,z,ze)}break;case 5:var ie=g.return;try{Ni(g)}catch(ze){Ii(g,ie,ze)}}}catch(ze){Ii(g,g.return,ze)}if(g===p){ct=null;break}var ye=g.sibling;if(ye!==null){ye.return=g.return,ct=ye;break}ct=g.return}}var sf=0,uc=1,dc=2,xa=3,Iu=4;if(typeof Symbol=="function"&&Symbol.for){var fc=Symbol.for;sf=fc("selector.component"),uc=fc("selector.has_pseudo_class"),dc=fc("selector.role"),xa=fc("selector.test_id"),Iu=fc("selector.text")}function of(p){var g=Ge(p);if(g!=null){if(typeof g.memoizedProps["data-testname"]!="string")throw Error(o(364));return g}if(p=W(p),p===null)throw Error(o(362));return p.stateNode.current}function af(p,g){switch(g.$$typeof){case sf:if(p.type===g.value)return!0;break;case uc:e:{g=g.value,p=[p,0];for(var M=0;M<p.length;){var P=p[M++],L=p[M++],z=g[L];if(P.tag!==5||!le(P)){for(;z!=null&&af(P,z);)L++,z=g[L];if(L===g.length){g=!0;break e}else for(P=P.child;P!==null;)p.push(P,L),P=P.sibling}}g=!1}return g;case dc:if(p.tag===5&&Ce(p.stateNode,g.value))return!0;break;case Iu:if((p.tag===5||p.tag===6)&&(p=Be(p),p!==null&&0<=p.indexOf(g.value)))return!0;break;case xa:if(p.tag===5&&(p=p.memoizedProps["data-testname"],typeof p=="string"&&p.toLowerCase()===g.value.toLowerCase()))return!0;break;default:throw Error(o(365))}return!1}function al(p){switch(p.$$typeof){case sf:return"<"+(D(p.value)||"Unknown")+">";case uc:return":has("+(al(p)||"")+")";case dc:return'[role="'+p.value+'"]';case Iu:return'"'+p.value+'"';case xa:return'[data-testname="'+p.value+'"]';default:throw Error(o(365))}}function ps(p,g){var M=[];p=[p,0];for(var P=0;P<p.length;){var L=p[P++],z=p[P++],ie=g[z];if(L.tag!==5||!le(L)){for(;ie!=null&&af(L,ie);)z++,ie=g[z];if(z===g.length)M.push(L);else for(L=L.child;L!==null;)p.push(L,z),L=L.sibling}}return M}function ba(p,g){if(!ee)throw Error(o(363));p=of(p),p=ps(p,g),g=[],p=Array.from(p);for(var M=0;M<p.length;){var P=p[M++];if(P.tag===5)le(P)||g.push(P.stateNode);else for(P=P.child;P!==null;)p.push(P),P=P.sibling}return g}var Uv=Math.ceil,lf=a.ReactCurrentDispatcher,oo=a.ReactCurrentOwner,Fn=a.ReactCurrentBatchConfig,an=0,mr=null,zn=null,Qn=0,di=0,hc=yn(0),lr=0,ku=null,ko=0,ms=0,pc=0,_a=null,xr=null,cf=0,ll=1/0;function mc(){ll=Rr()+500}var Ou=!1,Kn=null,ao=null,Lu=!1,Oo=null,gc=0,vc=0,wa=null,Xn=-1,cr=0;function Rn(){return(an&6)!==0?Rr():Xn!==-1?Xn:Xn=Rr()}function lo(p){return(p.mode&1)===0?1:(an&2)!==0&&Qn!==0?Qn&-Qn:yx.transition!==null?(cr===0&&(p=fu,fu<<=1,(fu&4194240)===0&&(fu=64),cr=p),cr):(p=dn,p!==0?p:We())}function fi(p,g,M){if(50<vc)throw vc=0,wa=null,Error(o(185));var P=cl(p,g);return P===null?null:(Vl(P,g,M),((an&2)===0||P!==mr)&&(P===mr&&((an&2)===0&&(ms|=g),lr===4&&Qr(P,Qn)),Ki(P,M),g===1&&an===0&&(p.mode&1)===0&&(mc(),cp&&Os())),P)}function cl(p,g){p.lanes|=g;var M=p.alternate;for(M!==null&&(M.lanes|=g),M=p,p=p.return;p!==null;)p.childLanes|=g,M=p.alternate,M!==null&&(M.childLanes|=g),M=p,p=p.return;return M.tag===3?M.stateNode:null}function Ki(p,g){var M=p.callbackNode;vx(p,g);var P=Dd(p,p===mr?Qn:0);if(P===0)M!==null&&pu(M),p.callbackNode=null,p.callbackPriority=0;else if(g=P&-P,p.callbackPriority!==g){if(M!=null&&pu(M),g===1)p.tag===0?dp(gs.bind(null,p)):up(gs.bind(null,p)),xt?at(function(){an===0&&Os()}):Gl(Wl,Os),M=null;else{switch(oa(P)){case 1:M=Wl;break;case 4:M=_M;break;case 16:M=ap;break;case 536870912:M=lp;break;default:M=ap}M=Gp(M,Zr.bind(null,p))}p.callbackPriority=g,p.callbackNode=M}}function Zr(p,g){if(Xn=-1,cr=0,(an&6)!==0)throw Error(o(327));var M=p.callbackNode;if(Lo()&&p.callbackNode!==M)return null;var P=Dd(p,p===mr?Qn:0);if(P===0)return null;if((P&30)!==0||(P&p.expiredLanes)!==0||g)g=hf(p,P);else{g=P;var L=an;an|=2;var z=zv();(mr!==p||Qn!==g)&&(mc(),Sa(p,g));do try{Ox();break}catch(ye){Fv(p,ye)}while(!0);Ti(),lf.current=z,an=L,zn!==null?g=0:(mr=null,Qn=0,g=lr)}if(g!==0){if(g===2&&(L=ip(p),L!==0&&(P=L,g=uf(p,L))),g===1)throw M=ku,Sa(p,0),Qr(p,P),Ki(p,Rr()),M;if(g===6)Qr(p,P);else{if(L=p.current.alternate,(P&30)===0&&!jv(L)&&(g=hf(p,P),g===2&&(z=ip(p),z!==0&&(P=z,g=uf(p,z))),g===1))throw M=ku,Sa(p,0),Qr(p,P),Ki(p,Rr()),M;switch(p.finishedWork=L,p.finishedLanes=P,g){case 0:case 1:throw Error(o(345));case 2:co(p,xr);break;case 3:if(Qr(p,P),(P&130023424)===P&&(g=cf+500-Rr(),10<g)){if(Dd(p,0)!==0)break;if(L=p.suspendedLanes,(L&P)!==P){Rn(),p.pingedLanes|=p.suspendedLanes&L;break}p.timeoutHandle=Se(co.bind(null,p,xr),g);break}co(p,xr);break;case 4:if(Qr(p,P),(P&4194240)===P)break;for(g=p.eventTimes,L=-1;0<P;){var ie=31-ci(P);z=1<<ie,ie=g[ie],ie>L&&(L=ie),P&=~z}if(P=L,P=Rr()-P,P=(120>P?120:480>P?480:1080>P?1080:1920>P?1920:3e3>P?3e3:4320>P?4320:1960*Uv(P/1960))-P,10<P){p.timeoutHandle=Se(co.bind(null,p,xr),P);break}co(p,xr);break;case 5:co(p,xr);break;default:throw Error(o(329))}}}return Ki(p,Rr()),p.callbackNode===M?Zr.bind(null,p):null}function uf(p,g){var M=_a;return p.current.memoizedState.isDehydrated&&(Sa(p,g).flags|=256),p=hf(p,g),p!==2&&(g=xr,xr=M,g!==null&&df(g)),p}function df(p){xr===null?xr=p:xr.push.apply(xr,p)}function jv(p){for(var g=p;;){if(g.flags&16384){var M=g.updateQueue;if(M!==null&&(M=M.stores,M!==null))for(var P=0;P<M.length;P++){var L=M[P],z=L.getSnapshot;L=L.value;try{if(!Ai(z(),L))return!1}catch{return!1}}}if(M=g.child,g.subtreeFlags&16384&&M!==null)M.return=g,g=M;else{if(g===p)break;for(;g.sibling===null;){if(g.return===null||g.return===p)return!0;g=g.return}g.sibling.return=g.return,g=g.sibling}}return!0}function Qr(p,g){for(g&=~pc,g&=~ms,p.suspendedLanes|=g,p.pingedLanes&=~g,p=p.expirationTimes;0<g;){var M=31-ci(g),P=1<<M;p[M]=-1,g&=~P}}function gs(p){if((an&6)!==0)throw Error(o(327));Lo();var g=Dd(p,0);if((g&1)===0)return Ki(p,Rr()),null;var M=hf(p,g);if(p.tag!==0&&M===2){var P=ip(p);P!==0&&(g=P,M=uf(p,P))}if(M===1)throw M=ku,Sa(p,0),Qr(p,g),Ki(p,Rr()),M;if(M===6)throw Error(o(345));return p.finishedWork=p.current.alternate,p.finishedLanes=g,co(p,xr),Ki(p,Rr()),null}function Du(p){Oo!==null&&Oo.tag===0&&(an&6)===0&&Lo();var g=an;an|=1;var M=Fn.transition,P=dn;try{if(Fn.transition=null,dn=1,p)return p()}finally{dn=P,Fn.transition=M,an=g,(an&6)===0&&Os()}}function ff(){di=hc.current,Yt(hc)}function Sa(p,g){p.finishedWork=null,p.finishedLanes=0;var M=p.timeoutHandle;if(M!==Me&&(p.timeoutHandle=Me,$e(M)),zn!==null)for(M=zn.return;M!==null;){var P=M;switch(hv(P),P.tag){case 1:P=P.type.childContextTypes,P!=null&&Is();break;case 3:Su(),Yt(en),Yt(xn),Jl();break;case 5:gv(P);break;case 4:Su();break;case 13:Yt(tr);break;case 19:Yt(tr);break;case 10:Bd(P.type._context);break;case 22:case 23:ff()}M=M.return}if(mr=p,zn=p=Ma(p.current,null),Qn=di=g,lr=0,ku=null,pc=ms=ko=0,xr=_a=null,Ls!==null){for(g=0;g<Ls.length;g++)if(M=Ls[g],P=M.interleaved,P!==null){M.interleaved=null;var L=P.next,z=M.pending;if(z!==null){var ie=z.next;z.next=L,P.next=ie}M.pending=P}Ls=null}return p}function Fv(p,g){do{var M=zn;try{if(Ti(),Vd.current=Cu,Sp){for(var P=nr.memoizedState;P!==null;){var L=P.queue;L!==null&&(L.pending=null),P=P.next}Sp=!1}if(ec=0,Ur=Dr=nr=null,Ro=!1,tc=0,oo.current=null,M===null||M.return===null){lr=1,ku=g,zn=null;break}e:{var z=p,ie=M.return,ye=M,ze=g;if(g=Qn,ye.flags|=32768,ze!==null&&typeof ze=="object"&&typeof ze.then=="function"){var tt=ze,St=ye,rn=St.tag;if((St.mode&1)===0&&(rn===0||rn===11||rn===15)){var Bt=St.alternate;Bt?(St.updateQueue=Bt.updateQueue,St.memoizedState=Bt.memoizedState,St.lanes=Bt.lanes):(St.updateQueue=null,St.memoizedState=null)}var ln=Av(ie);if(ln!==null){ln.flags&=-257,rc(ln,ie,ye,z,g),ln.mode&1&&ha(z,tt,g),g=ln,ze=tt;var bt=g.updateQueue;if(bt===null){var Jr=new Set;Jr.add(ze),g.updateQueue=Jr}else bt.add(ze);break e}else{if((g&1)===0){ha(z,tt,g),Vp();break e}ze=Error(o(426))}}else if(Zn&&ye.mode&1){var ys=Av(ie);if(ys!==null){(ys.flags&65536)===0&&(ys.flags|=256),rc(ys,ie,ye,z,g),bp(ze);break e}}z=ze,lr!==4&&(lr=2),_a===null?_a=[z]:_a.push(z),ze=Ev(ze,ye),ye=ie;do{switch(ye.tag){case 3:ye.flags|=65536,g&=-g,ye.lanes|=g;var Ie=Nx(ye,ze,g);pp(ye,Ie);break e;case 1:z=ze;var be=ye.type,je=ye.stateNode;if((ye.flags&128)===0&&(typeof be.getDerivedStateFromError=="function"||je!==null&&typeof je.componentDidCatch=="function"&&(ao===null||!ao.has(je)))){ye.flags|=65536,g&=-g,ye.lanes|=g;var gt=kp(ye,z,g);pp(ye,gt);break e}}ye=ye.return}while(ye!==null)}Hv(M)}catch(It){g=It,zn===M&&M!==null&&(zn=M=M.return);continue}break}while(!0)}function zv(){var p=lf.current;return lf.current=Cu,p===null?Cu:p}function Vp(){(lr===0||lr===3||lr===2)&&(lr=4),mr===null||(ko&268435455)===0&&(ms&268435455)===0||Qr(mr,Qn)}function hf(p,g){var M=an;an|=2;var P=zv();mr===p&&Qn===g||Sa(p,g);do try{kx();break}catch(L){Fv(p,L)}while(!0);if(Ti(),an=M,lf.current=P,zn!==null)throw Error(o(261));return mr=null,Qn=0,lr}function kx(){for(;zn!==null;)Bv(zn)}function Ox(){for(;zn!==null&&!Qa();)Bv(zn)}function Bv(p){var g=Wv(p.alternate,p,di);p.memoizedProps=p.pendingProps,g===null?Hv(p):zn=g,oo.current=null}function Hv(p){var g=p;do{var M=g.alternate;if(p=g.return,(g.flags&32768)===0){if(M=Dp(M,g,di),M!==null){zn=M;return}}else{if(M=Fp(M,g),M!==null){M.flags&=32767,zn=M;return}if(p!==null)p.flags|=32768,p.subtreeFlags=0,p.deletions=null;else{lr=6,zn=null;return}}if(g=g.sibling,g!==null){zn=g;return}zn=g=p}while(g!==null);lr===0&&(lr=5)}function co(p,g){var M=dn,P=Fn.transition;try{Fn.transition=null,dn=1,Lx(p,g,M)}finally{Fn.transition=P,dn=M}return null}function Lx(p,g,M){do Lo();while(Oo!==null);if((an&6)!==0)throw Error(o(327));var P=p.finishedWork,L=p.finishedLanes;if(P===null)return null;if(p.finishedWork=null,p.finishedLanes=0,P===p.current)throw Error(o(177));p.callbackNode=null,p.callbackPriority=0;var z=P.lanes|P.childLanes;if(op(p,z),p===mr&&(zn=mr=null,Qn=0),(P.subtreeFlags&2064)===0&&(P.flags&2064)===0||Lu||(Lu=!0,Gp(ap,function(){return Lo(),null})),z=(P.flags&15990)!==0,(P.subtreeFlags&15990)!==0||z){z=Fn.transition,Fn.transition=null;var ie=dn;dn=1;var ye=an;an|=4,oo.current=null,Nv(p,P),MM(p,P),q(p.containerInfo),p.current=P,nf(P),bM(),an=ye,dn=ie,Fn.transition=z}else p.current=P;if(Lu&&(Lu=!1,Oo=p,gc=L),z=p.pendingLanes,z===0&&(ao=null),jd(P.stateNode),Ki(p,Rr()),g!==null)for(M=p.onRecoverableError,P=0;P<g.length;P++)M(g[P]);if(Ou)throw Ou=!1,p=Kn,Kn=null,p;return(gc&1)!==0&&p.tag!==0&&Lo(),z=p.pendingLanes,(z&1)!==0?p===wa?vc++:(vc=0,wa=p):vc=0,Os(),null}function Lo(){if(Oo!==null){var p=oa(gc),g=Fn.transition,M=dn;try{if(Fn.transition=null,dn=16>p?16:p,Oo===null)var P=!1;else{if(p=Oo,Oo=null,gc=0,(an&6)!==0)throw Error(o(331));var L=an;for(an|=4,ct=p.current;ct!==null;){var z=ct,ie=z.child;if((ct.flags&16)!==0){var ye=z.deletions;if(ye!==null){for(var ze=0;ze<ye.length;ze++){var tt=ye[ze];for(ct=tt;ct!==null;){var St=ct;switch(St.tag){case 0:case 11:case 15:ya(8,St,z)}var rn=St.child;if(rn!==null)rn.return=St,ct=rn;else for(;ct!==null;){St=ct;var Bt=St.sibling,ln=St.return;if(Iv(St),St===tt){ct=null;break}if(Bt!==null){Bt.return=ln,ct=Bt;break}ct=ln}}}var bt=z.alternate;if(bt!==null){var Jr=bt.child;if(Jr!==null){bt.child=null;do{var ys=Jr.sibling;Jr.sibling=null,Jr=ys}while(Jr!==null)}}ct=z}}if((z.subtreeFlags&2064)!==0&&ie!==null)ie.return=z,ct=ie;else e:for(;ct!==null;){if(z=ct,(z.flags&2048)!==0)switch(z.tag){case 0:case 11:case 15:ya(9,z,z.return)}var Ie=z.sibling;if(Ie!==null){Ie.return=z.return,ct=Ie;break e}ct=z.return}}var be=p.current;for(ct=be;ct!==null;){ie=ct;var je=ie.child;if((ie.subtreeFlags&2064)!==0&&je!==null)je.return=ie,ct=je;else e:for(ie=be;ct!==null;){if(ye=ct,(ye.flags&2048)!==0)try{switch(ye.tag){case 0:case 11:case 15:Yr(9,ye)}}catch(It){Ii(ye,ye.return,It)}if(ye===ie){ct=null;break e}var gt=ye.sibling;if(gt!==null){gt.return=ye.return,ct=gt;break e}ct=ye.return}}if(an=L,Os(),Po&&typeof Po.onPostCommitFiberRoot=="function")try{Po.onPostCommitFiberRoot(Ud,p)}catch{}P=!0}return P}finally{dn=M,Fn.transition=g}}return!1}function pf(p,g,M){g=Ev(M,g),g=Nx(p,g,1),Ja(p,g),g=Rn(),p=cl(p,1),p!==null&&(Vl(p,1,g),Ki(p,g))}function Ii(p,g,M){if(p.tag===3)pf(p,p,M);else for(;g!==null;){if(g.tag===3){pf(g,p,M);break}else if(g.tag===1){var P=g.stateNode;if(typeof g.type.getDerivedStateFromError=="function"||typeof P.componentDidCatch=="function"&&(ao===null||!ao.has(P))){p=Ev(M,p),p=kp(g,p,1),Ja(g,p),p=Rn(),g=cl(g,1),g!==null&&(Vl(g,1,p),Ki(g,p));break}}g=g.return}}function Vv(p,g,M){var P=p.pingCache;P!==null&&P.delete(g),g=Rn(),p.pingedLanes|=p.suspendedLanes&M,mr===p&&(Qn&M)===M&&(lr===4||lr===3&&(Qn&130023424)===Qn&&500>Rr()-cf?Sa(p,0):pc|=M),Ki(p,g)}function Gv(p,g){g===0&&((p.mode&1)===0?g=1:(g=Pn,Pn<<=1,(Pn&130023424)===0&&(Pn=4194304)));var M=Rn();p=cl(p,g),p!==null&&(Vl(p,g,M),Ki(p,M))}function Dx(p){var g=p.memoizedState,M=0;g!==null&&(M=g.retryLane),Gv(p,M)}function Ux(p,g){var M=0;switch(p.tag){case 13:var P=p.stateNode,L=p.memoizedState;L!==null&&(M=L.retryLane);break;case 19:P=p.stateNode;break;default:throw Error(o(314))}P!==null&&P.delete(g),Gv(p,M)}var Wv;Wv=function(p,g,M){if(p!==null)if(p.memoizedProps!==g.pendingProps||en.current)Fr=!0;else{if((p.lanes&M)===0&&(g.flags&128)===0)return Fr=!1,jp(p,g,M);Fr=(p.flags&131072)!==0}else Fr=!1,Zn&&(g.flags&1048576)!==0&&Sx(g,yp,g.index);switch(g.lanes=0,g.tag){case 2:var P=g.type;p!==null&&(p.alternate=null,g.alternate=null,g.flags|=2),p=g.pendingProps;var L=li(g,xn.current);mu(g,M),L=Mu(null,g,P,p,L,M);var z=rl();return g.flags|=1,typeof L=="object"&&L!==null&&typeof L.render=="function"&&L.$$typeof===void 0?(g.tag=1,g.memoizedState=null,g.updateQueue=null,kn(P)?(z=!0,Ya(g)):z=!1,g.memoizedState=L.state!==null&&L.state!==void 0?L.state:null,gu(g),L.updater=gp,g.stateNode=L,L._reactInternals=g,dv(g,P,p,M),g=ui(null,g,P,!0,z,M)):(g.tag=0,Zn&&z&&fv(g),ar(null,g,L,M),g=g.child),g;case 16:P=g.elementType;e:{switch(p!==null&&(p.alternate=null,g.alternate=null,g.flags|=2),p=g.pendingProps,L=P._init,P=L(P._payload),g.type=P,L=g.tag=EM(P),p=Wi(P,p),L){case 0:g=ga(null,g,P,p,M);break e;case 1:g=sc(null,g,P,p,M);break e;case 11:g=$n(null,g,P,p,M);break e;case 14:g=Gn(null,g,P,Wi(P.type,p),M);break e}throw Error(o(306,P,""))}return g;case 0:return P=g.type,L=g.pendingProps,L=g.elementType===P?L:Wi(P,L),ga(p,g,P,L,M);case 1:return P=g.type,L=g.pendingProps,L=g.elementType===P?L:Wi(P,L),sc(p,g,P,L,M);case 3:e:{if(Qd(g),p===null)throw Error(o(387));P=g.pendingProps,z=g.memoizedState,L=z.element,lv(p,g),mp(g,P,null,M);var ie=g.memoizedState;if(P=ie.element,Q&&z.isDehydrated)if(z={element:P,isDehydrated:!1,cache:ie.cache,transitions:ie.transitions},g.updateQueue.baseState=z,g.memoizedState=z,g.flags&256){L=Error(o(423)),g=Cv(p,g,P,M,L);break e}else if(P!==L){L=Error(o(424)),g=Cv(p,g,P,M,L);break e}else for(Q&&(qr=sa(g.stateNode.containerInfo),Ci=g,Zn=!0,js=null,yu=!1),M=Ax(g,null,P,M),g.child=M;M;)M.flags=M.flags&-3|4096,M=M.sibling;else{if(xu(),P===L){g=qi(p,g,M);break e}ar(p,g,P,M)}g=g.child}return g;case 5:return Tx(g),p===null&&tl(g),P=g.type,L=g.pendingProps,z=p!==null?p.memoizedProps:null,ie=L.children,fe(P,L)?ie=null:z!==null&&fe(P,z)&&(g.flags|=32),Pi(p,g),ar(p,g,ie,M),g.child;case 6:return p===null&&tl(g),null;case 13:return Pv(p,g,M);case 4:return _p(g,g.stateNode.containerInfo),P=g.pendingProps,p===null?g.child=da(g,null,P,M):ar(p,g,P,M),g.child;case 11:return P=g.type,L=g.pendingProps,L=g.elementType===P?L:Wi(P,L),$n(p,g,P,L,M);case 7:return ar(p,g,g.pendingProps,M),g.child;case 8:return ar(p,g,g.pendingProps.children,M),g.child;case 12:return ar(p,g,g.pendingProps.children,M),g.child;case 10:e:{if(P=g.type._context,L=g.pendingProps,z=g.memoizedProps,ie=L.value,Xl(g,P,ie),z!==null)if(Ai(z.value,ie)){if(z.children===L.children&&!en.current){g=qi(p,g,M);break e}}else for(z=g.child,z!==null&&(z.return=g);z!==null;){var ye=z.dependencies;if(ye!==null){ie=z.child;for(var ze=ye.firstContext;ze!==null;){if(ze.context===P){if(z.tag===1){ze=la(-1,M&-M),ze.tag=2;var tt=z.updateQueue;if(tt!==null){tt=tt.shared;var St=tt.pending;St===null?ze.next=ze:(ze.next=St.next,St.next=ze),tt.pending=ze}}z.lanes|=M,ze=z.alternate,ze!==null&&(ze.lanes|=M),ql(z.return,M,g),ye.lanes|=M;break}ze=ze.next}}else if(z.tag===10)ie=z.type===g.type?null:z.child;else if(z.tag===18){if(ie=z.return,ie===null)throw Error(o(341));ie.lanes|=M,ye=ie.alternate,ye!==null&&(ye.lanes|=M),ql(ie,M,g),ie=z.sibling}else ie=z.child;if(ie!==null)ie.return=z;else for(ie=z;ie!==null;){if(ie===g){ie=null;break}if(z=ie.sibling,z!==null){z.return=ie.return,ie=z;break}ie=ie.return}z=ie}ar(p,g,L.children,M),g=g.child}return g;case 9:return L=g.type,P=g.pendingProps.children,mu(g,M),L=$i(L),P=P(L),g.flags|=1,ar(p,g,P,M),g.child;case 14:return P=g.type,L=Wi(P,g.pendingProps),L=Wi(P.type,L),Gn(p,g,P,L,M);case 15:return ma(p,g,g.type,g.pendingProps,M);case 17:return P=g.type,L=g.pendingProps,L=g.elementType===P?L:Wi(P,L),p!==null&&(p.alternate=null,g.alternate=null,g.flags|=2),g.tag=1,kn(P)?(p=!0,Ya(g)):p=!1,mu(g,M),_x(g,P,L),dv(g,P,L,M),ui(null,g,P,!0,p,M);case 19:return ac(p,g,M);case 22:return Kr(p,g,M)}throw Error(o(156,g.tag))};function Gp(p,g){return Gl(p,g)}function jx(p,g,M,P){this.tag=p,this.key=M,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=g,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=P,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function vs(p,g,M,P){return new jx(p,g,M,P)}function Wp(p){return p=p.prototype,!(!p||!p.isReactComponent)}function EM(p){if(typeof p=="function")return Wp(p)?1:0;if(p!=null){if(p=p.$$typeof,p===S)return 11;if(p===A)return 14}return 2}function Ma(p,g){var M=p.alternate;return M===null?(M=vs(p.tag,g,p.key,p.mode),M.elementType=p.elementType,M.type=p.type,M.stateNode=p.stateNode,M.alternate=p,p.alternate=M):(M.pendingProps=g,M.type=p.type,M.flags=0,M.subtreeFlags=0,M.deletions=null),M.flags=p.flags&14680064,M.childLanes=p.childLanes,M.lanes=p.lanes,M.child=p.child,M.memoizedProps=p.memoizedProps,M.memoizedState=p.memoizedState,M.updateQueue=p.updateQueue,g=p.dependencies,M.dependencies=g===null?null:{lanes:g.lanes,firstContext:g.firstContext},M.sibling=p.sibling,M.index=p.index,M.ref=p.ref,M}function $p(p,g,M,P,L,z){var ie=2;if(P=p,typeof p=="function")Wp(p)&&(ie=1);else if(typeof p=="string")ie=5;else e:switch(p){case d:return yc(M.children,L,z,g);case f:ie=8,L|=8;break;case m:return p=vs(12,M,g,L|2),p.elementType=m,p.lanes=z,p;case _:return p=vs(13,M,g,L),p.elementType=_,p.lanes=z,p;case w:return p=vs(19,M,g,L),p.elementType=w,p.lanes=z,p;case C:return mf(M,L,z,g);default:if(typeof p=="object"&&p!==null)switch(p.$$typeof){case y:ie=10;break e;case x:ie=9;break e;case S:ie=11;break e;case A:ie=14;break e;case T:ie=16,P=null;break e}throw Error(o(130,p==null?p:typeof p,""))}return g=vs(ie,M,g,L),g.elementType=p,g.type=P,g.lanes=z,g}function yc(p,g,M,P){return p=vs(7,p,P,g),p.lanes=M,p}function mf(p,g,M,P){return p=vs(22,p,P,g),p.elementType=C,p.lanes=M,p.stateNode={},p}function Xp(p,g,M){return p=vs(6,p,null,g),p.lanes=M,p}function qp(p,g,M){return g=vs(4,p.children!==null?p.children:[],p.key,g),g.lanes=M,g.stateNode={containerInfo:p.containerInfo,pendingChildren:null,implementation:p.implementation},g}function Kp(p,g,M,P,L){this.tag=g,this.containerInfo=p,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Me,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=sp(0),this.expirationTimes=sp(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=sp(0),this.identifierPrefix=P,this.onRecoverableError=L,Q&&(this.mutableSourceEagerHydrationData=null)}function Fx(p,g,M,P,L,z,ie,ye,ze){return p=new Kp(p,g,M,ye,ze),g===1?(g=1,z===!0&&(g|=8)):g=0,z=vs(3,null,null,g),p.current=z,z.stateNode=p,z.memoizedState={element:P,isDehydrated:M,cache:null,transitions:null},gu(z),p}function zx(p){if(!p)return mt;p=p._reactInternals;e:{if(V(p)!==p||p.tag!==1)throw Error(o(170));var g=p;do{switch(g.tag){case 3:g=g.stateNode.context;break e;case 1:if(kn(g.type)){g=g.stateNode.__reactInternalMemoizedMergedChildContext;break e}}g=g.return}while(g!==null);throw Error(o(171))}if(p.tag===1){var M=p.type;if(kn(M))return eo(p,M,g)}return g}function Bx(p){var g=p._reactInternals;if(g===void 0)throw typeof p.render=="function"?Error(o(188)):(p=Object.keys(p).join(","),Error(o(268,p)));return p=H(g),p===null?null:p.stateNode}function Bs(p,g){if(p=p.memoizedState,p!==null&&p.dehydrated!==null){var M=p.retryLane;p.retryLane=M!==0&&M<g?M:g}}function gf(p,g){Bs(p,g),(p=p.alternate)&&Bs(p,g)}function Yp(p){return p=H(p),p===null?null:p.stateNode}function Hx(){return null}return n.attemptContinuousHydration=function(p){if(p.tag===13){var g=Rn();fi(p,134217728,g),gf(p,134217728)}},n.attemptHydrationAtCurrentPriority=function(p){if(p.tag===13){var g=Rn(),M=lo(p);fi(p,M,g),gf(p,M)}},n.attemptSynchronousHydration=function(p){switch(p.tag){case 3:var g=p.stateNode;if(g.current.memoizedState.isDehydrated){var M=hu(g.pendingLanes);M!==0&&(Co(g,M|1),Ki(g,Rr()),(an&6)===0&&(mc(),Os()))}break;case 13:var P=Rn();Du(function(){return fi(p,1,P)}),gf(p,1)}},n.batchedUpdates=function(p,g){var M=an;an|=1;try{return p(g)}finally{an=M,an===0&&(mc(),cp&&Os())}},n.createComponentSelector=function(p){return{$$typeof:sf,value:p}},n.createContainer=function(p,g,M,P,L,z,ie){return Fx(p,g,!1,null,M,P,L,z,ie)},n.createHasPseudoClassSelector=function(p){return{$$typeof:uc,value:p}},n.createHydrationContainer=function(p,g,M,P,L,z,ie,ye,ze){return p=Fx(M,P,!0,p,L,z,ie,ye,ze),p.context=zx(null),M=p.current,P=Rn(),L=lo(M),z=la(P,L),z.callback=g??null,Ja(M,z),p.current.lanes=L,Vl(p,L,P),Ki(p,P),p},n.createPortal=function(p,g,M){var P=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:P==null?null:""+P,children:p,containerInfo:g,implementation:M}},n.createRoleSelector=function(p){return{$$typeof:dc,value:p}},n.createTestNameSelector=function(p){return{$$typeof:xa,value:p}},n.createTextSelector=function(p){return{$$typeof:Iu,value:p}},n.deferredUpdates=function(p){var g=dn,M=Fn.transition;try{return Fn.transition=null,dn=16,p()}finally{dn=g,Fn.transition=M}},n.discreteUpdates=function(p,g,M,P,L){var z=dn,ie=Fn.transition;try{return Fn.transition=null,dn=1,p(g,M,P,L)}finally{dn=z,Fn.transition=ie,an===0&&mc()}},n.findAllNodes=ba,n.findBoundingRects=function(p,g){if(!ee)throw Error(o(363));g=ba(p,g),p=[];for(var M=0;M<g.length;M++)p.push(Ee(g[M]));for(g=p.length-1;0<g;g--){M=p[g];for(var P=M.x,L=P+M.width,z=M.y,ie=z+M.height,ye=g-1;0<=ye;ye--)if(g!==ye){var ze=p[ye],tt=ze.x,St=tt+ze.width,rn=ze.y,Bt=rn+ze.height;if(P>=tt&&z>=rn&&L<=St&&ie<=Bt){p.splice(g,1);break}else if(P!==tt||M.width!==ze.width||Bt<z||rn>ie){if(!(z!==rn||M.height!==ze.height||St<P||tt>L)){tt>P&&(ze.width+=tt-P,ze.x=P),St<L&&(ze.width=L-tt),p.splice(g,1);break}}else{rn>z&&(ze.height+=rn-z,ze.y=z),Bt<ie&&(ze.height=ie-rn),p.splice(g,1);break}}}return p},n.findHostInstance=Bx,n.findHostInstanceWithNoPortals=function(p){return p=j(p),p=p!==null?te(p):null,p===null?null:p.stateNode},n.findHostInstanceWithWarning=function(p){return Bx(p)},n.flushControlled=function(p){var g=an;an|=1;var M=Fn.transition,P=dn;try{Fn.transition=null,dn=1,p()}finally{dn=P,Fn.transition=M,an=g,an===0&&(mc(),Os())}},n.flushPassiveEffects=Lo,n.flushSync=Du,n.focusWithin=function(p,g){if(!ee)throw Error(o(363));for(p=of(p),g=ps(p,g),g=Array.from(g),p=0;p<g.length;){var M=g[p++];if(!le(M)){if(M.tag===5&<(M.stateNode))return!0;for(M=M.child;M!==null;)g.push(M),M=M.sibling}}return!1},n.getCurrentUpdatePriority=function(){return dn},n.getFindAllNodesFailureDescription=function(p,g){if(!ee)throw Error(o(363));var M=0,P=[];p=[of(p),0];for(var L=0;L<p.length;){var z=p[L++],ie=p[L++],ye=g[ie];if((z.tag!==5||!le(z))&&(af(z,ye)&&(P.push(al(ye)),ie++,ie>M&&(M=ie)),ie<g.length))for(z=z.child;z!==null;)p.push(z,ie),z=z.sibling}if(M<g.length){for(p=[];M<g.length;M++)p.push(al(g[M]));return`findAllNodes was able to match part of the selector:
|
||
`+(P.join(" > ")+`
|
||
|
||
No matching component was found for:
|
||
`)+p.join(" > ")}return null},n.getPublicRootInstance=function(p){if(p=p.current,!p.child)return null;switch(p.child.tag){case 5:return oe(p.child.stateNode);default:return p.child.stateNode}},n.injectIntoDevTools=function(p){if(p={bundleType:p.bundleType,version:p.version,rendererPackageName:p.rendererPackageName,rendererConfig:p.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:a.ReactCurrentDispatcher,findHostInstanceByFiber:Yp,findFiberByHostInstance:p.findFiberByHostInstance||Hx,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")p=!1;else{var g=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(g.isDisabled||!g.supportsFiber)p=!0;else{try{Ud=g.inject(p),Po=g}catch{}p=!!g.checkDCE}}return p},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(p,g,M,P){if(!ee)throw Error(o(363));p=ba(p,g);var L=rt(p,M,P).disconnect;return{disconnect:function(){L()}}},n.registerMutableSourceForHydration=function(p,g){var M=g._getVersion;M=M(g._source),p.mutableSourceEagerHydrationData==null?p.mutableSourceEagerHydrationData=[g,M]:p.mutableSourceEagerHydrationData.push(g,M)},n.runWithPriority=function(p,g){var M=dn;try{return dn=p,g()}finally{dn=M}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(p,g,M,P){var L=g.current,z=Rn(),ie=lo(L);return M=zx(M),g.context===null?g.context=M:g.pendingContext=M,g=la(z,ie),g.payload={element:p},P=P===void 0?null:P,P!==null&&(g.callback=P),Ja(L,g),p=fi(L,ie,z),p!==null&&hp(p,L,ie),ie},n}),FA}var wU;function ebe(){return wU||(wU=1,DA.exports=Jxe()),DA.exports}var tbe=ebe();const nbe=z1(tbe);var zA={exports:{}},BA={};/**
|
||
* @license React
|
||
* scheduler.production.min.js
|
||
*
|
||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var SU;function rbe(){return SU||(SU=1,(function(t){function e(B,K){var q=B.length;B.push(K);e:for(;0<q;){var $=q-1>>>1,Z=B[$];if(0<i(Z,K))B[$]=K,B[q]=Z,q=$;else break e}}function n(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var K=B[0],q=B.pop();if(q!==K){B[0]=q;e:for(var $=0,Z=B.length,ge=Z>>>1;$<ge;){var ae=2*($+1)-1,fe=B[ae],_e=ae+1,Se=B[_e];if(0>i(fe,q))_e<Z&&0>i(Se,fe)?(B[$]=Se,B[_e]=q,$=_e):(B[$]=fe,B[ae]=q,$=ae);else if(_e<Z&&0>i(Se,q))B[$]=Se,B[_e]=q,$=_e;else break e}}return K}function i(B,K){var q=B.sortIndex-K.sortIndex;return q!==0?q:B.id-K.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],c=[],d=1,f=null,m=3,y=!1,x=!1,S=!1,_=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function T(B){for(var K=n(c);K!==null;){if(K.callback===null)r(c);else if(K.startTime<=B)r(c),K.sortIndex=K.expirationTime,e(l,K);else break;K=n(c)}}function C(B){if(S=!1,T(B),!x)if(n(l)!==null)x=!0,oe(O);else{var K=n(c);K!==null&&ce(C,K.startTime-B)}}function O(B,K){x=!1,S&&(S=!1,w(F),F=-1),y=!0;var q=m;try{for(T(K),f=n(l);f!==null&&(!(f.expirationTime>K)||B&&!j());){var $=f.callback;if(typeof $=="function"){f.callback=null,m=f.priorityLevel;var Z=$(f.expirationTime<=K);K=t.unstable_now(),typeof Z=="function"?f.callback=Z:f===n(l)&&r(l),T(K)}else r(l);f=n(l)}if(f!==null)var ge=!0;else{var ae=n(c);ae!==null&&ce(C,ae.startTime-K),ge=!1}return ge}finally{f=null,m=q,y=!1}}var N=!1,D=null,F=-1,V=5,k=-1;function j(){return!(t.unstable_now()-k<V)}function H(){if(D!==null){var B=t.unstable_now();k=B;var K=!0;try{K=D(!0,B)}finally{K?ne():(N=!1,D=null)}}else N=!1}var ne;if(typeof A=="function")ne=function(){A(H)};else if(typeof MessageChannel<"u"){var te=new MessageChannel,pe=te.port2;te.port1.onmessage=H,ne=function(){pe.postMessage(null)}}else ne=function(){_(H,0)};function oe(B){D=B,N||(N=!0,ne())}function ce(B,K){F=_(function(){B(t.unstable_now())},K)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(B){B.callback=null},t.unstable_continueExecution=function(){x||y||(x=!0,oe(O))},t.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):V=0<B?Math.floor(1e3/B):5},t.unstable_getCurrentPriorityLevel=function(){return m},t.unstable_getFirstCallbackNode=function(){return n(l)},t.unstable_next=function(B){switch(m){case 1:case 2:case 3:var K=3;break;default:K=m}var q=m;m=K;try{return B()}finally{m=q}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(B,K){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var q=m;m=B;try{return K()}finally{m=q}},t.unstable_scheduleCallback=function(B,K,q){var $=t.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?$+q:$):q=$,B){case 1:var Z=-1;break;case 2:Z=250;break;case 5:Z=1073741823;break;case 4:Z=1e4;break;default:Z=5e3}return Z=q+Z,B={id:d++,callback:K,priorityLevel:B,startTime:q,expirationTime:Z,sortIndex:-1},q>$?(B.sortIndex=q,e(c,B),n(l)===null&&B===n(c)&&(S?(w(F),F=-1):S=!0,ce(C,q-$))):(B.sortIndex=Z,e(l,B),x||y||(x=!0,oe(O))),B},t.unstable_shouldYield=j,t.unstable_wrapCallback=function(B){var K=m;return function(){var q=m;m=K;try{return B.apply(this,arguments)}finally{m=q}}}})(BA)),BA}var MU;function ibe(){return MU||(MU=1,zA.exports=rbe()),zA.exports}var EU=ibe();const tN={},sbe=t=>void Object.assign(tN,t);function obe(t,e){function n(d,{args:f=[],attach:m,...y},x){let S=`${d[0].toUpperCase()}${d.slice(1)}`,_;if(d==="primitive"){if(y.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const w=y.object;_=Fm(w,{type:d,root:x,attach:m,primitive:!0})}else{const w=tN[S];if(!w)throw new Error(`R3F: ${S} 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(f))throw new Error("R3F: The args prop must be an array!");_=Fm(new w(...f),{type:d,root:x,attach:m,memoizedProps:{args:f}})}return _.__r3f.attach===void 0&&(_.isBufferGeometry?_.__r3f.attach="geometry":_.isMaterial&&(_.__r3f.attach="material")),S!=="inject"&&GA(_,y),_}function r(d,f){let m=!1;if(f){var y,x;(y=f.__r3f)!=null&&y.attach?VA(d,f,f.__r3f.attach):f.isObject3D&&d.isObject3D&&(d.add(f),m=!0),m||(x=d.__r3f)==null||x.objects.push(f),f.__r3f||Fm(f,{}),f.__r3f.parent=d,nP(f),zm(f)}}function i(d,f,m){let y=!1;if(f){var x,S;if((x=f.__r3f)!=null&&x.attach)VA(d,f,f.__r3f.attach);else if(f.isObject3D&&d.isObject3D){f.parent=d,f.dispatchEvent({type:"added"}),d.dispatchEvent({type:"childadded",child:f});const _=d.children.filter(A=>A!==f),w=_.indexOf(m);d.children=[..._.slice(0,w),f,..._.slice(w)],y=!0}y||(S=d.__r3f)==null||S.objects.push(f),f.__r3f||Fm(f,{}),f.__r3f.parent=d,nP(f),zm(f)}}function s(d,f,m=!1){d&&[...d].forEach(y=>o(f,y,m))}function o(d,f,m){if(f){var y,x,S;if(f.__r3f&&(f.__r3f.parent=null),(y=d.__r3f)!=null&&y.objects&&(d.__r3f.objects=d.__r3f.objects.filter(C=>C!==f)),(x=f.__r3f)!=null&&x.attach)RU(d,f,f.__r3f.attach);else if(f.isObject3D&&d.isObject3D){var _;d.remove(f),(_=f.__r3f)!=null&&_.root&&hbe(q_(f),f)}const A=(S=f.__r3f)==null?void 0:S.primitive,T=!A&&(m===void 0?f.dispose!==null:m);if(!A){var w;s((w=f.__r3f)==null?void 0:w.objects,f,T),s(f.children,f,T)}if(delete f.__r3f,T&&f.dispose&&f.type!=="Scene"){const C=()=>{try{f.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT>"u"?EU.unstable_scheduleCallback(EU.unstable_IdlePriority,C):C()}zm(d)}}function a(d,f,m,y){var x;const S=(x=d.__r3f)==null?void 0:x.parent;if(!S)return;const _=n(f,m,d.__r3f.root);if(d.children){for(const w of d.children)w.__r3f&&r(_,w);d.children=d.children.filter(w=>!w.__r3f)}d.__r3f.objects.forEach(w=>r(_,w)),d.__r3f.objects=[],d.__r3f.autoRemovedBeforeAppend||o(S,d),_.parent&&(_.__r3f.autoRemovedBeforeAppend=!0),r(S,_),_.raycast&&_.__r3f.eventCount&&q_(_).getState().internal.interaction.push(_),[y,y.alternate].forEach(w=>{w!==null&&(w.stateNode=_,w.ref&&(typeof w.ref=="function"?w.ref(_):w.ref.current=_))})}const l=()=>{};return{reconciler:nbe({createInstance:n,removeChild:o,appendChild:r,appendInitialChild:r,insertBefore:i,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(d,f)=>{if(!f)return;const m=d.getState().scene;m.__r3f&&(m.__r3f.root=d,r(m,f))},removeChildFromContainer:(d,f)=>{f&&o(d.getState().scene,f)},insertInContainerBefore:(d,f,m)=>{if(!f||!m)return;const y=d.getState().scene;y.__r3f&&i(y,f,m)},getRootHostContext:()=>null,getChildHostContext:d=>d,finalizeInitialChildren(d){var f;return!!((f=d==null?void 0:d.__r3f)!=null?f:{}).handlers},prepareUpdate(d,f,m,y){var x;if(((x=d==null?void 0:d.__r3f)!=null?x:{}).primitive&&y.object&&y.object!==d)return[!0];{const{args:_=[],children:w,...A}=y,{args:T=[],children:C,...O}=m;if(!Array.isArray(_))throw new Error("R3F: the args prop must be an array!");if(_.some((D,F)=>D!==T[F]))return[!0];const N=hG(d,A,O,!0);return N.changes.length?[!1,N]:null}},commitUpdate(d,[f,m],y,x,S,_){f?a(d,y,S,_):GA(d,m)},commitMount(d,f,m,y){var x;const S=(x=d.__r3f)!=null?x:{};d.raycast&&S.handlers&&S.eventCount&&q_(d).getState().internal.interaction.push(d)},getPublicInstance:d=>d,prepareForCommit:()=>null,preparePortalMount:d=>Fm(d.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(d){var f;const{attach:m,parent:y}=(f=d.__r3f)!=null?f:{};m&&y&&RU(y,d,m),d.isObject3D&&(d.visible=!1),zm(d)},unhideInstance(d,f){var m;const{attach:y,parent:x}=(m=d.__r3f)!=null?m:{};y&&x&&VA(x,d,y),(d.isObject3D&&f.visible==null||f.visible)&&(d.visible=!0),zm(d)},createTextInstance:l,hideTextInstance:l,unhideTextInstance:l,getCurrentEventPriority:()=>e?e():Km.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&ir.fun(performance.now)?performance.now:ir.fun(Date.now)?Date.now:()=>0,scheduleTimeout:ir.fun(setTimeout)?setTimeout:void 0,cancelTimeout:ir.fun(clearTimeout)?clearTimeout:void 0}),applyProps:GA}}var AU,TU;const HA=t=>"colorSpace"in t||"outputColorSpace"in t,aG=()=>{var t;return(t=tN.ColorManagement)!=null?t:null},lG=t=>t&&t.isOrthographicCamera,abe=t=>t&&t.hasOwnProperty("current"),gx=typeof window<"u"&&((AU=window.document)!=null&&AU.createElement||((TU=window.navigator)==null?void 0:TU.product)==="ReactNative")?R.useLayoutEffect:R.useEffect;function cG(t){const e=R.useRef(t);return gx(()=>void(e.current=t),[t]),e}function lbe({set:t}){return gx(()=>(t(new Promise(()=>null)),()=>t(!1)),[t]),null}class uG extends R.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}uG.getDerivedStateFromError=()=>({error:!0});const dG="__default",CU=new Map,cbe=t=>t&&!!t.memoized&&!!t.changes;function fG(t){var e;const n=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(t)?Math.min(Math.max(t[0],n),t[1]):t}const A0=t=>{var e;return(e=t.__r3f)==null?void 0:e.root.getState()};function q_(t){let e=t.__r3f.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const ir={obj:t=>t===Object(t)&&!ir.arr(t)&&typeof t!="function",fun:t=>typeof t=="function",str:t=>typeof t=="string",num:t=>typeof t=="number",boo:t=>typeof t=="boolean",und:t=>t===void 0,arr:t=>Array.isArray(t),equ(t,e,{arrays:n="shallow",objects:r="reference",strict:i=!0}={}){if(typeof t!=typeof e||!!t!=!!e)return!1;if(ir.str(t)||ir.num(t)||ir.boo(t))return t===e;const s=ir.obj(t);if(s&&r==="reference")return t===e;const o=ir.arr(t);if(o&&n==="reference")return t===e;if((o||s)&&t===e)return!0;let a;for(a in t)if(!(a in e))return!1;if(s&&n==="shallow"&&r==="shallow"){for(a in i?e:t)if(!ir.equ(t[a],e[a],{strict:i,objects:"reference"}))return!1}else for(a in i?e:t)if(t[a]!==e[a])return!1;if(ir.und(a)){if(o&&t.length===0&&e.length===0||s&&Object.keys(t).length===0&&Object.keys(e).length===0)return!0;if(t!==e)return!1}return!0}};function ube(t){t.dispose&&t.type!=="Scene"&&t.dispose();for(const e in t)e.dispose==null||e.dispose(),delete t[e]}function Fm(t,e){const n=t;return n.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e},t}function tP(t,e){let n=t;if(e.includes("-")){const r=e.split("-"),i=r.pop();return n=r.reduce((s,o)=>s[o],t),{target:n,key:i}}else return{target:n,key:e}}const PU=/-\d+$/;function VA(t,e,n){if(ir.str(n)){if(PU.test(n)){const s=n.replace(PU,""),{target:o,key:a}=tP(t,s);Array.isArray(o[a])||(o[a]=[])}const{target:r,key:i}=tP(t,n);e.__r3f.previousAttach=r[i],r[i]=e}else e.__r3f.previousAttach=n(t,e)}function RU(t,e,n){var r,i;if(ir.str(n)){const{target:s,key:o}=tP(t,n),a=e.__r3f.previousAttach;a===void 0?delete s[o]:s[o]=a}else(r=e.__r3f)==null||r.previousAttach==null||r.previousAttach(t,e);(i=e.__r3f)==null||delete i.previousAttach}function hG(t,{children:e,key:n,ref:r,...i},{children:s,key:o,ref:a,...l}={},c=!1){const d=t.__r3f,f=Object.entries(i),m=[];if(c){const x=Object.keys(l);for(let S=0;S<x.length;S++)i.hasOwnProperty(x[S])||f.unshift([x[S],dG+"remove"])}f.forEach(([x,S])=>{var _;if((_=t.__r3f)!=null&&_.primitive&&x==="object"||ir.equ(S,l[x]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(x))return m.push([x,S,!0,[]]);let w=[];x.includes("-")&&(w=x.split("-")),m.push([x,S,!1,w]);for(const A in i){const T=i[A];A.startsWith(`${x}-`)&&m.push([A,T,!1,A.split("-")])}});const y={...i};return d!=null&&d.memoizedProps&&d!=null&&d.memoizedProps.args&&(y.args=d.memoizedProps.args),d!=null&&d.memoizedProps&&d!=null&&d.memoizedProps.attach&&(y.attach=d.memoizedProps.attach),{memoized:y,changes:m}}function GA(t,e){var n;const r=t.__r3f,i=r==null?void 0:r.root,s=i==null||i.getState==null?void 0:i.getState(),{memoized:o,changes:a}=cbe(e)?e:hG(t,e),l=r==null?void 0:r.eventCount;t.__r3f&&(t.__r3f.memoizedProps=o);for(let m=0;m<a.length;m++){let[y,x,S,_]=a[m];if(HA(t)){const C="srgb",O="srgb-linear";y==="encoding"?(y="colorSpace",x=x===3001?C:O):y==="outputEncoding"&&(y="outputColorSpace",x=x===3001?C:O)}let w=t,A=w[y];if(_.length&&(A=_.reduce((T,C)=>T[C],t),!(A&&A.set))){const[T,...C]=_.reverse();w=C.reverse().reduce((O,N)=>O[N],t),y=T}if(x===dG+"remove")if(w.constructor){let T=CU.get(w.constructor);T||(T=new w.constructor,CU.set(w.constructor,T)),x=T[y]}else x=0;if(S&&r)x?r.handlers[y]=x:delete r.handlers[y],r.eventCount=Object.keys(r.handlers).length;else if(A&&A.set&&(A.copy||A instanceof Ah)){if(Array.isArray(x))A.fromArray?A.fromArray(x):A.set(...x);else if(A.copy&&x&&x.constructor&&A.constructor===x.constructor)A.copy(x);else if(x!==void 0){var c;const T=(c=A)==null?void 0:c.isColor;!T&&A.setScalar?A.setScalar(x):A instanceof Ah&&x instanceof Ah?A.mask=x.mask:A.set(x),!aG()&&s&&!s.linear&&T&&A.convertSRGBToLinear()}}else{var d;if(w[y]=x,(d=w[y])!=null&&d.isTexture&&w[y].format===is&&w[y].type===Ha&&s){const T=w[y];HA(T)&&HA(s.gl)?T.colorSpace=s.gl.outputColorSpace:T.encoding=s.gl.outputEncoding}}zm(t)}if(r&&r.parent&&t.raycast&&l!==r.eventCount){const m=q_(t).getState().internal,y=m.interaction.indexOf(t);y>-1&&m.interaction.splice(y,1),r.eventCount&&m.interaction.push(t)}return!(a.length===1&&a[0][0]==="onUpdate")&&a.length&&(n=t.__r3f)!=null&&n.parent&&nP(t),t}function zm(t){var e,n;const r=(e=t.__r3f)==null||(n=e.root)==null||n.getState==null?void 0:n.getState();r&&r.internal.frames===0&&r.invalidate()}function nP(t){t.onUpdate==null||t.onUpdate(t)}function dbe(t,e){t.manual||(lG(t)?(t.left=e.width/-2,t.right=e.width/2,t.top=e.height/2,t.bottom=e.height/-2):t.aspect=e.width/e.height,t.updateProjectionMatrix(),t.updateMatrixWorld())}function C_(t){return(t.eventObject||t.object).uuid+"/"+t.index+t.instanceId}function fbe(){var t;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return Km.DefaultEventPriority;switch((t=e.event)==null?void 0:t.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Km.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Km.ContinuousEventPriority;default:return Km.DefaultEventPriority}}function pG(t,e,n,r){const i=n.get(e);i&&(n.delete(e),n.size===0&&(t.delete(r),i.target.releasePointerCapture(r)))}function hbe(t,e){const{internal:n}=t.getState();n.interaction=n.interaction.filter(r=>r!==e),n.initialHits=n.initialHits.filter(r=>r!==e),n.hovered.forEach((r,i)=>{(r.eventObject===e||r.object===e)&&n.hovered.delete(i)}),n.capturedMap.forEach((r,i)=>{pG(n.capturedMap,e,r,i)})}function pbe(t){function e(l){const{internal:c}=t.getState(),d=l.offsetX-c.initialClick[0],f=l.offsetY-c.initialClick[1];return Math.round(Math.sqrt(d*d+f*f))}function n(l){return l.filter(c=>["Move","Over","Enter","Out","Leave"].some(d=>{var f;return(f=c.__r3f)==null?void 0:f.handlers["onPointer"+d]}))}function r(l,c){const d=t.getState(),f=new Set,m=[],y=c?c(d.internal.interaction):d.internal.interaction;for(let w=0;w<y.length;w++){const A=A0(y[w]);A&&(A.raycaster.camera=void 0)}d.previousRoot||d.events.compute==null||d.events.compute(l,d);function x(w){const A=A0(w);if(!A||!A.events.enabled||A.raycaster.camera===null)return[];if(A.raycaster.camera===void 0){var T;A.events.compute==null||A.events.compute(l,A,(T=A.previousRoot)==null?void 0:T.getState()),A.raycaster.camera===void 0&&(A.raycaster.camera=null)}return A.raycaster.camera?A.raycaster.intersectObject(w,!0):[]}let S=y.flatMap(x).sort((w,A)=>{const T=A0(w.object),C=A0(A.object);return!T||!C?w.distance-A.distance:C.events.priority-T.events.priority||w.distance-A.distance}).filter(w=>{const A=C_(w);return f.has(A)?!1:(f.add(A),!0)});d.events.filter&&(S=d.events.filter(S,d));for(const w of S){let A=w.object;for(;A;){var _;(_=A.__r3f)!=null&&_.eventCount&&m.push({...w,eventObject:A}),A=A.parent}}if("pointerId"in l&&d.internal.capturedMap.has(l.pointerId))for(let w of d.internal.capturedMap.get(l.pointerId).values())f.has(C_(w.intersection))||m.push(w.intersection);return m}function i(l,c,d,f){const m=t.getState();if(l.length){const y={stopped:!1};for(const x of l){const S=A0(x.object)||m,{raycaster:_,pointer:w,camera:A,internal:T}=S,C=new X(w.x,w.y,0).unproject(A),O=k=>{var j,H;return(j=(H=T.capturedMap.get(k))==null?void 0:H.has(x.eventObject))!=null?j:!1},N=k=>{const j={intersection:x,target:c.target};T.capturedMap.has(k)?T.capturedMap.get(k).set(x.eventObject,j):T.capturedMap.set(k,new Map([[x.eventObject,j]])),c.target.setPointerCapture(k)},D=k=>{const j=T.capturedMap.get(k);j&&pG(T.capturedMap,x.eventObject,j,k)};let F={};for(let k in c){let j=c[k];typeof j!="function"&&(F[k]=j)}let V={...x,...F,pointer:w,intersections:l,stopped:y.stopped,delta:d,unprojectedPoint:C,ray:_.ray,camera:A,stopPropagation(){const k="pointerId"in c&&T.capturedMap.get(c.pointerId);if((!k||k.has(x.eventObject))&&(V.stopped=y.stopped=!0,T.hovered.size&&Array.from(T.hovered.values()).find(j=>j.eventObject===x.eventObject))){const j=l.slice(0,l.indexOf(x));s([...j,x])}},target:{hasPointerCapture:O,setPointerCapture:N,releasePointerCapture:D},currentTarget:{hasPointerCapture:O,setPointerCapture:N,releasePointerCapture:D},nativeEvent:c};if(f(V),y.stopped===!0)break}}return l}function s(l){const{internal:c}=t.getState();for(const d of c.hovered.values())if(!l.length||!l.find(f=>f.object===d.object&&f.index===d.index&&f.instanceId===d.instanceId)){const m=d.eventObject.__r3f,y=m==null?void 0:m.handlers;if(c.hovered.delete(C_(d)),m!=null&&m.eventCount){const x={...d,intersections:l};y.onPointerOut==null||y.onPointerOut(x),y.onPointerLeave==null||y.onPointerLeave(x)}}}function o(l,c){for(let d=0;d<c.length;d++){const f=c[d].__r3f;f==null||f.handlers.onPointerMissed==null||f.handlers.onPointerMissed(l)}}function a(l){switch(l){case"onPointerLeave":case"onPointerCancel":return()=>s([]);case"onLostPointerCapture":return c=>{const{internal:d}=t.getState();"pointerId"in c&&d.capturedMap.has(c.pointerId)&&requestAnimationFrame(()=>{d.capturedMap.has(c.pointerId)&&(d.capturedMap.delete(c.pointerId),s([]))})}}return function(d){const{onPointerMissed:f,internal:m}=t.getState();m.lastEvent.current=d;const y=l==="onPointerMove",x=l==="onClick"||l==="onContextMenu"||l==="onDoubleClick",_=r(d,y?n:void 0),w=x?e(d):0;l==="onPointerDown"&&(m.initialClick=[d.offsetX,d.offsetY],m.initialHits=_.map(T=>T.eventObject)),x&&!_.length&&w<=2&&(o(d,m.interaction),f&&f(d)),y&&s(_);function A(T){const C=T.eventObject,O=C.__r3f,N=O==null?void 0:O.handlers;if(O!=null&&O.eventCount)if(y){if(N.onPointerOver||N.onPointerEnter||N.onPointerOut||N.onPointerLeave){const D=C_(T),F=m.hovered.get(D);F?F.stopped&&T.stopPropagation():(m.hovered.set(D,T),N.onPointerOver==null||N.onPointerOver(T),N.onPointerEnter==null||N.onPointerEnter(T))}N.onPointerMove==null||N.onPointerMove(T)}else{const D=N[l];D?(!x||m.initialHits.includes(C))&&(o(d,m.interaction.filter(F=>!m.initialHits.includes(F))),D(T)):x&&m.initialHits.includes(C)&&o(d,m.interaction.filter(F=>!m.initialHits.includes(F)))}}i(_,d,w,A)}}return{handlePointer:a}}const mG=t=>!!(t!=null&&t.render),gG=R.createContext(null),mbe=(t,e)=>{const n=Yxe((a,l)=>{const c=new X,d=new X,f=new X;function m(w=l().camera,A=d,T=l().size){const{width:C,height:O,top:N,left:D}=T,F=C/O;A.isVector3?f.copy(A):f.set(...A);const V=w.getWorldPosition(c).distanceTo(f);if(lG(w))return{width:C/w.zoom,height:O/w.zoom,top:N,left:D,factor:1,distance:V,aspect:F};{const k=w.fov*Math.PI/180,j=2*Math.tan(k/2)*V,H=j*(C/O);return{width:H,height:j,top:N,left:D,factor:C/H,distance:V,aspect:F}}}let y;const x=w=>a(A=>({performance:{...A.performance,current:w}})),S=new Ve;return{set:a,get:l,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(w=1)=>t(l(),w),advance:(w,A)=>e(w,A,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new Y2,pointer:S,mouse:S,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const w=l();y&&clearTimeout(y),w.performance.current!==w.performance.min&&x(w.performance.min),y=setTimeout(()=>x(l().performance.max),w.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:m},setEvents:w=>a(A=>({...A,events:{...A.events,...w}})),setSize:(w,A,T,C,O)=>{const N=l().camera,D={width:w,height:A,top:C||0,left:O||0,updateStyle:T};a(F=>({size:D,viewport:{...F.viewport,...m(N,d,D)}}))},setDpr:w=>a(A=>{const T=fG(w);return{viewport:{...A.viewport,dpr:T,initialDpr:A.viewport.initialDpr||T}}}),setFrameloop:(w="always")=>{const A=l().clock;A.stop(),A.elapsedTime=0,w!=="never"&&(A.start(),A.elapsedTime=0),a(()=>({frameloop:w}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:R.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(w,A,T)=>{const C=l().internal;return C.priority=C.priority+(A>0?1:0),C.subscribers.push({ref:w,priority:A,store:T}),C.subscribers=C.subscribers.sort((O,N)=>O.priority-N.priority),()=>{const O=l().internal;O!=null&&O.subscribers&&(O.priority=O.priority-(A>0?1:0),O.subscribers=O.subscribers.filter(N=>N.ref!==w))}}}}}),r=n.getState();let i=r.size,s=r.viewport.dpr,o=r.camera;return n.subscribe(()=>{const{camera:a,size:l,viewport:c,gl:d,set:f}=n.getState();if(l.width!==i.width||l.height!==i.height||c.dpr!==s){var m;i=l,s=c.dpr,dbe(a,l),d.setPixelRatio(c.dpr);const y=(m=l.updateStyle)!=null?m:typeof HTMLCanvasElement<"u"&&d.domElement instanceof HTMLCanvasElement;d.setSize(l.width,l.height,y)}a!==o&&(o=a,f(y=>({viewport:{...y.viewport,...y.viewport.getCurrentViewport(a)}})))}),n.subscribe(a=>t(a)),n};let P_,gbe=new Set,vbe=new Set,ybe=new Set;function WA(t,e){if(t.size)for(const{callback:n}of t.values())n(e)}function T0(t,e){switch(t){case"before":return WA(gbe,e);case"after":return WA(vbe,e);case"tail":return WA(ybe,e)}}let $A,XA;function qA(t,e,n){let r=e.clock.getDelta();for(e.frameloop==="never"&&typeof t=="number"&&(r=t-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=t),$A=e.internal.subscribers,P_=0;P_<$A.length;P_++)XA=$A[P_],XA.ref.current(XA.store.getState(),r,n);return!e.internal.priority&&e.gl.render&&e.gl.render(e.scene,e.camera),e.internal.frames=Math.max(0,e.internal.frames-1),e.frameloop==="always"?1:e.internal.frames}function xbe(t){let e=!1,n=!1,r,i,s;function o(c){i=requestAnimationFrame(o),e=!0,r=0,T0("before",c),n=!0;for(const f of t.values()){var d;s=f.store.getState(),s.internal.active&&(s.frameloop==="always"||s.internal.frames>0)&&!((d=s.gl.xr)!=null&&d.isPresenting)&&(r+=qA(c,s))}if(n=!1,T0("after",c),r===0)return T0("tail",c),e=!1,cancelAnimationFrame(i)}function a(c,d=1){var f;if(!c)return t.forEach(m=>a(m.store.getState(),d));(f=c.gl.xr)!=null&&f.isPresenting||!c.internal.active||c.frameloop==="never"||(d>1?c.internal.frames=Math.min(60,c.internal.frames+d):n?c.internal.frames=2:c.internal.frames=1,e||(e=!0,requestAnimationFrame(o)))}function l(c,d=!0,f,m){if(d&&T0("before",c),f)qA(c,f,m);else for(const y of t.values())qA(c,y.store.getState());d&&T0("after",c)}return{loop:o,invalidate:a,advance:l}}function vG(){const t=R.useContext(gG);if(!t)throw new Error("R3F: Hooks can only be used within the Canvas component!");return t}function nd(t=n=>n,e){return vG()(t,e)}function yG(t,e=0){const n=vG(),r=n.getState().internal.subscribe,i=cG(t);return gx(()=>r(i,e,n),[e,r,n]),null}const jg=new Map,{invalidate:NU,advance:IU}=xbe(jg),{reconciler:L1,applyProps:Nm}=obe(jg,fbe),Im={objects:"shallow",strict:!1},bbe=(t,e)=>{const n=typeof t=="function"?t(e):t;return mG(n)?n:new v6({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...t})};function _be(t,e){const n=typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement;if(e){const{width:r,height:i,top:s,left:o,updateStyle:a=n}=e;return{width:r,height:i,top:s,left:o,updateStyle:a}}else if(typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement&&t.parentElement){const{width:r,height:i,top:s,left:o}=t.parentElement.getBoundingClientRect();return{width:r,height:i,top:s,left:o,updateStyle:n}}else if(typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas)return{width:t.width,height:t.height,top:0,left:0,updateStyle:n};return{width:0,height:0,top:0,left:0}}function wbe(t){const e=jg.get(t),n=e==null?void 0:e.fiber,r=e==null?void 0:e.store;e&&console.warn("R3F.createRoot should only be called once!");const i=typeof reportError=="function"?reportError:console.error,s=r||mbe(NU,IU),o=n||L1.createContainer(s,Km.ConcurrentRoot,null,!1,null,"",i,null);e||jg.set(t,{fiber:o,store:s});let a,l=!1,c;return{configure(d={}){let{gl:f,size:m,scene:y,events:x,onCreated:S,shadows:_=!1,linear:w=!1,flat:A=!1,legacy:T=!1,orthographic:C=!1,frameloop:O="always",dpr:N=[1,2],performance:D,raycaster:F,camera:V,onPointerMissed:k}=d,j=s.getState(),H=j.gl;j.gl||j.set({gl:H=bbe(f,t)});let ne=j.raycaster;ne||j.set({raycaster:ne=new iG});const{params:te,...pe}=F||{};if(ir.equ(pe,ne,Im)||Nm(ne,{...pe}),ir.equ(te,ne.params,Im)||Nm(ne,{params:{...ne.params,...te}}),!j.camera||j.camera===c&&!ir.equ(c,V,Im)){c=V;const q=V instanceof cx,$=q?V:C?new $c(0,0,0,0,.1,1e3):new Tr(75,0,.1,1e3);q||($.position.z=5,V&&(Nm($,V),("aspect"in V||"left"in V||"right"in V||"bottom"in V||"top"in V)&&($.manual=!0,$.updateProjectionMatrix())),!j.camera&&!(V!=null&&V.rotation)&&$.lookAt(0,0,0)),j.set({camera:$}),ne.camera=$}if(!j.scene){let q;y!=null&&y.isScene?q=y:(q=new R2,y&&Nm(q,y)),j.set({scene:Fm(q)})}if(!j.xr){var oe;const q=(ge,ae)=>{const fe=s.getState();fe.frameloop!=="never"&&IU(ge,!0,fe,ae)},$=()=>{const ge=s.getState();ge.gl.xr.enabled=ge.gl.xr.isPresenting,ge.gl.xr.setAnimationLoop(ge.gl.xr.isPresenting?q:null),ge.gl.xr.isPresenting||NU(ge)},Z={connect(){const ge=s.getState().gl;ge.xr.addEventListener("sessionstart",$),ge.xr.addEventListener("sessionend",$)},disconnect(){const ge=s.getState().gl;ge.xr.removeEventListener("sessionstart",$),ge.xr.removeEventListener("sessionend",$)}};typeof((oe=H.xr)==null?void 0:oe.addEventListener)=="function"&&Z.connect(),j.set({xr:Z})}if(H.shadowMap){const q=H.shadowMap.enabled,$=H.shadowMap.type;if(H.shadowMap.enabled=!!_,ir.boo(_))H.shadowMap.type=W0;else if(ir.str(_)){var ce;const Z={basic:hV,percentage:FS,soft:W0,variance:Oa};H.shadowMap.type=(ce=Z[_])!=null?ce:W0}else ir.obj(_)&&Object.assign(H.shadowMap,_);(q!==H.shadowMap.enabled||$!==H.shadowMap.type)&&(H.shadowMap.needsUpdate=!0)}const B=aG();B&&("enabled"in B?B.enabled=!T:"legacyMode"in B&&(B.legacyMode=T)),l||Nm(H,{outputEncoding:w?3e3:3001,toneMapping:A?Cl:l2}),j.legacy!==T&&j.set(()=>({legacy:T})),j.linear!==w&&j.set(()=>({linear:w})),j.flat!==A&&j.set(()=>({flat:A})),f&&!ir.fun(f)&&!mG(f)&&!ir.equ(f,H,Im)&&Nm(H,f),x&&!j.events.handlers&&j.set({events:x(s)});const K=_be(t,m);return ir.equ(K,j.size,Im)||j.setSize(K.width,K.height,K.updateStyle,K.top,K.left),N&&j.viewport.dpr!==fG(N)&&j.setDpr(N),j.frameloop!==O&&j.setFrameloop(O),j.onPointerMissed||j.set({onPointerMissed:k}),D&&!ir.equ(D,j.performance,Im)&&j.set(q=>({performance:{...q.performance,...D}})),a=S,l=!0,this},render(d){return l||this.configure(),L1.updateContainer(v.jsx(Sbe,{store:s,children:d,onCreated:a,rootElement:t}),o,null,()=>{}),s},unmount(){xG(t)}}}function Sbe({store:t,children:e,onCreated:n,rootElement:r}){return gx(()=>{const i=t.getState();i.set(s=>({internal:{...s.internal,active:!0}})),n&&n(i),t.getState().events.connected||i.events.connect==null||i.events.connect(r)},[]),v.jsx(gG.Provider,{value:t,children:e})}function xG(t,e){const n=jg.get(t),r=n==null?void 0:n.fiber;if(r){const i=n==null?void 0:n.store.getState();i&&(i.internal.active=!1),L1.updateContainer(null,r,null,()=>{i&&setTimeout(()=>{try{var s,o,a,l;i.events.disconnect==null||i.events.disconnect(),(s=i.gl)==null||(o=s.renderLists)==null||o.dispose==null||o.dispose(),(a=i.gl)==null||a.forceContextLoss==null||a.forceContextLoss(),(l=i.gl)!=null&&l.xr&&i.xr.disconnect(),ube(i),jg.delete(t)}catch{}},500)})}}L1.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:R.version});const KA={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 Mbe(t){const{handlePointer:e}=pbe(t);return{priority:1,enabled:!0,compute(n,r,i){r.pointer.set(n.offsetX/r.size.width*2-1,-(n.offsetY/r.size.height)*2+1),r.raycaster.setFromCamera(r.pointer,r.camera)},connected:void 0,handlers:Object.keys(KA).reduce((n,r)=>({...n,[r]:e(r)}),{}),update:()=>{var n;const{events:r,internal:i}=t.getState();(n=i.lastEvent)!=null&&n.current&&r.handlers&&r.handlers.onPointerMove(i.lastEvent.current)},connect:n=>{var r;const{set:i,events:s}=t.getState();s.disconnect==null||s.disconnect(),i(o=>({events:{...o.events,connected:n}})),Object.entries((r=s.handlers)!=null?r:[]).forEach(([o,a])=>{const[l,c]=KA[o];n.addEventListener(l,a,{passive:c})})},disconnect:()=>{const{set:n,events:r}=t.getState();if(r.connected){var i;Object.entries((i=r.handlers)!=null?i:[]).forEach(([s,o])=>{if(r&&r.connected instanceof HTMLElement){const[a]=KA[s];r.connected.removeEventListener(a,o)}}),n(s=>({events:{...s.events,connected:void 0}}))}}}}function kU(t,e){let n;return(...r)=>{window.clearTimeout(n),n=window.setTimeout(()=>t(...r),e)}}function Ebe({debounce:t,scroll:e,polyfill:n,offsetSize:r}={debounce:0,scroll:!1,offsetSize:!1}){const i=n||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[s,o]=R.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),a=R.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:s,orientationHandler:null}),l=t?typeof t=="number"?t:t.scroll:null,c=t?typeof t=="number"?t:t.resize:null,d=R.useRef(!1);R.useEffect(()=>(d.current=!0,()=>void(d.current=!1)));const[f,m,y]=R.useMemo(()=>{const w=()=>{if(!a.current.element)return;const{left:A,top:T,width:C,height:O,bottom:N,right:D,x:F,y:V}=a.current.element.getBoundingClientRect(),k={left:A,top:T,width:C,height:O,bottom:N,right:D,x:F,y:V};a.current.element instanceof HTMLElement&&r&&(k.height=a.current.element.offsetHeight,k.width=a.current.element.offsetWidth),Object.freeze(k),d.current&&!Pbe(a.current.lastBounds,k)&&o(a.current.lastBounds=k)};return[w,c?kU(w,c):w,l?kU(w,l):w]},[o,r,l,c]);function x(){a.current.scrollContainers&&(a.current.scrollContainers.forEach(w=>w.removeEventListener("scroll",y,!0)),a.current.scrollContainers=null),a.current.resizeObserver&&(a.current.resizeObserver.disconnect(),a.current.resizeObserver=null),a.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",a.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",a.current.orientationHandler))}function S(){a.current.element&&(a.current.resizeObserver=new i(y),a.current.resizeObserver.observe(a.current.element),e&&a.current.scrollContainers&&a.current.scrollContainers.forEach(w=>w.addEventListener("scroll",y,{capture:!0,passive:!0})),a.current.orientationHandler=()=>{y()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",a.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",a.current.orientationHandler))}const _=w=>{!w||w===a.current.element||(x(),a.current.element=w,a.current.scrollContainers=bG(w),S())};return Tbe(y,!!e),Abe(m),R.useEffect(()=>{x(),S()},[e,y,m]),R.useEffect(()=>x,[]),[_,s,f]}function Abe(t){R.useEffect(()=>{const e=t;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[t])}function Tbe(t,e){R.useEffect(()=>{if(e){const n=t;return window.addEventListener("scroll",n,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",n,!0)}},[t,e])}function bG(t){const e=[];if(!t||t===document.body)return e;const{overflow:n,overflowX:r,overflowY:i}=window.getComputedStyle(t);return[n,r,i].some(s=>s==="auto"||s==="scroll")&&e.push(t),[...e,...bG(t.parentElement)]}const Cbe=["x","y","top","bottom","left","right","width","height"],Pbe=(t,e)=>Cbe.every(n=>t[n]===e[n]);var Rbe=Object.defineProperty,Nbe=Object.defineProperties,Ibe=Object.getOwnPropertyDescriptors,OU=Object.getOwnPropertySymbols,kbe=Object.prototype.hasOwnProperty,Obe=Object.prototype.propertyIsEnumerable,LU=(t,e,n)=>e in t?Rbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,DU=(t,e)=>{for(var n in e||(e={}))kbe.call(e,n)&&LU(t,n,e[n]);if(OU)for(var n of OU(e))Obe.call(e,n)&&LU(t,n,e[n]);return t},Lbe=(t,e)=>Nbe(t,Ibe(e)),UU,jU;typeof window<"u"&&((UU=window.document)!=null&&UU.createElement||((jU=window.navigator)==null?void 0:jU.product)==="ReactNative")?R.useLayoutEffect:R.useEffect;function _G(t,e,n){if(!t)return;if(n(t)===!0)return t;let r=t.child;for(;r;){const i=_G(r,e,n);if(i)return i;r=r.sibling}}function wG(t){try{return Object.defineProperties(t,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return t}}const FU=console.error;console.error=function(){const t=[...arguments].join("");if(t!=null&&t.startsWith("Warning:")&&t.includes("useContext")){console.error=FU;return}return FU.apply(this,arguments)};const nN=wG(R.createContext(null));class SG extends R.Component{render(){return R.createElement(nN.Provider,{value:this._reactInternals},this.props.children)}}function Dbe(){const t=R.useContext(nN);if(t===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=R.useId();return R.useMemo(()=>{for(const r of[t,t==null?void 0:t.alternate]){if(!r)continue;const i=_G(r,!1,s=>{let o=s.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(i)return i}},[t,e])}function Ube(){const t=Dbe(),[e]=R.useState(()=>new Map);e.clear();let n=t;for(;n;){if(n.type&&typeof n.type=="object"){const i=n.type._context===void 0&&n.type.Provider===n.type?n.type:n.type._context;i&&i!==nN&&!e.has(i)&&e.set(i,R.useContext(wG(i)))}n=n.return}return e}function jbe(){const t=Ube();return R.useMemo(()=>Array.from(t.keys()).reduce((e,n)=>r=>R.createElement(e,null,R.createElement(n.Provider,Lbe(DU({},r),{value:t.get(n)}))),e=>R.createElement(SG,DU({},e))),[t])}const Fbe=R.forwardRef(function({children:e,fallback:n,resize:r,style:i,gl:s,events:o=Mbe,eventSource:a,eventPrefix:l,shadows:c,linear:d,flat:f,legacy:m,orthographic:y,frameloop:x,dpr:S,performance:_,raycaster:w,camera:A,scene:T,onPointerMissed:C,onCreated:O,...N},D){R.useMemo(()=>sbe(Wxe),[]);const F=jbe(),[V,k]=Ebe({scroll:!0,debounce:{scroll:50,resize:0},...r}),j=R.useRef(null),H=R.useRef(null);R.useImperativeHandle(D,()=>j.current);const ne=cG(C),[te,pe]=R.useState(!1),[oe,ce]=R.useState(!1);if(te)throw te;if(oe)throw oe;const B=R.useRef(null);gx(()=>{const q=j.current;k.width>0&&k.height>0&&q&&(B.current||(B.current=wbe(q)),B.current.configure({gl:s,events:o,shadows:c,linear:d,flat:f,legacy:m,orthographic:y,frameloop:x,dpr:S,performance:_,raycaster:w,camera:A,scene:T,size:k,onPointerMissed:(...$)=>ne.current==null?void 0:ne.current(...$),onCreated:$=>{$.events.connect==null||$.events.connect(a?abe(a)?a.current:a:H.current),l&&$.setEvents({compute:(Z,ge)=>{const ae=Z[l+"X"],fe=Z[l+"Y"];ge.pointer.set(ae/ge.size.width*2-1,-(fe/ge.size.height)*2+1),ge.raycaster.setFromCamera(ge.pointer,ge.camera)}}),O==null||O($)}}),B.current.render(v.jsx(F,{children:v.jsx(uG,{set:ce,children:v.jsx(R.Suspense,{fallback:v.jsx(lbe,{set:pe}),children:e??null})})})))}),R.useEffect(()=>{const q=j.current;if(q)return()=>xG(q)},[]);const K=a?"none":"auto";return v.jsx("div",{ref:H,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:K,...i},...N,children:v.jsx("div",{ref:V,style:{width:"100%",height:"100%"},children:v.jsx("canvas",{ref:j,style:{display:"block"},children:n})})})}),zbe=R.forwardRef(function(e,n){return v.jsx(SG,{children:v.jsx(Fbe,{...e,ref:n})})});function rP(){return rP=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},rP.apply(null,arguments)}var Bbe=Object.defineProperty,Hbe=(t,e,n)=>e in t?Bbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Vbe=(t,e,n)=>(Hbe(t,e+"",n),n);class Gbe{constructor(){Vbe(this,"_listeners")}addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(n)===-1&&r[e].push(n)}hasEventListener(e,n){if(this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(n)!==-1}removeEventListener(e,n){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(n);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const r=this._listeners[e.type];if(r!==void 0){e.target=this;const i=r.slice(0);for(let s=0,o=i.length;s<o;s++)i[s].call(this,e);e.target=null}}}var Wbe=Object.defineProperty,$be=(t,e,n)=>e in t?Wbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,$t=(t,e,n)=>($be(t,typeof e!="symbol"?e+"":e,n),n);const R_=new Jh,zU=new Nc,Xbe=Math.cos(70*(Math.PI/180)),BU=(t,e)=>(t%e+e)%e;let qbe=class extends Gbe{constructor(e,n){super(),$t(this,"object"),$t(this,"domElement"),$t(this,"enabled",!0),$t(this,"target",new X),$t(this,"minDistance",0),$t(this,"maxDistance",1/0),$t(this,"minZoom",0),$t(this,"maxZoom",1/0),$t(this,"minPolarAngle",0),$t(this,"maxPolarAngle",Math.PI),$t(this,"minAzimuthAngle",-1/0),$t(this,"maxAzimuthAngle",1/0),$t(this,"enableDamping",!1),$t(this,"dampingFactor",.05),$t(this,"enableZoom",!0),$t(this,"zoomSpeed",1),$t(this,"enableRotate",!0),$t(this,"rotateSpeed",1),$t(this,"enablePan",!0),$t(this,"panSpeed",1),$t(this,"screenSpacePanning",!0),$t(this,"keyPanSpeed",7),$t(this,"zoomToCursor",!1),$t(this,"autoRotate",!1),$t(this,"autoRotateSpeed",2),$t(this,"reverseOrbit",!1),$t(this,"reverseHorizontalOrbit",!1),$t(this,"reverseVerticalOrbit",!1),$t(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),$t(this,"mouseButtons",{LEFT:Xf.ROTATE,MIDDLE:Xf.DOLLY,RIGHT:Xf.PAN}),$t(this,"touches",{ONE:qf.ROTATE,TWO:qf.DOLLY_PAN}),$t(this,"target0"),$t(this,"position0"),$t(this,"zoom0"),$t(this,"_domElementKeyEvents",null),$t(this,"getPolarAngle"),$t(this,"getAzimuthalAngle"),$t(this,"setPolarAngle"),$t(this,"setAzimuthalAngle"),$t(this,"getDistance"),$t(this,"getZoomScale"),$t(this,"listenToKeyEvents"),$t(this,"stopListenToKeyEvents"),$t(this,"saveState"),$t(this,"reset"),$t(this,"update"),$t(this,"connect"),$t(this,"dispose"),$t(this,"dollyIn"),$t(this,"dollyOut"),$t(this,"getScale"),$t(this,"setScale"),this.object=e,this.domElement=n,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>d.phi,this.getAzimuthalAngle=()=>d.theta,this.setPolarAngle=J=>{let Ae=BU(J,2*Math.PI),re=d.phi;re<0&&(re+=2*Math.PI),Ae<0&&(Ae+=2*Math.PI);let Fe=Math.abs(Ae-re);2*Math.PI-Fe<Fe&&(Ae<re?Ae+=2*Math.PI:re+=2*Math.PI),f.phi=Ae-re,r.update()},this.setAzimuthalAngle=J=>{let Ae=BU(J,2*Math.PI),re=d.theta;re<0&&(re+=2*Math.PI),Ae<0&&(Ae+=2*Math.PI);let Fe=Math.abs(Ae-re);2*Math.PI-Fe<Fe&&(Ae<re?Ae+=2*Math.PI:re+=2*Math.PI),f.theta=Ae-re,r.update()},this.getDistance=()=>r.object.position.distanceTo(r.target),this.listenToKeyEvents=J=>{J.addEventListener("keydown",ft),this._domElementKeyEvents=J},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",ft),this._domElementKeyEvents=null},this.saveState=()=>{r.target0.copy(r.target),r.position0.copy(r.object.position),r.zoom0=r.object.zoom},this.reset=()=>{r.target.copy(r.target0),r.object.position.copy(r.position0),r.object.zoom=r.zoom0,r.object.updateProjectionMatrix(),r.dispatchEvent(i),r.update(),l=a.NONE},this.update=(()=>{const J=new X,Ae=new X(0,1,0),re=new qt().setFromUnitVectors(e.up,Ae),Fe=re.clone().invert(),Te=new X,Le=new qt,Ke=2*Math.PI;return function(){const Kt=r.object.position;re.setFromUnitVectors(e.up,Ae),Fe.copy(re).invert(),J.copy(Kt).sub(r.target),J.applyQuaternion(re),d.setFromVector3(J),r.autoRotate&&l===a.NONE&&te(H()),r.enableDamping?(d.theta+=f.theta*r.dampingFactor,d.phi+=f.phi*r.dampingFactor):(d.theta+=f.theta,d.phi+=f.phi);let un=r.minAzimuthAngle,Cn=r.maxAzimuthAngle;isFinite(un)&&isFinite(Cn)&&(un<-Math.PI?un+=Ke:un>Math.PI&&(un-=Ke),Cn<-Math.PI?Cn+=Ke:Cn>Math.PI&&(Cn-=Ke),un<=Cn?d.theta=Math.max(un,Math.min(Cn,d.theta)):d.theta=d.theta>(un+Cn)/2?Math.max(un,d.theta):Math.min(Cn,d.theta)),d.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,d.phi)),d.makeSafe(),r.enableDamping===!0?r.target.addScaledVector(y,r.dampingFactor):r.target.add(y),r.zoomToCursor&&V||r.object.isOrthographicCamera?d.radius=ge(d.radius):d.radius=ge(d.radius*m),J.setFromSpherical(d),J.applyQuaternion(Fe),Kt.copy(r.target).add(J),r.object.matrixAutoUpdate||r.object.updateMatrix(),r.object.lookAt(r.target),r.enableDamping===!0?(f.theta*=1-r.dampingFactor,f.phi*=1-r.dampingFactor,y.multiplyScalar(1-r.dampingFactor)):(f.set(0,0,0),y.set(0,0,0));let Jt=!1;if(r.zoomToCursor&&V){let Hn=null;if(r.object instanceof Tr&&r.object.isPerspectiveCamera){const hr=J.length();Hn=ge(hr*m);const Si=hr-Hn;r.object.position.addScaledVector(D,Si),r.object.updateMatrixWorld()}else if(r.object.isOrthographicCamera){const hr=new X(F.x,F.y,0);hr.unproject(r.object),r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/m)),r.object.updateProjectionMatrix(),Jt=!0;const Si=new X(F.x,F.y,0);Si.unproject(r.object),r.object.position.sub(Si).add(hr),r.object.updateMatrixWorld(),Hn=J.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),r.zoomToCursor=!1;Hn!==null&&(r.screenSpacePanning?r.target.set(0,0,-1).transformDirection(r.object.matrix).multiplyScalar(Hn).add(r.object.position):(R_.origin.copy(r.object.position),R_.direction.set(0,0,-1).transformDirection(r.object.matrix),Math.abs(r.object.up.dot(R_.direction))<Xbe?e.lookAt(r.target):(zU.setFromNormalAndCoplanarPoint(r.object.up,r.target),R_.intersectPlane(zU,r.target))))}else r.object instanceof $c&&r.object.isOrthographicCamera&&(Jt=m!==1,Jt&&(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/m)),r.object.updateProjectionMatrix()));return m=1,V=!1,Jt||Te.distanceToSquared(r.object.position)>c||8*(1-Le.dot(r.object.quaternion))>c?(r.dispatchEvent(i),Te.copy(r.object.position),Le.copy(r.object.quaternion),Jt=!1,!0):!1}})(),this.connect=J=>{r.domElement=J,r.domElement.style.touchAction="none",r.domElement.addEventListener("contextmenu",dt),r.domElement.addEventListener("pointerdown",Ee),r.domElement.addEventListener("pointercancel",le),r.domElement.addEventListener("wheel",rt)},this.dispose=()=>{var J,Ae,re,Fe,Te,Le;r.domElement&&(r.domElement.style.touchAction="auto"),(J=r.domElement)==null||J.removeEventListener("contextmenu",dt),(Ae=r.domElement)==null||Ae.removeEventListener("pointerdown",Ee),(re=r.domElement)==null||re.removeEventListener("pointercancel",le),(Fe=r.domElement)==null||Fe.removeEventListener("wheel",rt),(Te=r.domElement)==null||Te.ownerDocument.removeEventListener("pointermove",Be),(Le=r.domElement)==null||Le.ownerDocument.removeEventListener("pointerup",le),r._domElementKeyEvents!==null&&r._domElementKeyEvents.removeEventListener("keydown",ft)};const r=this,i={type:"change"},s={type:"start"},o={type:"end"},a={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let l=a.NONE;const c=1e-6,d=new eP,f=new eP;let m=1;const y=new X,x=new Ve,S=new Ve,_=new Ve,w=new Ve,A=new Ve,T=new Ve,C=new Ve,O=new Ve,N=new Ve,D=new X,F=new Ve;let V=!1;const k=[],j={};function H(){return 2*Math.PI/60/60*r.autoRotateSpeed}function ne(){return Math.pow(.95,r.zoomSpeed)}function te(J){r.reverseOrbit||r.reverseHorizontalOrbit?f.theta+=J:f.theta-=J}function pe(J){r.reverseOrbit||r.reverseVerticalOrbit?f.phi+=J:f.phi-=J}const oe=(()=>{const J=new X;return function(re,Fe){J.setFromMatrixColumn(Fe,0),J.multiplyScalar(-re),y.add(J)}})(),ce=(()=>{const J=new X;return function(re,Fe){r.screenSpacePanning===!0?J.setFromMatrixColumn(Fe,1):(J.setFromMatrixColumn(Fe,0),J.crossVectors(r.object.up,J)),J.multiplyScalar(re),y.add(J)}})(),B=(()=>{const J=new X;return function(re,Fe){const Te=r.domElement;if(Te&&r.object instanceof Tr&&r.object.isPerspectiveCamera){const Le=r.object.position;J.copy(Le).sub(r.target);let Ke=J.length();Ke*=Math.tan(r.object.fov/2*Math.PI/180),oe(2*re*Ke/Te.clientHeight,r.object.matrix),ce(2*Fe*Ke/Te.clientHeight,r.object.matrix)}else Te&&r.object instanceof $c&&r.object.isOrthographicCamera?(oe(re*(r.object.right-r.object.left)/r.object.zoom/Te.clientWidth,r.object.matrix),ce(Fe*(r.object.top-r.object.bottom)/r.object.zoom/Te.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}})();function K(J){r.object instanceof Tr&&r.object.isPerspectiveCamera||r.object instanceof $c&&r.object.isOrthographicCamera?m=J:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function q(J){K(m/J)}function $(J){K(m*J)}function Z(J){if(!r.zoomToCursor||!r.domElement)return;V=!0;const Ae=r.domElement.getBoundingClientRect(),re=J.clientX-Ae.left,Fe=J.clientY-Ae.top,Te=Ae.width,Le=Ae.height;F.x=re/Te*2-1,F.y=-(Fe/Le)*2+1,D.set(F.x,F.y,1).unproject(r.object).sub(r.object.position).normalize()}function ge(J){return Math.max(r.minDistance,Math.min(r.maxDistance,J))}function ae(J){x.set(J.clientX,J.clientY)}function fe(J){Z(J),C.set(J.clientX,J.clientY)}function _e(J){w.set(J.clientX,J.clientY)}function Se(J){S.set(J.clientX,J.clientY),_.subVectors(S,x).multiplyScalar(r.rotateSpeed);const Ae=r.domElement;Ae&&(te(2*Math.PI*_.x/Ae.clientHeight),pe(2*Math.PI*_.y/Ae.clientHeight)),x.copy(S),r.update()}function $e(J){O.set(J.clientX,J.clientY),N.subVectors(O,C),N.y>0?q(ne()):N.y<0&&$(ne()),C.copy(O),r.update()}function Me(J){A.set(J.clientX,J.clientY),T.subVectors(A,w).multiplyScalar(r.panSpeed),B(T.x,T.y),w.copy(A),r.update()}function He(J){Z(J),J.deltaY<0?$(ne()):J.deltaY>0&&q(ne()),r.update()}function Xe(J){let Ae=!1;switch(J.code){case r.keys.UP:B(0,r.keyPanSpeed),Ae=!0;break;case r.keys.BOTTOM:B(0,-r.keyPanSpeed),Ae=!0;break;case r.keys.LEFT:B(r.keyPanSpeed,0),Ae=!0;break;case r.keys.RIGHT:B(-r.keyPanSpeed,0),Ae=!0;break}Ae&&(J.preventDefault(),r.update())}function ue(){if(k.length==1)x.set(k[0].pageX,k[0].pageY);else{const J=.5*(k[0].pageX+k[1].pageX),Ae=.5*(k[0].pageY+k[1].pageY);x.set(J,Ae)}}function Q(){if(k.length==1)w.set(k[0].pageX,k[0].pageY);else{const J=.5*(k[0].pageX+k[1].pageX),Ae=.5*(k[0].pageY+k[1].pageY);w.set(J,Ae)}}function Ge(){const J=k[0].pageX-k[1].pageX,Ae=k[0].pageY-k[1].pageY,re=Math.sqrt(J*J+Ae*Ae);C.set(0,re)}function Ue(){r.enableZoom&&Ge(),r.enablePan&&Q()}function We(){r.enableZoom&&Ge(),r.enableRotate&&ue()}function Qe(J){if(k.length==1)S.set(J.pageX,J.pageY);else{const re=de(J),Fe=.5*(J.pageX+re.x),Te=.5*(J.pageY+re.y);S.set(Fe,Te)}_.subVectors(S,x).multiplyScalar(r.rotateSpeed);const Ae=r.domElement;Ae&&(te(2*Math.PI*_.x/Ae.clientHeight),pe(2*Math.PI*_.y/Ae.clientHeight)),x.copy(S)}function xt(J){if(k.length==1)A.set(J.pageX,J.pageY);else{const Ae=de(J),re=.5*(J.pageX+Ae.x),Fe=.5*(J.pageY+Ae.y);A.set(re,Fe)}T.subVectors(A,w).multiplyScalar(r.panSpeed),B(T.x,T.y),w.copy(A)}function at(J){const Ae=de(J),re=J.pageX-Ae.x,Fe=J.pageY-Ae.y,Te=Math.sqrt(re*re+Fe*Fe);O.set(0,Te),N.set(0,Math.pow(O.y/C.y,r.zoomSpeed)),q(N.y),C.copy(O)}function ee(J){r.enableZoom&&at(J),r.enablePan&&xt(J)}function W(J){r.enableZoom&&at(J),r.enableRotate&&Qe(J)}function Ee(J){var Ae,re;r.enabled!==!1&&(k.length===0&&((Ae=r.domElement)==null||Ae.ownerDocument.addEventListener("pointermove",Be),(re=r.domElement)==null||re.ownerDocument.addEventListener("pointerup",le)),Dt(J),J.pointerType==="touch"?nn(J):Ce(J))}function Be(J){r.enabled!==!1&&(J.pointerType==="touch"?qe(J):lt(J))}function le(J){var Ae,re,Fe;Ut(J),k.length===0&&((Ae=r.domElement)==null||Ae.releasePointerCapture(J.pointerId),(re=r.domElement)==null||re.ownerDocument.removeEventListener("pointermove",Be),(Fe=r.domElement)==null||Fe.ownerDocument.removeEventListener("pointerup",le)),r.dispatchEvent(o),l=a.NONE}function Ce(J){let Ae;switch(J.button){case 0:Ae=r.mouseButtons.LEFT;break;case 1:Ae=r.mouseButtons.MIDDLE;break;case 2:Ae=r.mouseButtons.RIGHT;break;default:Ae=-1}switch(Ae){case Xf.DOLLY:if(r.enableZoom===!1)return;fe(J),l=a.DOLLY;break;case Xf.ROTATE:if(J.ctrlKey||J.metaKey||J.shiftKey){if(r.enablePan===!1)return;_e(J),l=a.PAN}else{if(r.enableRotate===!1)return;ae(J),l=a.ROTATE}break;case Xf.PAN:if(J.ctrlKey||J.metaKey||J.shiftKey){if(r.enableRotate===!1)return;ae(J),l=a.ROTATE}else{if(r.enablePan===!1)return;_e(J),l=a.PAN}break;default:l=a.NONE}l!==a.NONE&&r.dispatchEvent(s)}function lt(J){if(r.enabled!==!1)switch(l){case a.ROTATE:if(r.enableRotate===!1)return;Se(J);break;case a.DOLLY:if(r.enableZoom===!1)return;$e(J);break;case a.PAN:if(r.enablePan===!1)return;Me(J);break}}function rt(J){r.enabled===!1||r.enableZoom===!1||l!==a.NONE&&l!==a.ROTATE||(J.preventDefault(),r.dispatchEvent(s),He(J),r.dispatchEvent(o))}function ft(J){r.enabled===!1||r.enablePan===!1||Xe(J)}function nn(J){switch(pt(J),k.length){case 1:switch(r.touches.ONE){case qf.ROTATE:if(r.enableRotate===!1)return;ue(),l=a.TOUCH_ROTATE;break;case qf.PAN:if(r.enablePan===!1)return;Q(),l=a.TOUCH_PAN;break;default:l=a.NONE}break;case 2:switch(r.touches.TWO){case qf.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;Ue(),l=a.TOUCH_DOLLY_PAN;break;case qf.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;We(),l=a.TOUCH_DOLLY_ROTATE;break;default:l=a.NONE}break;default:l=a.NONE}l!==a.NONE&&r.dispatchEvent(s)}function qe(J){switch(pt(J),l){case a.TOUCH_ROTATE:if(r.enableRotate===!1)return;Qe(J),r.update();break;case a.TOUCH_PAN:if(r.enablePan===!1)return;xt(J),r.update();break;case a.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;ee(J),r.update();break;case a.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;W(J),r.update();break;default:l=a.NONE}}function dt(J){r.enabled!==!1&&J.preventDefault()}function Dt(J){k.push(J)}function Ut(J){delete j[J.pointerId];for(let Ae=0;Ae<k.length;Ae++)if(k[Ae].pointerId==J.pointerId){k.splice(Ae,1);return}}function pt(J){let Ae=j[J.pointerId];Ae===void 0&&(Ae=new Ve,j[J.pointerId]=Ae),Ae.set(J.pageX,J.pageY)}function de(J){const Ae=J.pointerId===k[0].pointerId?k[1]:k[0];return j[Ae.pointerId]}this.dollyIn=(J=ne())=>{$(J),r.update()},this.dollyOut=(J=ne())=>{q(J),r.update()},this.getScale=()=>m,this.setScale=J=>{K(J),r.update()},this.getZoomScale=()=>ne(),n!==void 0&&this.connect(n),this.update()}};const Kbe=R.forwardRef(({makeDefault:t,camera:e,regress:n,domElement:r,enableDamping:i=!0,keyEvents:s=!1,onChange:o,onStart:a,onEnd:l,...c},d)=>{const f=nd(N=>N.invalidate),m=nd(N=>N.camera),y=nd(N=>N.gl),x=nd(N=>N.events),S=nd(N=>N.setEvents),_=nd(N=>N.set),w=nd(N=>N.get),A=nd(N=>N.performance),T=e||m,C=r||x.connected||y.domElement,O=R.useMemo(()=>new qbe(T),[T]);return yG(()=>{O.enabled&&O.update()},-1),R.useEffect(()=>(s&&O.connect(s===!0?C:s),O.connect(C),()=>void O.dispose()),[s,C,n,O,f]),R.useEffect(()=>{const N=V=>{f(),n&&A.regress(),o&&o(V)},D=V=>{a&&a(V)},F=V=>{l&&l(V)};return O.addEventListener("change",N),O.addEventListener("start",D),O.addEventListener("end",F),()=>{O.removeEventListener("start",D),O.removeEventListener("end",F),O.removeEventListener("change",N)}},[o,a,l,O,f,S]),R.useEffect(()=>{if(t){const N=w().controls;return _({controls:O}),()=>_({controls:N})}},[t,O]),R.createElement("primitive",rP({ref:d,object:O,enableDamping:i},c))});function HU(t,e){if(e===GV)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(e===N1||e===x2){let n=t.getIndex();if(n===null){const o=[],a=t.getAttribute("position");if(a!==void 0){for(let l=0;l<a.count;l++)o.push(l);t.setIndex(o),n=t.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t}const r=n.count-2,i=[];if(e===N1)for(let o=1;o<=r;o++)i.push(n.getX(0)),i.push(n.getX(o)),i.push(n.getX(o+1));else for(let o=0;o<r;o++)o%2===0?(i.push(n.getX(o)),i.push(n.getX(o+1)),i.push(n.getX(o+2))):(i.push(n.getX(o+2)),i.push(n.getX(o+1)),i.push(n.getX(o)));i.length/3!==r&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=t.clone();return s.setIndex(i),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),t}class Ybe extends Rs{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(n){return new t_e(n)}),this.register(function(n){return new n_e(n)}),this.register(function(n){return new d_e(n)}),this.register(function(n){return new f_e(n)}),this.register(function(n){return new h_e(n)}),this.register(function(n){return new i_e(n)}),this.register(function(n){return new s_e(n)}),this.register(function(n){return new o_e(n)}),this.register(function(n){return new a_e(n)}),this.register(function(n){return new e_e(n)}),this.register(function(n){return new l_e(n)}),this.register(function(n){return new r_e(n)}),this.register(function(n){return new u_e(n)}),this.register(function(n){return new c_e(n)}),this.register(function(n){return new Qbe(n)}),this.register(function(n){return new p_e(n)}),this.register(function(n){return new m_e(n)})}load(e,n,r,i){const s=this;let o;if(this.resourcePath!=="")o=this.resourcePath;else if(this.path!==""){const c=Md.extractUrlBase(e);o=Md.resolveURL(c,this.path)}else o=Md.extractUrlBase(e);this.manager.itemStart(e);const a=function(c){i?i(c):console.error(c),s.manager.itemError(e),s.manager.itemEnd(e)},l=new Ga(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(c){try{s.parse(c,o,function(d){n(d),s.manager.itemEnd(e)},a)}catch(d){a(d)}},r,a)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,n,r,i){let s;const o={},a={},l=new TextDecoder;if(typeof e=="string")s=JSON.parse(e);else if(e instanceof ArrayBuffer)if(l.decode(new Uint8Array(e,0,4))===MG){try{o[vn.KHR_BINARY_GLTF]=new g_e(e)}catch(f){i&&i(f);return}s=JSON.parse(o[vn.KHR_BINARY_GLTF].content)}else s=JSON.parse(l.decode(e));else s=e;if(s.asset===void 0||s.asset.version[0]<2){i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const c=new P_e(s,{path:n||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let d=0;d<this.pluginCallbacks.length;d++){const f=this.pluginCallbacks[d](c);f.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[f.name]=f,o[f.name]=!0}if(s.extensionsUsed)for(let d=0;d<s.extensionsUsed.length;++d){const f=s.extensionsUsed[d],m=s.extensionsRequired||[];switch(f){case vn.KHR_MATERIALS_UNLIT:o[f]=new Jbe;break;case vn.KHR_DRACO_MESH_COMPRESSION:o[f]=new v_e(s,this.dracoLoader);break;case vn.KHR_TEXTURE_TRANSFORM:o[f]=new y_e;break;case vn.KHR_MESH_QUANTIZATION:o[f]=new x_e;break;default:m.indexOf(f)>=0&&a[f]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+f+'".')}}c.setExtensions(o),c.setPlugins(a),c.parse(r,i)}parseAsync(e,n){const r=this;return new Promise(function(i,s){r.parse(e,n,i,s)})}}function Zbe(){let t={};return{get:function(e){return t[e]},add:function(e,n){t[e]=n},remove:function(e){delete t[e]},removeAll:function(){t={}}}}const vn={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class Qbe{constructor(e){this.parser=e,this.name=vn.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,n=this.parser.json.nodes||[];for(let r=0,i=n.length;r<i;r++){const s=n[r];s.extensions&&s.extensions[this.name]&&s.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(e){const n=this.parser,r="light:"+e;let i=n.cache.get(r);if(i)return i;const s=n.json,l=((s.extensions&&s.extensions[this.name]||{}).lights||[])[e];let c;const d=new ot(16777215);l.color!==void 0&&d.setRGB(l.color[0],l.color[1],l.color[2],xi);const f=l.range!==void 0?l.range:0;switch(l.type){case"directional":c=new q2(d),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new X2(d),c.distance=f;break;case"spot":c=new $2(d),c.distance=f,l.spot=l.spot||{},l.spot.innerConeAngle=l.spot.innerConeAngle!==void 0?l.spot.innerConeAngle:0,l.spot.outerConeAngle=l.spot.outerConeAngle!==void 0?l.spot.outerConeAngle:Math.PI/4,c.angle=l.spot.outerConeAngle,c.penumbra=1-l.spot.innerConeAngle/l.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+l.type)}return c.position.set(0,0,0),c.decay=2,Pc(c,l),l.intensity!==void 0&&(c.intensity=l.intensity),c.name=n.createUniqueName(l.name||"light_"+e),i=Promise.resolve(c),n.cache.add(r,i),i}getDependency(e,n){if(e==="light")return this._loadLight(n)}createNodeAttachment(e){const n=this,r=this.parser,s=r.json.nodes[e],a=(s.extensions&&s.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(l){return r._getNodeRef(n.cache,a,l)})}}class Jbe{constructor(){this.name=vn.KHR_MATERIALS_UNLIT}getMaterialType(){return As}extendParams(e,n,r){const i=[];e.color=new ot(1,1,1),e.opacity=1;const s=n.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){const o=s.baseColorFactor;e.color.setRGB(o[0],o[1],o[2],xi),e.opacity=o[3]}s.baseColorTexture!==void 0&&i.push(r.assignTexture(e,"map",s.baseColorTexture,ji))}return Promise.all(i)}}class e_e{constructor(e){this.parser=e,this.name=vn.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,n){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=i.extensions[this.name].emissiveStrength;return s!==void 0&&(n.emissiveIntensity=s),Promise.resolve()}}class t_e{constructor(e){this.parser=e,this.name=vn.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:na}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];if(o.clearcoatFactor!==void 0&&(n.clearcoat=o.clearcoatFactor),o.clearcoatTexture!==void 0&&s.push(r.assignTexture(n,"clearcoatMap",o.clearcoatTexture)),o.clearcoatRoughnessFactor!==void 0&&(n.clearcoatRoughness=o.clearcoatRoughnessFactor),o.clearcoatRoughnessTexture!==void 0&&s.push(r.assignTexture(n,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),o.clearcoatNormalTexture!==void 0&&(s.push(r.assignTexture(n,"clearcoatNormalMap",o.clearcoatNormalTexture)),o.clearcoatNormalTexture.scale!==void 0)){const a=o.clearcoatNormalTexture.scale;n.clearcoatNormalScale=new Ve(a,a)}return Promise.all(s)}}class n_e{constructor(e){this.parser=e,this.name=vn.KHR_MATERIALS_DISPERSION}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:na}extendMaterialParams(e,n){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=i.extensions[this.name];return n.dispersion=s.dispersion!==void 0?s.dispersion:0,Promise.resolve()}}class r_e{constructor(e){this.parser=e,this.name=vn.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:na}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];return o.iridescenceFactor!==void 0&&(n.iridescence=o.iridescenceFactor),o.iridescenceTexture!==void 0&&s.push(r.assignTexture(n,"iridescenceMap",o.iridescenceTexture)),o.iridescenceIor!==void 0&&(n.iridescenceIOR=o.iridescenceIor),n.iridescenceThicknessRange===void 0&&(n.iridescenceThicknessRange=[100,400]),o.iridescenceThicknessMinimum!==void 0&&(n.iridescenceThicknessRange[0]=o.iridescenceThicknessMinimum),o.iridescenceThicknessMaximum!==void 0&&(n.iridescenceThicknessRange[1]=o.iridescenceThicknessMaximum),o.iridescenceThicknessTexture!==void 0&&s.push(r.assignTexture(n,"iridescenceThicknessMap",o.iridescenceThicknessTexture)),Promise.all(s)}}class i_e{constructor(e){this.parser=e,this.name=vn.KHR_MATERIALS_SHEEN}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:na}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[];n.sheenColor=new ot(0,0,0),n.sheenRoughness=0,n.sheen=1;const o=i.extensions[this.name];if(o.sheenColorFactor!==void 0){const a=o.sheenColorFactor;n.sheenColor.setRGB(a[0],a[1],a[2],xi)}return o.sheenRoughnessFactor!==void 0&&(n.sheenRoughness=o.sheenRoughnessFactor),o.sheenColorTexture!==void 0&&s.push(r.assignTexture(n,"sheenColorMap",o.sheenColorTexture,ji)),o.sheenRoughnessTexture!==void 0&&s.push(r.assignTexture(n,"sheenRoughnessMap",o.sheenRoughnessTexture)),Promise.all(s)}}class s_e{constructor(e){this.parser=e,this.name=vn.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:na}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];return o.transmissionFactor!==void 0&&(n.transmission=o.transmissionFactor),o.transmissionTexture!==void 0&&s.push(r.assignTexture(n,"transmissionMap",o.transmissionTexture)),Promise.all(s)}}class o_e{constructor(e){this.parser=e,this.name=vn.KHR_MATERIALS_VOLUME}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:na}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];n.thickness=o.thicknessFactor!==void 0?o.thicknessFactor:0,o.thicknessTexture!==void 0&&s.push(r.assignTexture(n,"thicknessMap",o.thicknessTexture)),n.attenuationDistance=o.attenuationDistance||1/0;const a=o.attenuationColor||[1,1,1];return n.attenuationColor=new ot().setRGB(a[0],a[1],a[2],xi),Promise.all(s)}}class a_e{constructor(e){this.parser=e,this.name=vn.KHR_MATERIALS_IOR}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:na}extendMaterialParams(e,n){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=i.extensions[this.name];return n.ior=s.ior!==void 0?s.ior:1.5,Promise.resolve()}}class l_e{constructor(e){this.parser=e,this.name=vn.KHR_MATERIALS_SPECULAR}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:na}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];n.specularIntensity=o.specularFactor!==void 0?o.specularFactor:1,o.specularTexture!==void 0&&s.push(r.assignTexture(n,"specularIntensityMap",o.specularTexture));const a=o.specularColorFactor||[1,1,1];return n.specularColor=new ot().setRGB(a[0],a[1],a[2],xi),o.specularColorTexture!==void 0&&s.push(r.assignTexture(n,"specularColorMap",o.specularColorTexture,ji)),Promise.all(s)}}class c_e{constructor(e){this.parser=e,this.name=vn.EXT_MATERIALS_BUMP}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:na}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];return n.bumpScale=o.bumpFactor!==void 0?o.bumpFactor:1,o.bumpTexture!==void 0&&s.push(r.assignTexture(n,"bumpMap",o.bumpTexture)),Promise.all(s)}}class u_e{constructor(e){this.parser=e,this.name=vn.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:na}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],o=i.extensions[this.name];return o.anisotropyStrength!==void 0&&(n.anisotropy=o.anisotropyStrength),o.anisotropyRotation!==void 0&&(n.anisotropyRotation=o.anisotropyRotation),o.anisotropyTexture!==void 0&&s.push(r.assignTexture(n,"anisotropyMap",o.anisotropyTexture)),Promise.all(s)}}class d_e{constructor(e){this.parser=e,this.name=vn.KHR_TEXTURE_BASISU}loadTexture(e){const n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[this.name])return null;const s=i.extensions[this.name],o=n.options.ktx2Loader;if(!o){if(r.extensionsRequired&&r.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return n.loadTextureImage(e,s.source,o)}}class f_e{constructor(e){this.parser=e,this.name=vn.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const n=this.name,r=this.parser,i=r.json,s=i.textures[e];if(!s.extensions||!s.extensions[n])return null;const o=s.extensions[n],a=i.images[o.source];let l=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,o.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(n)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const n=new Image;n.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",n.onload=n.onerror=function(){e(n.height===1)}})),this.isSupported}}class h_e{constructor(e){this.parser=e,this.name=vn.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const n=this.name,r=this.parser,i=r.json,s=i.textures[e];if(!s.extensions||!s.extensions[n])return null;const o=s.extensions[n],a=i.images[o.source];let l=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,o.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(n)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const n=new Image;n.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",n.onload=n.onerror=function(){e(n.height===1)}})),this.isSupported}}class p_e{constructor(e){this.name=vn.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const n=this.parser.json,r=n.bufferViews[e];if(r.extensions&&r.extensions[this.name]){const i=r.extensions[this.name],s=this.parser.getDependency("buffer",i.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(a){const l=i.byteOffset||0,c=i.byteLength||0,d=i.count,f=i.byteStride,m=new Uint8Array(a,l,c);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(d,f,m,i.mode,i.filter).then(function(y){return y.buffer}):o.ready.then(function(){const y=new ArrayBuffer(d*f);return o.decodeGltfBuffer(new Uint8Array(y),d,f,m,i.mode,i.filter),y})})}else return null}}class m_e{constructor(e){this.name=vn.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const n=this.parser.json,r=n.nodes[e];if(!r.extensions||!r.extensions[this.name]||r.mesh===void 0)return null;const i=n.meshes[r.mesh];for(const c of i.primitives)if(c.mode!==Ho.TRIANGLES&&c.mode!==Ho.TRIANGLE_STRIP&&c.mode!==Ho.TRIANGLE_FAN&&c.mode!==void 0)return null;const o=r.extensions[this.name].attributes,a=[],l={};for(const c in o)a.push(this.parser.getDependency("accessor",o[c]).then(d=>(l[c]=d,l[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(c=>{const d=c.pop(),f=d.isGroup?d.children:[d],m=c[0].count,y=[];for(const x of f){const S=new Ct,_=new X,w=new qt,A=new X(1,1,1),T=new I2(x.geometry,x.material,m);for(let C=0;C<m;C++)l.TRANSLATION&&_.fromBufferAttribute(l.TRANSLATION,C),l.ROTATION&&w.fromBufferAttribute(l.ROTATION,C),l.SCALE&&A.fromBufferAttribute(l.SCALE,C),T.setMatrixAt(C,S.compose(_,w,A));for(const C in l)if(C==="_COLOR_0"){const O=l[C];T.instanceColor=new zh(O.array,O.itemSize,O.normalized)}else C!=="TRANSLATION"&&C!=="ROTATION"&&C!=="SCALE"&&x.geometry.setAttribute(C,l[C]);mn.prototype.copy.call(T,x),this.parser.assignFinalMaterial(T),y.push(T)}return d.isGroup?(d.clear(),d.add(...y),d):y[0]}))}}const MG="glTF",C0=12,VU={JSON:1313821514,BIN:5130562};class g_e{constructor(e){this.name=vn.KHR_BINARY_GLTF,this.content=null,this.body=null;const n=new DataView(e,0,C0),r=new TextDecoder;if(this.header={magic:r.decode(new Uint8Array(e.slice(0,4))),version:n.getUint32(4,!0),length:n.getUint32(8,!0)},this.header.magic!==MG)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-C0,s=new DataView(e,C0);let o=0;for(;o<i;){const a=s.getUint32(o,!0);o+=4;const l=s.getUint32(o,!0);if(o+=4,l===VU.JSON){const c=new Uint8Array(e,C0+o,a);this.content=r.decode(c)}else if(l===VU.BIN){const c=C0+o;this.body=e.slice(c,c+a)}o+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class v_e{constructor(e,n){if(!n)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=vn.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=n,this.dracoLoader.preload()}decodePrimitive(e,n){const r=this.json,i=this.dracoLoader,s=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,a={},l={},c={};for(const d in o){const f=iP[d]||d.toLowerCase();a[f]=o[d]}for(const d in e.attributes){const f=iP[d]||d.toLowerCase();if(o[d]!==void 0){const m=r.accessors[e.attributes[d]],y=rg[m.componentType];c[f]=y.name,l[f]=m.normalized===!0}}return n.getDependency("bufferView",s).then(function(d){return new Promise(function(f,m){i.decodeDracoFile(d,function(y){for(const x in y.attributes){const S=y.attributes[x],_=l[x];_!==void 0&&(S.normalized=_)}f(y)},a,c,xi,m)})})}}class y_e{constructor(){this.name=vn.KHR_TEXTURE_TRANSFORM}extendTexture(e,n){return(n.texCoord===void 0||n.texCoord===e.channel)&&n.offset===void 0&&n.rotation===void 0&&n.scale===void 0||(e=e.clone(),n.texCoord!==void 0&&(e.channel=n.texCoord),n.offset!==void 0&&e.offset.fromArray(n.offset),n.rotation!==void 0&&(e.rotation=n.rotation),n.scale!==void 0&&e.repeat.fromArray(n.scale),e.needsUpdate=!0),e}}class x_e{constructor(){this.name=vn.KHR_MESH_QUANTIZATION}}class EG extends iv{constructor(e,n,r,i){super(e,n,r,i)}copySampleValue_(e){const n=this.resultBuffer,r=this.sampleValues,i=this.valueSize,s=e*i*3+i;for(let o=0;o!==i;o++)n[o]=r[s+o];return n}interpolate_(e,n,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=a*2,c=a*3,d=i-n,f=(r-n)/d,m=f*f,y=m*f,x=e*c,S=x-c,_=-2*y+3*m,w=y-m,A=1-_,T=w-m+f;for(let C=0;C!==a;C++){const O=o[S+C+a],N=o[S+C+l]*d,D=o[x+C+a],F=o[x+C]*d;s[C]=A*O+T*N+_*D+w*F}return s}}const b_e=new qt;class __e extends EG{interpolate_(e,n,r,i){const s=super.interpolate_(e,n,r,i);return b_e.fromArray(s).normalize().toArray(s),s}}const Ho={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},rg={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},GU={9728:ri,9729:Cr,9984:BS,9985:tg,9986:ih,9987:qo},WU={33071:_o,33648:Rg,10497:Pd},YA={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},iP={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},rd={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},w_e={CUBICSPLINE:void 0,LINEAR:kg,STEP:Ig},ZA={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function S_e(t){return t.DefaultMaterial===void 0&&(t.DefaultMaterial=new mx({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Dl})),t.DefaultMaterial}function Ff(t,e,n){for(const r in n.extensions)t[r]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[r]=n.extensions[r])}function Pc(t,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(t.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function M_e(t,e,n){let r=!1,i=!1,s=!1;for(let c=0,d=e.length;c<d;c++){const f=e[c];if(f.POSITION!==void 0&&(r=!0),f.NORMAL!==void 0&&(i=!0),f.COLOR_0!==void 0&&(s=!0),r&&i&&s)break}if(!r&&!i&&!s)return Promise.resolve(t);const o=[],a=[],l=[];for(let c=0,d=e.length;c<d;c++){const f=e[c];if(r){const m=f.POSITION!==void 0?n.getDependency("accessor",f.POSITION):t.attributes.position;o.push(m)}if(i){const m=f.NORMAL!==void 0?n.getDependency("accessor",f.NORMAL):t.attributes.normal;a.push(m)}if(s){const m=f.COLOR_0!==void 0?n.getDependency("accessor",f.COLOR_0):t.attributes.color;l.push(m)}}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(l)]).then(function(c){const d=c[0],f=c[1],m=c[2];return r&&(t.morphAttributes.position=d),i&&(t.morphAttributes.normal=f),s&&(t.morphAttributes.color=m),t.morphTargetsRelative=!0,t})}function E_e(t,e){if(t.updateMorphTargets(),e.weights!==void 0)for(let n=0,r=e.weights.length;n<r;n++)t.morphTargetInfluences[n]=e.weights[n];if(e.extras&&Array.isArray(e.extras.targetNames)){const n=e.extras.targetNames;if(t.morphTargetInfluences.length===n.length){t.morphTargetDictionary={};for(let r=0,i=n.length;r<i;r++)t.morphTargetDictionary[n[r]]=r}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function A_e(t){let e;const n=t.extensions&&t.extensions[vn.KHR_DRACO_MESH_COMPRESSION];if(n?e="draco:"+n.bufferView+":"+n.indices+":"+QA(n.attributes):e=t.indices+":"+QA(t.attributes)+":"+t.mode,t.targets!==void 0)for(let r=0,i=t.targets.length;r<i;r++)e+=":"+QA(t.targets[r]);return e}function QA(t){let e="";const n=Object.keys(t).sort();for(let r=0,i=n.length;r<i;r++)e+=n[r]+":"+t[n[r]]+";";return e}function sP(t){switch(t){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function T_e(t){return t.search(/\.jpe?g($|\?)/i)>0||t.search(/^data\:image\/jpeg/)===0?"image/jpeg":t.search(/\.webp($|\?)/i)>0||t.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const C_e=new Ct;class P_e{constructor(e={},n={}){this.json=e,this.extensions={},this.plugins={},this.options=n,this.cache=new Zbe,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let r=!1,i=-1,s=!1,o=-1;if(typeof navigator<"u"){const a=navigator.userAgent;r=/^((?!chrome|android).)*safari/i.test(a)===!0;const l=a.match(/Version\/(\d+)/);i=r&&l?parseInt(l[1],10):-1,s=a.indexOf("Firefox")>-1,o=s?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||r&&i<17||s&&o<98?this.textureLoader=new $6(this.options.manager):this.textureLoader=new eG(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Ga(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,n){const r=this,i=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(o){const a={scene:o[0][i.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:i.asset,parser:r,userData:{}};return Ff(s,a,i),Pc(a,i),Promise.all(r._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){for(const l of a.scenes)l.updateMatrixWorld();e(a)})}).catch(n)}_markDefs(){const e=this.json.nodes||[],n=this.json.skins||[],r=this.json.meshes||[];for(let i=0,s=n.length;i<s;i++){const o=n[i].joints;for(let a=0,l=o.length;a<l;a++)e[o[a]].isBone=!0}for(let i=0,s=e.length;i<s;i++){const o=e[i];o.mesh!==void 0&&(this._addNodeRef(this.meshCache,o.mesh),o.skin!==void 0&&(r[o.mesh].isSkinnedMesh=!0)),o.camera!==void 0&&this._addNodeRef(this.cameraCache,o.camera)}}_addNodeRef(e,n){n!==void 0&&(e.refs[n]===void 0&&(e.refs[n]=e.uses[n]=0),e.refs[n]++)}_getNodeRef(e,n,r){if(e.refs[n]<=1)return r;const i=r.clone(),s=(o,a)=>{const l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(const[c,d]of o.children.entries())s(d,a.children[c])};return s(r,i),i.name+="_instance_"+e.uses[n]++,i}_invokeOne(e){const n=Object.values(this.plugins);n.push(this);for(let r=0;r<n.length;r++){const i=e(n[r]);if(i)return i}return null}_invokeAll(e){const n=Object.values(this.plugins);n.unshift(this);const r=[];for(let i=0;i<n.length;i++){const s=e(n[i]);s&&r.push(s)}return r}getDependency(e,n){const r=e+":"+n;let i=this.cache.get(r);if(!i){switch(e){case"scene":i=this.loadScene(n);break;case"node":i=this._invokeOne(function(s){return s.loadNode&&s.loadNode(n)});break;case"mesh":i=this._invokeOne(function(s){return s.loadMesh&&s.loadMesh(n)});break;case"accessor":i=this.loadAccessor(n);break;case"bufferView":i=this._invokeOne(function(s){return s.loadBufferView&&s.loadBufferView(n)});break;case"buffer":i=this.loadBuffer(n);break;case"material":i=this._invokeOne(function(s){return s.loadMaterial&&s.loadMaterial(n)});break;case"texture":i=this._invokeOne(function(s){return s.loadTexture&&s.loadTexture(n)});break;case"skin":i=this.loadSkin(n);break;case"animation":i=this._invokeOne(function(s){return s.loadAnimation&&s.loadAnimation(n)});break;case"camera":i=this.loadCamera(n);break;default:if(i=this._invokeOne(function(s){return s!=this&&s.getDependency&&s.getDependency(e,n)}),!i)throw new Error("Unknown type: "+e);break}this.cache.add(r,i)}return i}getDependencies(e){let n=this.cache.get(e);if(!n){const r=this,i=this.json[e+(e==="mesh"?"es":"s")]||[];n=Promise.all(i.map(function(s,o){return r.getDependency(e,o)})),this.cache.add(e,n)}return n}loadBuffer(e){const n=this.json.buffers[e],r=this.fileLoader;if(n.type&&n.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+n.type+" buffer type is not supported.");if(n.uri===void 0&&e===0)return Promise.resolve(this.extensions[vn.KHR_BINARY_GLTF].body);const i=this.options;return new Promise(function(s,o){r.load(Md.resolveURL(n.uri,i.path),s,void 0,function(){o(new Error('THREE.GLTFLoader: Failed to load buffer "'+n.uri+'".'))})})}loadBufferView(e){const n=this.json.bufferViews[e];return this.getDependency("buffer",n.buffer).then(function(r){const i=n.byteLength||0,s=n.byteOffset||0;return r.slice(s,s+i)})}loadAccessor(e){const n=this,r=this.json,i=this.json.accessors[e];if(i.bufferView===void 0&&i.sparse===void 0){const o=YA[i.type],a=rg[i.componentType],l=i.normalized===!0,c=new a(i.count*o);return Promise.resolve(new Qt(c,o,l))}const s=[];return i.bufferView!==void 0?s.push(this.getDependency("bufferView",i.bufferView)):s.push(null),i.sparse!==void 0&&(s.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(s).then(function(o){const a=o[0],l=YA[i.type],c=rg[i.componentType],d=c.BYTES_PER_ELEMENT,f=d*l,m=i.byteOffset||0,y=i.bufferView!==void 0?r.bufferViews[i.bufferView].byteStride:void 0,x=i.normalized===!0;let S,_;if(y&&y!==f){const w=Math.floor(m/y),A="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+w+":"+i.count;let T=n.cache.get(A);T||(S=new c(a,w*y,i.count*y/d),T=new tp(S,y/d),n.cache.add(A,T)),_=new Ul(T,l,m%y/d,x)}else a===null?S=new c(i.count*l):S=new c(a,m,i.count*l),_=new Qt(S,l,x);if(i.sparse!==void 0){const w=YA.SCALAR,A=rg[i.sparse.indices.componentType],T=i.sparse.indices.byteOffset||0,C=i.sparse.values.byteOffset||0,O=new A(o[1],T,i.sparse.count*w),N=new c(o[2],C,i.sparse.count*l);a!==null&&(_=new Qt(_.array.slice(),_.itemSize,_.normalized)),_.normalized=!1;for(let D=0,F=O.length;D<F;D++){const V=O[D];if(_.setX(V,N[D*l]),l>=2&&_.setY(V,N[D*l+1]),l>=3&&_.setZ(V,N[D*l+2]),l>=4&&_.setW(V,N[D*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}_.normalized=x}return _})}loadTexture(e){const n=this.json,r=this.options,s=n.textures[e].source,o=n.images[s];let a=this.textureLoader;if(o.uri){const l=r.manager.getHandler(o.uri);l!==null&&(a=l)}return this.loadTextureImage(e,s,a)}loadTextureImage(e,n,r){const i=this,s=this.json,o=s.textures[e],a=s.images[n],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(n,r).then(function(d){d.flipY=!1,d.name=o.name||a.name||"",d.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(d.name=a.uri);const m=(s.samplers||{})[o.sampler]||{};return d.magFilter=GU[m.magFilter]||Cr,d.minFilter=GU[m.minFilter]||qo,d.wrapS=WU[m.wrapS]||Pd,d.wrapT=WU[m.wrapT]||Pd,i.associations.set(d,{textures:e}),d}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,n){const r=this,i=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(f=>f.clone());const o=i.images[e],a=self.URL||self.webkitURL;let l=o.uri||"",c=!1;if(o.bufferView!==void 0)l=r.getDependency("bufferView",o.bufferView).then(function(f){c=!0;const m=new Blob([f],{type:o.mimeType});return l=a.createObjectURL(m),l});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const d=Promise.resolve(l).then(function(f){return new Promise(function(m,y){let x=m;n.isImageBitmapLoader===!0&&(x=function(S){const _=new dr(S);_.needsUpdate=!0,m(_)}),n.load(Md.resolveURL(f,s.path),x,void 0,y)})}).then(function(f){return c===!0&&a.revokeObjectURL(l),Pc(f,o),f.userData.mimeType=o.mimeType||T_e(o.uri),f}).catch(function(f){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),f});return this.sourceCache[e]=d,d}assignTexture(e,n,r,i){const s=this;return this.getDependency("texture",r.index).then(function(o){if(!o)return null;if(r.texCoord!==void 0&&r.texCoord>0&&(o=o.clone(),o.channel=r.texCoord),s.extensions[vn.KHR_TEXTURE_TRANSFORM]){const a=r.extensions!==void 0?r.extensions[vn.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(o);o=s.extensions[vn.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,l)}}return i!==void 0&&(o.colorSpace=i),e[n]=o,o})}assignFinalMaterial(e){const n=e.geometry;let r=e.material;const i=n.attributes.tangent===void 0,s=n.attributes.color!==void 0,o=n.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+r.uuid;let l=this.cache.get(a);l||(l=new nM,Gr.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,l.sizeAttenuation=!1,this.cache.add(a,l)),r=l}else if(e.isLine){const a="LineBasicMaterial:"+r.uuid;let l=this.cache.get(a);l||(l=new $r,Gr.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,this.cache.add(a,l)),r=l}if(i||s||o){let a="ClonedMaterial:"+r.uuid+":";i&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=r.clone(),s&&(l.vertexColors=!0),o&&(l.flatShading=!0),i&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(r))),r=l}e.material=r}getMaterialType(){return mx}loadMaterial(e){const n=this,r=this.json,i=this.extensions,s=r.materials[e];let o;const a={},l=s.extensions||{},c=[];if(l[vn.KHR_MATERIALS_UNLIT]){const f=i[vn.KHR_MATERIALS_UNLIT];o=f.getMaterialType(),c.push(f.extendParams(a,s,n))}else{const f=s.pbrMetallicRoughness||{};if(a.color=new ot(1,1,1),a.opacity=1,Array.isArray(f.baseColorFactor)){const m=f.baseColorFactor;a.color.setRGB(m[0],m[1],m[2],xi),a.opacity=m[3]}f.baseColorTexture!==void 0&&c.push(n.assignTexture(a,"map",f.baseColorTexture,ji)),a.metalness=f.metallicFactor!==void 0?f.metallicFactor:1,a.roughness=f.roughnessFactor!==void 0?f.roughnessFactor:1,f.metallicRoughnessTexture!==void 0&&(c.push(n.assignTexture(a,"metalnessMap",f.metallicRoughnessTexture)),c.push(n.assignTexture(a,"roughnessMap",f.metallicRoughnessTexture))),o=this._invokeOne(function(m){return m.getMaterialType&&m.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(m){return m.extendMaterialParams&&m.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=xo);const d=s.alphaMode||ZA.OPAQUE;if(d===ZA.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,d===ZA.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==As&&(c.push(n.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new Ve(1,1),s.normalTexture.scale!==void 0)){const f=s.normalTexture.scale;a.normalScale.set(f,f)}if(s.occlusionTexture!==void 0&&o!==As&&(c.push(n.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==As){const f=s.emissiveFactor;a.emissive=new ot().setRGB(f[0],f[1],f[2],xi)}return s.emissiveTexture!==void 0&&o!==As&&c.push(n.assignTexture(a,"emissiveMap",s.emissiveTexture,ji)),Promise.all(c).then(function(){const f=new o(a);return s.name&&(f.name=s.name),Pc(f,s),n.associations.set(f,{materials:e}),s.extensions&&Ff(i,f,s),f})}createUniqueName(e){const n=Nn.sanitizeNodeName(e||"");return n in this.nodeNamesUsed?n+"_"+ ++this.nodeNamesUsed[n]:(this.nodeNamesUsed[n]=0,n)}loadGeometries(e){const n=this,r=this.extensions,i=this.primitiveCache;function s(a){return r[vn.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,n).then(function(l){return $U(l,a,n)})}const o=[];for(let a=0,l=e.length;a<l;a++){const c=e[a],d=A_e(c),f=i[d];if(f)o.push(f.promise);else{let m;c.extensions&&c.extensions[vn.KHR_DRACO_MESH_COMPRESSION]?m=s(c):m=$U(new Zt,c,n),i[d]={primitive:c,promise:m},o.push(m)}}return Promise.all(o)}loadMesh(e){const n=this,r=this.json,i=this.extensions,s=r.meshes[e],o=s.primitives,a=[];for(let l=0,c=o.length;l<c;l++){const d=o[l].material===void 0?S_e(this.cache):this.getDependency("material",o[l].material);a.push(d)}return a.push(n.loadGeometries(o)),Promise.all(a).then(function(l){const c=l.slice(0,l.length-1),d=l[l.length-1],f=[];for(let y=0,x=d.length;y<x;y++){const S=d[y],_=o[y];let w;const A=c[y];if(_.mode===Ho.TRIANGLES||_.mode===Ho.TRIANGLE_STRIP||_.mode===Ho.TRIANGLE_FAN||_.mode===void 0)w=s.isSkinnedMesh===!0?new eM(S,A):new yr(S,A),w.isSkinnedMesh===!0&&w.normalizeSkinWeights(),_.mode===Ho.TRIANGLE_STRIP?w.geometry=HU(w.geometry,x2):_.mode===Ho.TRIANGLE_FAN&&(w.geometry=HU(w.geometry,N1));else if(_.mode===Ho.LINES)w=new Js(S,A);else if(_.mode===Ho.LINE_STRIP)w=new jl(S,A);else if(_.mode===Ho.LINE_LOOP)w=new k2(S,A);else if(_.mode===Ho.POINTS)w=new O2(S,A);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+_.mode);Object.keys(w.geometry.morphAttributes).length>0&&E_e(w,s),w.name=n.createUniqueName(s.name||"mesh_"+e),Pc(w,s),_.extensions&&Ff(i,w,_),n.assignFinalMaterial(w),f.push(w)}for(let y=0,x=f.length;y<x;y++)n.associations.set(f[y],{meshes:e,primitives:y});if(f.length===1)return s.extensions&&Ff(i,f[0],s),f[0];const m=new Ts;s.extensions&&Ff(i,m,s),n.associations.set(m,{meshes:e});for(let y=0,x=f.length;y<x;y++)m.add(f[y]);return m})}loadCamera(e){let n;const r=this.json.cameras[e],i=r[r.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return r.type==="perspective"?n=new Tr(gr.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):r.type==="orthographic"&&(n=new $c(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),r.name&&(n.name=this.createUniqueName(r.name)),Pc(n,r),Promise.resolve(n)}loadSkin(e){const n=this.json.skins[e],r=[];for(let i=0,s=n.joints.length;i<s;i++)r.push(this._loadNodeShallow(n.joints[i]));return n.inverseBindMatrices!==void 0?r.push(this.getDependency("accessor",n.inverseBindMatrices)):r.push(null),Promise.all(r).then(function(i){const s=i.pop(),o=i,a=[],l=[];for(let c=0,d=o.length;c<d;c++){const f=o[c];if(f){a.push(f);const m=new Ct;s!==null&&m.fromArray(s.array,c*16),l.push(m)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',n.joints[c])}return new Id(a,l)})}loadAnimation(e){const n=this.json,r=this,i=n.animations[e],s=i.name?i.name:"animation_"+e,o=[],a=[],l=[],c=[],d=[];for(let f=0,m=i.channels.length;f<m;f++){const y=i.channels[f],x=i.samplers[y.sampler],S=y.target,_=S.node,w=i.parameters!==void 0?i.parameters[x.input]:x.input,A=i.parameters!==void 0?i.parameters[x.output]:x.output;S.node!==void 0&&(o.push(this.getDependency("node",_)),a.push(this.getDependency("accessor",w)),l.push(this.getDependency("accessor",A)),c.push(x),d.push(S))}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(l),Promise.all(c),Promise.all(d)]).then(function(f){const m=f[0],y=f[1],x=f[2],S=f[3],_=f[4],w=[];for(let A=0,T=m.length;A<T;A++){const C=m[A],O=y[A],N=x[A],D=S[A],F=_[A];if(C===void 0)continue;C.updateMatrix&&C.updateMatrix();const V=r._createAnimationTracks(C,O,N,D,F);if(V)for(let k=0;k<V.length;k++)w.push(V[k])}return new Dg(s,void 0,w)})}createNodeMesh(e){const n=this.json,r=this,i=n.nodes[e];return i.mesh===void 0?null:r.getDependency("mesh",i.mesh).then(function(s){const o=r._getNodeRef(r.meshCache,i.mesh,s);return i.weights!==void 0&&o.traverse(function(a){if(a.isMesh)for(let l=0,c=i.weights.length;l<c;l++)a.morphTargetInfluences[l]=i.weights[l]}),o})}loadNode(e){const n=this.json,r=this,i=n.nodes[e],s=r._loadNodeShallow(e),o=[],a=i.children||[];for(let c=0,d=a.length;c<d;c++)o.push(r.getDependency("node",a[c]));const l=i.skin===void 0?Promise.resolve(null):r.getDependency("skin",i.skin);return Promise.all([s,Promise.all(o),l]).then(function(c){const d=c[0],f=c[1],m=c[2];m!==null&&d.traverse(function(y){y.isSkinnedMesh&&y.bind(m,C_e)});for(let y=0,x=f.length;y<x;y++)d.add(f[y]);return d})}_loadNodeShallow(e){const n=this.json,r=this.extensions,i=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const s=n.nodes[e],o=s.name?i.createUniqueName(s.name):"",a=[],l=i._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(e)});return l&&a.push(l),s.camera!==void 0&&a.push(i.getDependency("camera",s.camera).then(function(c){return i._getNodeRef(i.cameraCache,s.camera,c)})),i._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(e)}).forEach(function(c){a.push(c)}),this.nodeCache[e]=Promise.all(a).then(function(c){let d;if(s.isBone===!0?d=new tM:c.length>1?d=new Ts:c.length===1?d=c[0]:d=new mn,d!==c[0])for(let f=0,m=c.length;f<m;f++)d.add(c[f]);if(s.name&&(d.userData.name=s.name,d.name=o),Pc(d,s),s.extensions&&Ff(r,d,s),s.matrix!==void 0){const f=new Ct;f.fromArray(s.matrix),d.applyMatrix4(f)}else s.translation!==void 0&&d.position.fromArray(s.translation),s.rotation!==void 0&&d.quaternion.fromArray(s.rotation),s.scale!==void 0&&d.scale.fromArray(s.scale);return i.associations.has(d)||i.associations.set(d,{}),i.associations.get(d).nodes=e,d}),this.nodeCache[e]}loadScene(e){const n=this.extensions,r=this.json.scenes[e],i=this,s=new Ts;r.name&&(s.name=i.createUniqueName(r.name)),Pc(s,r),r.extensions&&Ff(n,s,r);const o=r.nodes||[],a=[];for(let l=0,c=o.length;l<c;l++)a.push(i.getDependency("node",o[l]));return Promise.all(a).then(function(l){for(let d=0,f=l.length;d<f;d++)s.add(l[d]);const c=d=>{const f=new Map;for(const[m,y]of i.associations)(m instanceof Gr||m instanceof dr)&&f.set(m,y);return d.traverse(m=>{const y=i.associations.get(m);y!=null&&f.set(m,y)}),f};return i.associations=c(s),s})}_createAnimationTracks(e,n,r,i,s){const o=[],a=e.name?e.name:e.uuid,l=[];rd[s.path]===rd.weights?e.traverse(function(m){m.morphTargetInfluences&&l.push(m.name?m.name:m.uuid)}):l.push(a);let c;switch(rd[s.path]){case rd.weights:c=Hh;break;case rd.rotation:c=Vh;break;case rd.position:case rd.scale:c=Gh;break;default:switch(r.itemSize){case 1:c=Hh;break;case 2:case 3:default:c=Gh;break}break}const d=i.interpolation!==void 0?w_e[i.interpolation]:kg,f=this._getArrayFromAccessor(r);for(let m=0,y=l.length;m<y;m++){const x=new c(l[m]+"."+rd[s.path],n.array,f,d);i.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(x),o.push(x)}return o}_getArrayFromAccessor(e){let n=e.array;if(e.normalized){const r=sP(n.constructor),i=new Float32Array(n.length);for(let s=0,o=n.length;s<o;s++)i[s]=n[s]*r;n=i}return n}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(r){const i=this instanceof Vh?__e:EG;return new i(this.times,this.values,this.getValueSize()/3,r)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function R_e(t,e,n){const r=e.attributes,i=new os;if(r.POSITION!==void 0){const a=n.json.accessors[r.POSITION],l=a.min,c=a.max;if(l!==void 0&&c!==void 0){if(i.set(new X(l[0],l[1],l[2]),new X(c[0],c[1],c[2])),a.normalized){const d=sP(rg[a.componentType]);i.min.multiplyScalar(d),i.max.multiplyScalar(d)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const s=e.targets;if(s!==void 0){const a=new X,l=new X;for(let c=0,d=s.length;c<d;c++){const f=s[c];if(f.POSITION!==void 0){const m=n.json.accessors[f.POSITION],y=m.min,x=m.max;if(y!==void 0&&x!==void 0){if(l.setX(Math.max(Math.abs(y[0]),Math.abs(x[0]))),l.setY(Math.max(Math.abs(y[1]),Math.abs(x[1]))),l.setZ(Math.max(Math.abs(y[2]),Math.abs(x[2]))),m.normalized){const S=sP(rg[m.componentType]);l.multiplyScalar(S)}a.max(l)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(a)}t.boundingBox=i;const o=new Bi;i.getCenter(o.center),o.radius=i.min.distanceTo(i.max)/2,t.boundingSphere=o}function $U(t,e,n){const r=e.attributes,i=[];function s(o,a){return n.getDependency("accessor",o).then(function(l){t.setAttribute(a,l)})}for(const o in r){const a=iP[o]||o.toLowerCase();a in t.attributes||i.push(s(r[o],a))}if(e.indices!==void 0&&!t.index){const o=n.getDependency("accessor",e.indices).then(function(a){t.setIndex(a)});i.push(o)}return In.workingColorSpace!==xi&&"COLOR_0"in r&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${In.workingColorSpace}" not supported.`),Pc(t,e),R_e(t,e,n),Promise.all(i).then(function(){return e.targets!==void 0?M_e(t,e.targets,n):t})}/*!
|
||
* @pixiv/three-vrm v3.5.4
|
||
* VRM file loader for three.js.
|
||
*
|
||
* Copyright (c) 2019-2026 pixiv Inc.
|
||
* @pixiv/three-vrm is distributed under MIT License
|
||
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
||
*/var N_=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),Un=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),XU=class extends mn{constructor(t){super(),this.weight=0,this.isBinary=!1,this.overrideBlink="none",this.overrideLookAt="none",this.overrideMouth="none",this._binds=[],this.name=`VRMExpression_${t}`,this.expressionName=t,this.type="VRMExpression",this.visible=!1}get binds(){return this._binds}get overrideBlinkAmount(){return this.overrideBlink==="block"?0<this.outputWeight?1:0:this.overrideBlink==="blend"?this.outputWeight:0}get overrideLookAtAmount(){return this.overrideLookAt==="block"?0<this.outputWeight?1:0:this.overrideLookAt==="blend"?this.outputWeight:0}get overrideMouthAmount(){return this.overrideMouth==="block"?0<this.outputWeight?1:0:this.overrideMouth==="blend"?this.outputWeight:0}get outputWeight(){return this.isBinary?this.weight>.5?1:0:this.weight}addBind(t){this._binds.push(t)}deleteBind(t){const e=this._binds.indexOf(t);e>=0&&this._binds.splice(e,1)}applyWeight(t){var e;let n=this.outputWeight;n*=(e=t==null?void 0:t.multiplier)!=null?e:1,this.isBinary&&n<1&&(n=0),this._binds.forEach(r=>r.applyWeight(n))}clearAppliedWeight(){this._binds.forEach(t=>t.clearAppliedWeight())}};function AG(t,e,n){var r,i;const s=t.parser.json,o=(r=s.nodes)==null?void 0:r[e];if(o==null)return console.warn(`extractPrimitivesInternal: Attempt to use nodes[${e}] of glTF but the node doesn't exist`),null;const a=o.mesh;if(a==null)return null;const l=(i=s.meshes)==null?void 0:i[a];if(l==null)return console.warn(`extractPrimitivesInternal: Attempt to use meshes[${a}] of glTF but the mesh doesn't exist`),null;const c=l.primitives.length,d=[];return n.traverse(f=>{d.length<c&&f.isMesh&&d.push(f)}),d}function qU(t,e){return Un(this,null,function*(){const n=yield t.parser.getDependency("node",e);return AG(t,e,n)})}function KU(t){return Un(this,null,function*(){const e=yield t.parser.getDependencies("node"),n=new Map;return e.forEach((r,i)=>{const s=AG(t,i,r);s!=null&&n.set(i,s)}),n})}var oP={Aa:"aa",Ih:"ih",Ou:"ou",Ee:"ee",Oh:"oh",Blink:"blink",Happy:"happy",Angry:"angry",Sad:"sad",Relaxed:"relaxed",LookUp:"lookUp",Surprised:"surprised",LookDown:"lookDown",LookLeft:"lookLeft",LookRight:"lookRight",BlinkLeft:"blinkLeft",BlinkRight:"blinkRight",Neutral:"neutral"};function TG(t){return Math.max(Math.min(t,1),0)}var YU=class CG{constructor(){this.blinkExpressionNames=["blink","blinkLeft","blinkRight"],this.lookAtExpressionNames=["lookLeft","lookRight","lookUp","lookDown"],this.mouthExpressionNames=["aa","ee","ih","oh","ou"],this._expressions=[],this._expressionMap={}}get expressions(){return this._expressions.concat()}get expressionMap(){return Object.assign({},this._expressionMap)}get presetExpressionMap(){const e={},n=new Set(Object.values(oP));return Object.entries(this._expressionMap).forEach(([r,i])=>{n.has(r)&&(e[r]=i)}),e}get customExpressionMap(){const e={},n=new Set(Object.values(oP));return Object.entries(this._expressionMap).forEach(([r,i])=>{n.has(r)||(e[r]=i)}),e}copy(e){return this._expressions.concat().forEach(r=>{this.unregisterExpression(r)}),e._expressions.forEach(r=>{this.registerExpression(r)}),this.blinkExpressionNames=e.blinkExpressionNames.concat(),this.lookAtExpressionNames=e.lookAtExpressionNames.concat(),this.mouthExpressionNames=e.mouthExpressionNames.concat(),this}clone(){return new CG().copy(this)}getExpression(e){var n;return(n=this._expressionMap[e])!=null?n:null}registerExpression(e){this._expressions.push(e),this._expressionMap[e.expressionName]=e}unregisterExpression(e){const n=this._expressions.indexOf(e);n===-1&&console.warn("VRMExpressionManager: The specified expressions is not registered"),this._expressions.splice(n,1),delete this._expressionMap[e.expressionName]}getValue(e){var n;const r=this.getExpression(e);return(n=r==null?void 0:r.weight)!=null?n:null}setValue(e,n){const r=this.getExpression(e);r&&(r.weight=TG(n))}resetValues(){this._expressions.forEach(e=>{e.weight=0})}getExpressionTrackName(e){const n=this.getExpression(e);return n?`${n.name}.weight`:null}update(){const e=this._calculateWeightMultipliers();this._expressions.forEach(n=>{n.clearAppliedWeight()}),this._expressions.forEach(n=>{let r=1;const i=n.expressionName;this.blinkExpressionNames.indexOf(i)!==-1&&(r*=e.blink),this.lookAtExpressionNames.indexOf(i)!==-1&&(r*=e.lookAt),this.mouthExpressionNames.indexOf(i)!==-1&&(r*=e.mouth),n.applyWeight({multiplier:r})})}_calculateWeightMultipliers(){let e=1,n=1,r=1;return this._expressions.forEach(i=>{e-=i.overrideBlinkAmount,n-=i.overrideLookAtAmount,r-=i.overrideMouthAmount}),e=Math.max(0,e),n=Math.max(0,n),r=Math.max(0,r),{blink:e,lookAt:n,mouth:r}}},P0={Color:"color",EmissionColor:"emissionColor",ShadeColor:"shadeColor",RimColor:"rimColor",OutlineColor:"outlineColor"},N_e={_Color:P0.Color,_EmissionColor:P0.EmissionColor,_ShadeColor:P0.ShadeColor,_RimColor:P0.RimColor,_OutlineColor:P0.OutlineColor},I_e=new ot,PG=class RG{constructor({material:e,type:n,targetValue:r,targetAlpha:i}){this.material=e,this.type=n,this.targetValue=r,this.targetAlpha=i??1;const s=this._initColorBindState(),o=this._initAlphaBindState();this._state={color:s,alpha:o}}applyWeight(e){const{color:n,alpha:r}=this._state;if(n!=null){const{propertyName:i,deltaValue:s}=n,o=this.material[i];o!=null&&o.add(I_e.copy(s).multiplyScalar(e))}if(r!=null){const{propertyName:i,deltaValue:s}=r;this.material[i]!=null&&(this.material[i]+=s*e)}}clearAppliedWeight(){const{color:e,alpha:n}=this._state;if(e!=null){const{propertyName:r,initialValue:i}=e,s=this.material[r];s!=null&&s.copy(i)}if(n!=null){const{propertyName:r,initialValue:i}=n;this.material[r]!=null&&(this.material[r]=i)}}_initColorBindState(){var e,n,r;const{material:i,type:s,targetValue:o}=this,a=this._getPropertyNameMap(),l=(n=(e=a==null?void 0:a[s])==null?void 0:e[0])!=null?n:null;if(l==null)return console.warn(`Tried to add a material color bind to the material ${(r=i.name)!=null?r:"(no name)"}, the type ${s} but the material or the type is not supported.`),null;const d=i[l].clone(),f=new ot(o.r-d.r,o.g-d.g,o.b-d.b);return{propertyName:l,initialValue:d,deltaValue:f}}_initAlphaBindState(){var e,n,r;const{material:i,type:s,targetAlpha:o}=this,a=this._getPropertyNameMap(),l=(n=(e=a==null?void 0:a[s])==null?void 0:e[1])!=null?n:null;if(l==null&&o!==1)return console.warn(`Tried to add a material alpha bind to the material ${(r=i.name)!=null?r:"(no name)"}, the type ${s} but the material or the type does not support alpha.`),null;if(l==null)return null;const c=i[l],d=o-c;return{propertyName:l,initialValue:c,deltaValue:d}}_getPropertyNameMap(){var e,n;return(n=(e=Object.entries(RG._propertyNameMapMap).find(([r])=>this.material[r]===!0))==null?void 0:e[1])!=null?n:null}};PG._propertyNameMapMap={isMeshStandardMaterial:{color:["color","opacity"],emissionColor:["emissive",null]},isMeshBasicMaterial:{color:["color","opacity"]},isMToonMaterial:{color:["color","opacity"],emissionColor:["emissive",null],outlineColor:["outlineColorFactor",null],matcapColor:["matcapFactor",null],rimColor:["parametricRimColorFactor",null],shadeColor:["shadeColorFactor",null]}};var ZU=PG,D1=class{constructor({primitives:t,index:e,weight:n}){this.primitives=t,this.index=e,this.weight=n}applyWeight(t){this.primitives.forEach(e=>{var n;((n=e.morphTargetInfluences)==null?void 0:n[this.index])!=null&&(e.morphTargetInfluences[this.index]+=this.weight*t)})}clearAppliedWeight(){this.primitives.forEach(t=>{var e;((e=t.morphTargetInfluences)==null?void 0:e[this.index])!=null&&(t.morphTargetInfluences[this.index]=0)})}},QU=new Ve,NG=class IG{constructor({material:e,scale:n,offset:r}){var i,s;this.material=e,this.scale=n,this.offset=r;const o=(i=Object.entries(IG._propertyNamesMap).find(([a])=>e[a]===!0))==null?void 0:i[1];o==null?(console.warn(`Tried to add a texture transform bind to the material ${(s=e.name)!=null?s:"(no name)"} but the material is not supported.`),this._properties=[]):(this._properties=[],o.forEach(a=>{var l;const c=(l=e[a])==null?void 0:l.clone();if(!c)return null;e[a]=c;const d=c.offset.clone(),f=c.repeat.clone(),m=r.clone().sub(d),y=n.clone().sub(f);this._properties.push({name:a,initialOffset:d,deltaOffset:m,initialScale:f,deltaScale:y})}))}applyWeight(e){this._properties.forEach(n=>{const r=this.material[n.name];r!==void 0&&(r.offset.add(QU.copy(n.deltaOffset).multiplyScalar(e)),r.repeat.add(QU.copy(n.deltaScale).multiplyScalar(e)))})}clearAppliedWeight(){this._properties.forEach(e=>{const n=this.material[e.name];n!==void 0&&(n.offset.copy(e.initialOffset),n.repeat.copy(e.initialScale))})}};NG._propertyNamesMap={isMeshStandardMaterial:["map","emissiveMap","bumpMap","normalMap","displacementMap","roughnessMap","metalnessMap","alphaMap"],isMeshBasicMaterial:["map","specularMap","alphaMap"],isMToonMaterial:["map","normalMap","emissiveMap","shadeMultiplyTexture","rimMultiplyTexture","outlineWidthMultiplyTexture","uvAnimationMaskTexture"]};var JU=NG,k_e=new Set(["1.0","1.0-beta"]),kG=class OG{get name(){return"VRMExpressionLoaderPlugin"}constructor(e){this.parser=e}afterRoot(e){return Un(this,null,function*(){e.userData.vrmExpressionManager=yield this._import(e)})}_import(e){return Un(this,null,function*(){const n=yield this._v1Import(e);if(n)return n;const r=yield this._v0Import(e);return r||null})}_v1Import(e){return Un(this,null,function*(){var n,r;const i=this.parser.json;if(!(((n=i.extensionsUsed)==null?void 0:n.indexOf("VRMC_vrm"))!==-1))return null;const o=(r=i.extensions)==null?void 0:r.VRMC_vrm;if(!o)return null;const a=o.specVersion;if(!k_e.has(a))return console.warn(`VRMExpressionLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=o.expressions;if(!l)return null;const c=new Set(Object.values(oP)),d=new Map;l.preset!=null&&Object.entries(l.preset).forEach(([m,y])=>{if(y!=null){if(!c.has(m)){console.warn(`VRMExpressionLoaderPlugin: Unknown preset name "${m}" detected. Ignoring the expression`);return}d.set(m,y)}}),l.custom!=null&&Object.entries(l.custom).forEach(([m,y])=>{if(c.has(m)){console.warn(`VRMExpressionLoaderPlugin: Custom expression cannot have preset name "${m}". Ignoring the expression`);return}d.set(m,y)});const f=new YU;return yield Promise.all(Array.from(d.entries()).map(m=>Un(this,[m],function*([y,x]){var S,_,w,A,T,C,O;const N=new XU(y);if(e.scene.add(N),N.isBinary=(S=x.isBinary)!=null?S:!1,N.overrideBlink=(_=x.overrideBlink)!=null?_:"none",N.overrideLookAt=(w=x.overrideLookAt)!=null?w:"none",N.overrideMouth=(A=x.overrideMouth)!=null?A:"none",(T=x.morphTargetBinds)==null||T.forEach(D=>Un(this,null,function*(){var F;if(D.node===void 0||D.index===void 0)return;const V=yield qU(e,D.node),k=D.index;if(!V.every(j=>Array.isArray(j.morphTargetInfluences)&&k<j.morphTargetInfluences.length)){console.warn(`VRMExpressionLoaderPlugin: ${x.name} attempts to index morph #${k} but not found.`);return}N.addBind(new D1({primitives:V,index:k,weight:(F=D.weight)!=null?F:1}))})),x.materialColorBinds||x.textureTransformBinds){const D=[];e.scene.traverse(F=>{const V=F.material;V&&(Array.isArray(V)?D.push(...V):D.push(V))}),(C=x.materialColorBinds)==null||C.forEach(F=>Un(this,null,function*(){D.filter(k=>{var j;const H=(j=this.parser.associations.get(k))==null?void 0:j.materials;return F.material===H}).forEach(k=>{N.addBind(new ZU({material:k,type:F.type,targetValue:new ot().fromArray(F.targetValue),targetAlpha:F.targetValue[3]}))})})),(O=x.textureTransformBinds)==null||O.forEach(F=>Un(this,null,function*(){D.filter(k=>{var j;const H=(j=this.parser.associations.get(k))==null?void 0:j.materials;return F.material===H}).forEach(k=>{var j,H;N.addBind(new JU({material:k,offset:new Ve().fromArray((j=F.offset)!=null?j:[0,0]),scale:new Ve().fromArray((H=F.scale)!=null?H:[1,1])}))})}))}f.registerExpression(N)}))),f})}_v0Import(e){return Un(this,null,function*(){var n;const r=this.parser.json,i=(n=r.extensions)==null?void 0:n.VRM;if(!i)return null;const s=i.blendShapeMaster;if(!s)return null;const o=new YU,a=s.blendShapeGroups;if(!a)return o;const l=new Set;return yield Promise.all(a.map(c=>Un(this,null,function*(){var d;const f=c.presetName,m=f!=null&&OG.v0v1PresetNameMap[f]||null,y=m??c.name;if(y==null){console.warn("VRMExpressionLoaderPlugin: One of custom expressions has no name. Ignoring the expression");return}if(l.has(y)){console.warn(`VRMExpressionLoaderPlugin: An expression preset ${f} has duplicated entries. Ignoring the expression`);return}l.add(y);const x=new XU(y);e.scene.add(x),x.isBinary=(d=c.isBinary)!=null?d:!1,c.binds&&c.binds.forEach(_=>Un(this,null,function*(){var w;if(_.mesh===void 0||_.index===void 0)return;const A=[];if((w=r.nodes)==null||w.forEach((C,O)=>{C.mesh===_.mesh&&A.push(O)}),A.length===0){console.warn(`VRMExpressionLoaderPlugin: ${c.name} attempts to bind a morph target to the mesh #${_.mesh} but the mesh is not found or not used in the scene. Ignoring the bind.`);return}const T=_.index;yield Promise.all(A.map(C=>Un(this,null,function*(){var O;const N=yield qU(e,C);if(!N.every(D=>Array.isArray(D.morphTargetInfluences)&&T<D.morphTargetInfluences.length)){console.warn(`VRMExpressionLoaderPlugin: ${c.name} attempts to index ${T}th morph but not found.`);return}x.addBind(new D1({primitives:N,index:T,weight:.01*((O=_.weight)!=null?O:100)}))})))}));const S=c.materialValues;S&&S.length!==0&&S.forEach(_=>{if(_.materialName===void 0||_.propertyName===void 0||_.targetValue===void 0)return;const w=[];e.scene.traverse(T=>{if(T.material){const C=T.material;Array.isArray(C)?w.push(...C.filter(O=>(O.name===_.materialName||O.name===_.materialName+" (Outline)")&&w.indexOf(O)===-1)):C.name===_.materialName&&w.indexOf(C)===-1&&w.push(C)}});const A=_.propertyName;w.forEach(T=>{if(A==="_MainTex_ST"){const O=new Ve(_.targetValue[0],_.targetValue[1]),N=new Ve(_.targetValue[2],_.targetValue[3]);N.y=1-N.y-O.y,x.addBind(new JU({material:T,scale:O,offset:N}));return}const C=N_e[A];if(C){x.addBind(new ZU({material:T,type:C,targetValue:new ot().fromArray(_.targetValue),targetAlpha:_.targetValue[3]}));return}console.warn(A+" is not supported")})}),o.registerExpression(x)}))),o})}};kG.v0v1PresetNameMap={a:"aa",e:"ee",i:"ih",o:"oh",u:"ou",blink:"blink",joy:"happy",angry:"angry",sorrow:"sad",fun:"relaxed",lookup:"lookUp",lookdown:"lookDown",lookleft:"lookLeft",lookright:"lookRight",blink_l:"blinkLeft",blink_r:"blinkRight",neutral:"neutral"};var O_e=kG,rN=class Bm{constructor(e,n){this._firstPersonOnlyLayer=Bm.DEFAULT_FIRSTPERSON_ONLY_LAYER,this._thirdPersonOnlyLayer=Bm.DEFAULT_THIRDPERSON_ONLY_LAYER,this._initializedLayers=!1,this.humanoid=e,this.meshAnnotations=n}copy(e){if(this.humanoid!==e.humanoid)throw new Error("VRMFirstPerson: humanoid must be same in order to copy");return this.meshAnnotations=e.meshAnnotations.map(n=>({meshes:n.meshes.concat(),type:n.type})),this}clone(){return new Bm(this.humanoid,this.meshAnnotations).copy(this)}get firstPersonOnlyLayer(){return this._firstPersonOnlyLayer}get thirdPersonOnlyLayer(){return this._thirdPersonOnlyLayer}setup({firstPersonOnlyLayer:e=Bm.DEFAULT_FIRSTPERSON_ONLY_LAYER,thirdPersonOnlyLayer:n=Bm.DEFAULT_THIRDPERSON_ONLY_LAYER}={}){this._initializedLayers||(this._firstPersonOnlyLayer=e,this._thirdPersonOnlyLayer=n,this.meshAnnotations.forEach(r=>{r.meshes.forEach(i=>{r.type==="firstPersonOnly"?(i.layers.set(this._firstPersonOnlyLayer),i.traverse(s=>s.layers.set(this._firstPersonOnlyLayer))):r.type==="thirdPersonOnly"?(i.layers.set(this._thirdPersonOnlyLayer),i.traverse(s=>s.layers.set(this._thirdPersonOnlyLayer))):r.type==="auto"&&this._createHeadlessModel(i)})}),this._initializedLayers=!0)}_excludeTriangles(e,n,r,i){let s=0;if(n!=null&&n.length>0)for(let o=0;o<e.length;o+=3){const a=e[o],l=e[o+1],c=e[o+2],d=n[a],f=r[a];if(d[0]>0&&i.includes(f[0])||d[1]>0&&i.includes(f[1])||d[2]>0&&i.includes(f[2])||d[3]>0&&i.includes(f[3]))continue;const m=n[l],y=r[l];if(m[0]>0&&i.includes(y[0])||m[1]>0&&i.includes(y[1])||m[2]>0&&i.includes(y[2])||m[3]>0&&i.includes(y[3]))continue;const x=n[c],S=r[c];x[0]>0&&i.includes(S[0])||x[1]>0&&i.includes(S[1])||x[2]>0&&i.includes(S[2])||x[3]>0&&i.includes(S[3])||(e[s++]=a,e[s++]=l,e[s++]=c)}return s}_createErasedMesh(e,n){const r=new eM(e.geometry.clone(),e.material);r.name=`${e.name}(erase)`,r.frustumCulled=e.frustumCulled,r.layers.set(this._firstPersonOnlyLayer);const i=r.geometry,s=i.getAttribute("skinIndex"),o=s instanceof QC?[]:s.array,a=[];for(let S=0;S<o.length;S+=4)a.push([o[S],o[S+1],o[S+2],o[S+3]]);const l=i.getAttribute("skinWeight"),c=l instanceof QC?[]:l.array,d=[];for(let S=0;S<c.length;S+=4)d.push([c[S],c[S+1],c[S+2],c[S+3]]);const f=i.getIndex();if(!f)throw new Error("The geometry doesn't have an index buffer");const m=Array.from(f.array),y=this._excludeTriangles(m,d,a,n),x=[];for(let S=0;S<y;S++)x[S]=m[S];return i.setIndex(x),e.onBeforeRender&&(r.onBeforeRender=e.onBeforeRender),r.bind(new Id(e.skeleton.bones,e.skeleton.boneInverses),new Ct),r}_createHeadlessModelForSkinnedMesh(e,n){const r=[];if(n.skeleton.bones.forEach((s,o)=>{this._isEraseTarget(s)&&r.push(o)}),!r.length){n.layers.enable(this._thirdPersonOnlyLayer),n.layers.enable(this._firstPersonOnlyLayer);return}n.layers.set(this._thirdPersonOnlyLayer);const i=this._createErasedMesh(n,r);e.add(i)}_createHeadlessModel(e){if(e.type==="Group")if(e.layers.set(this._thirdPersonOnlyLayer),this._isEraseTarget(e))e.traverse(n=>n.layers.set(this._thirdPersonOnlyLayer));else{const n=new Ts;n.name=`_headless_${e.name}`,n.layers.set(this._firstPersonOnlyLayer),e.parent.add(n),e.children.filter(r=>r.type==="SkinnedMesh").forEach(r=>{const i=r;this._createHeadlessModelForSkinnedMesh(n,i)})}else if(e.type==="SkinnedMesh"){const n=e;this._createHeadlessModelForSkinnedMesh(e.parent,n)}else this._isEraseTarget(e)&&(e.layers.set(this._thirdPersonOnlyLayer),e.traverse(n=>n.layers.set(this._thirdPersonOnlyLayer)))}_isEraseTarget(e){return e===this.humanoid.getRawBoneNode("head")?!0:e.parent?this._isEraseTarget(e.parent):!1}};rN.DEFAULT_FIRSTPERSON_ONLY_LAYER=9;rN.DEFAULT_THIRDPERSON_ONLY_LAYER=10;var ej=rN,L_e=new Set(["1.0","1.0-beta"]),D_e=class{get name(){return"VRMFirstPersonLoaderPlugin"}constructor(t){this.parser=t}afterRoot(t){return Un(this,null,function*(){const e=t.userData.vrmHumanoid;if(e!==null){if(e===void 0)throw new Error("VRMFirstPersonLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");t.userData.vrmFirstPerson=yield this._import(t,e)}})}_import(t,e){return Un(this,null,function*(){if(e==null)return null;const n=yield this._v1Import(t,e);if(n)return n;const r=yield this._v0Import(t,e);return r||null})}_v1Import(t,e){return Un(this,null,function*(){var n,r;const i=this.parser.json;if(!(((n=i.extensionsUsed)==null?void 0:n.indexOf("VRMC_vrm"))!==-1))return null;const o=(r=i.extensions)==null?void 0:r.VRMC_vrm;if(!o)return null;const a=o.specVersion;if(!L_e.has(a))return console.warn(`VRMFirstPersonLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=o.firstPerson,c=[],d=yield KU(t);return Array.from(d.entries()).forEach(([f,m])=>{var y,x;const S=(y=l==null?void 0:l.meshAnnotations)==null?void 0:y.find(_=>_.node===f);c.push({meshes:m,type:(x=S==null?void 0:S.type)!=null?x:"auto"})}),new ej(e,c)})}_v0Import(t,e){return Un(this,null,function*(){var n;const r=this.parser.json,i=(n=r.extensions)==null?void 0:n.VRM;if(!i)return null;const s=i.firstPerson;if(!s)return null;const o=[],a=yield KU(t);return Array.from(a.entries()).forEach(([l,c])=>{const d=r.nodes[l],f=s.meshAnnotations?s.meshAnnotations.find(m=>m.mesh===d.mesh):void 0;o.push({meshes:c,type:this._convertV0FlagToV1Type(f==null?void 0:f.firstPersonFlag)})}),new ej(e,o)})}_convertV0FlagToV1Type(t){return t==="FirstPersonOnly"?"firstPersonOnly":t==="ThirdPersonOnly"?"thirdPersonOnly":t==="Both"?"both":"auto"}},tj=new X,nj=new X,U_e=new qt,rj=class extends Ts{constructor(t){super(),this.vrmHumanoid=t,this._boneAxesMap=new Map,Object.values(t.humanBones).forEach(e=>{const n=new oG(1);n.matrixAutoUpdate=!1,n.material.depthTest=!1,n.material.depthWrite=!1,this.add(n),this._boneAxesMap.set(e,n)})}dispose(){Array.from(this._boneAxesMap.values()).forEach(t=>{t.geometry.dispose(),t.material.dispose()})}updateMatrixWorld(t){Array.from(this._boneAxesMap.entries()).forEach(([e,n])=>{e.node.updateWorldMatrix(!0,!1),e.node.matrixWorld.decompose(tj,U_e,nj);const r=tj.set(.1,.1,.1).divide(nj);n.matrix.copy(e.node.matrixWorld).scale(r)}),super.updateMatrixWorld(t)}},JA=["hips","spine","chest","upperChest","neck","head","leftEye","rightEye","jaw","leftUpperLeg","leftLowerLeg","leftFoot","leftToes","rightUpperLeg","rightLowerLeg","rightFoot","rightToes","leftShoulder","leftUpperArm","leftLowerArm","leftHand","rightShoulder","rightUpperArm","rightLowerArm","rightHand","leftThumbMetacarpal","leftThumbProximal","leftThumbDistal","leftIndexProximal","leftIndexIntermediate","leftIndexDistal","leftMiddleProximal","leftMiddleIntermediate","leftMiddleDistal","leftRingProximal","leftRingIntermediate","leftRingDistal","leftLittleProximal","leftLittleIntermediate","leftLittleDistal","rightThumbMetacarpal","rightThumbProximal","rightThumbDistal","rightIndexProximal","rightIndexIntermediate","rightIndexDistal","rightMiddleProximal","rightMiddleIntermediate","rightMiddleDistal","rightRingProximal","rightRingIntermediate","rightRingDistal","rightLittleProximal","rightLittleIntermediate","rightLittleDistal"],j_e={hips:null,spine:"hips",chest:"spine",upperChest:"chest",neck:"upperChest",head:"neck",leftEye:"head",rightEye:"head",jaw:"head",leftUpperLeg:"hips",leftLowerLeg:"leftUpperLeg",leftFoot:"leftLowerLeg",leftToes:"leftFoot",rightUpperLeg:"hips",rightLowerLeg:"rightUpperLeg",rightFoot:"rightLowerLeg",rightToes:"rightFoot",leftShoulder:"upperChest",leftUpperArm:"leftShoulder",leftLowerArm:"leftUpperArm",leftHand:"leftLowerArm",rightShoulder:"upperChest",rightUpperArm:"rightShoulder",rightLowerArm:"rightUpperArm",rightHand:"rightLowerArm",leftThumbMetacarpal:"leftHand",leftThumbProximal:"leftThumbMetacarpal",leftThumbDistal:"leftThumbProximal",leftIndexProximal:"leftHand",leftIndexIntermediate:"leftIndexProximal",leftIndexDistal:"leftIndexIntermediate",leftMiddleProximal:"leftHand",leftMiddleIntermediate:"leftMiddleProximal",leftMiddleDistal:"leftMiddleIntermediate",leftRingProximal:"leftHand",leftRingIntermediate:"leftRingProximal",leftRingDistal:"leftRingIntermediate",leftLittleProximal:"leftHand",leftLittleIntermediate:"leftLittleProximal",leftLittleDistal:"leftLittleIntermediate",rightThumbMetacarpal:"rightHand",rightThumbProximal:"rightThumbMetacarpal",rightThumbDistal:"rightThumbProximal",rightIndexProximal:"rightHand",rightIndexIntermediate:"rightIndexProximal",rightIndexDistal:"rightIndexIntermediate",rightMiddleProximal:"rightHand",rightMiddleIntermediate:"rightMiddleProximal",rightMiddleDistal:"rightMiddleIntermediate",rightRingProximal:"rightHand",rightRingIntermediate:"rightRingProximal",rightRingDistal:"rightRingIntermediate",rightLittleProximal:"rightHand",rightLittleIntermediate:"rightLittleProximal",rightLittleDistal:"rightLittleIntermediate"};function LG(t){return t.invert?t.invert():t.inverse(),t}var zf=new X,Bf=new qt,aP=class{constructor(t){this.humanBones=t,this.restPose=this.getAbsolutePose()}getAbsolutePose(){const t={};return Object.keys(this.humanBones).forEach(e=>{const n=e,r=this.getBoneNode(n);r&&(zf.copy(r.position),Bf.copy(r.quaternion),t[n]={position:zf.toArray(),rotation:Bf.toArray()})}),t}getPose(){const t={};return Object.keys(this.humanBones).forEach(e=>{const n=e,r=this.getBoneNode(n);if(!r)return;zf.set(0,0,0),Bf.identity();const i=this.restPose[n];i!=null&&i.position&&zf.fromArray(i.position).negate(),i!=null&&i.rotation&&LG(Bf.fromArray(i.rotation)),zf.add(r.position),Bf.premultiply(r.quaternion),t[n]={position:zf.toArray(),rotation:Bf.toArray()}}),t}setPose(t){Object.entries(t).forEach(([e,n])=>{const r=e,i=this.getBoneNode(r);if(!i)return;const s=this.restPose[r];s&&(n!=null&&n.position&&(i.position.fromArray(n.position),s.position&&i.position.add(zf.fromArray(s.position))),n!=null&&n.rotation&&(i.quaternion.fromArray(n.rotation),s.rotation&&i.quaternion.multiply(Bf.fromArray(s.rotation))))})}resetPose(){Object.entries(this.restPose).forEach(([t,e])=>{const n=this.getBoneNode(t);n&&(e!=null&&e.position&&n.position.fromArray(e.position),e!=null&&e.rotation&&n.quaternion.fromArray(e.rotation))})}getBone(t){var e;return(e=this.humanBones[t])!=null?e:void 0}getBoneNode(t){var e,n;return(n=(e=this.humanBones[t])==null?void 0:e.node)!=null?n:null}},eT=new X,F_e=new qt,z_e=new X,ij=class DG extends aP{static _setupTransforms(e){const n=new mn;n.name="VRMHumanoidRig";const r={},i={},s={};JA.forEach(a=>{var l;const c=e.getBoneNode(a);if(c){const d=new X,f=new qt;c.updateWorldMatrix(!0,!1),c.matrixWorld.decompose(d,f,eT),r[a]=d,i[a]=c.quaternion.clone();const m=new qt;(l=c.parent)==null||l.matrixWorld.decompose(eT,m,eT),s[a]=m}});const o={};return JA.forEach(a=>{var l;const c=e.getBoneNode(a);if(c){const d=r[a];let f=a,m;for(;m==null&&(f=j_e[f],f!=null);)m=r[f];const y=new mn;y.name="Normalized_"+c.name,(f?(l=o[f])==null?void 0:l.node:n).add(y),y.position.copy(d),m&&y.position.sub(m),o[a]={node:y}}}),{rigBones:o,root:n,parentWorldRotations:s,boneRotations:i}}constructor(e){const{rigBones:n,root:r,parentWorldRotations:i,boneRotations:s}=DG._setupTransforms(e);super(n),this.original=e,this.root=r,this._parentWorldRotations=i,this._boneRotations=s}update(){JA.forEach(e=>{const n=this.original.getBoneNode(e);if(n!=null){const r=this.getBoneNode(e),i=this._parentWorldRotations[e],s=F_e.copy(i).invert(),o=this._boneRotations[e];if(n.quaternion.copy(r.quaternion).multiply(i).premultiply(s).multiply(o),e==="hips"){const a=r.getWorldPosition(z_e);n.parent.updateWorldMatrix(!0,!1);const l=n.parent.matrixWorld,c=a.applyMatrix4(l.invert());n.position.copy(c)}}})}},sj=class UG{get restPose(){return console.warn("VRMHumanoid: restPose is deprecated. Use either rawRestPose or normalizedRestPose instead."),this.rawRestPose}get rawRestPose(){return this._rawHumanBones.restPose}get normalizedRestPose(){return this._normalizedHumanBones.restPose}get humanBones(){return this._rawHumanBones.humanBones}get rawHumanBones(){return this._rawHumanBones.humanBones}get normalizedHumanBones(){return this._normalizedHumanBones.humanBones}get normalizedHumanBonesRoot(){return this._normalizedHumanBones.root}constructor(e,n){var r;this.autoUpdateHumanBones=(r=n==null?void 0:n.autoUpdateHumanBones)!=null?r:!0,this._rawHumanBones=new aP(e),this._normalizedHumanBones=new ij(this._rawHumanBones)}copy(e){return this.autoUpdateHumanBones=e.autoUpdateHumanBones,this._rawHumanBones=new aP(e.humanBones),this._normalizedHumanBones=new ij(this._rawHumanBones),this}clone(){return new UG(this.humanBones,{autoUpdateHumanBones:this.autoUpdateHumanBones}).copy(this)}getAbsolutePose(){return console.warn("VRMHumanoid: getAbsolutePose() is deprecated. Use either getRawAbsolutePose() or getNormalizedAbsolutePose() instead."),this.getRawAbsolutePose()}getRawAbsolutePose(){return this._rawHumanBones.getAbsolutePose()}getNormalizedAbsolutePose(){return this._normalizedHumanBones.getAbsolutePose()}getPose(){return console.warn("VRMHumanoid: getPose() is deprecated. Use either getRawPose() or getNormalizedPose() instead."),this.getRawPose()}getRawPose(){return this._rawHumanBones.getPose()}getNormalizedPose(){return this._normalizedHumanBones.getPose()}setPose(e){return console.warn("VRMHumanoid: setPose() is deprecated. Use either setRawPose() or setNormalizedPose() instead."),this.setRawPose(e)}setRawPose(e){return this._rawHumanBones.setPose(e)}setNormalizedPose(e){return this._normalizedHumanBones.setPose(e)}resetPose(){return console.warn("VRMHumanoid: resetPose() is deprecated. Use either resetRawPose() or resetNormalizedPose() instead."),this.resetRawPose()}resetRawPose(){return this._rawHumanBones.resetPose()}resetNormalizedPose(){return this._normalizedHumanBones.resetPose()}getBone(e){return console.warn("VRMHumanoid: getBone() is deprecated. Use either getRawBone() or getNormalizedBone() instead."),this.getRawBone(e)}getRawBone(e){return this._rawHumanBones.getBone(e)}getNormalizedBone(e){return this._normalizedHumanBones.getBone(e)}getBoneNode(e){return console.warn("VRMHumanoid: getBoneNode() is deprecated. Use either getRawBoneNode() or getNormalizedBoneNode() instead."),this.getRawBoneNode(e)}getRawBoneNode(e){return this._rawHumanBones.getBoneNode(e)}getNormalizedBoneNode(e){return this._normalizedHumanBones.getBoneNode(e)}update(){this.autoUpdateHumanBones&&this._normalizedHumanBones.update()}},B_e={Hips:"hips",Spine:"spine",Head:"head",LeftUpperLeg:"leftUpperLeg",LeftLowerLeg:"leftLowerLeg",LeftFoot:"leftFoot",RightUpperLeg:"rightUpperLeg",RightLowerLeg:"rightLowerLeg",RightFoot:"rightFoot",LeftUpperArm:"leftUpperArm",LeftLowerArm:"leftLowerArm",LeftHand:"leftHand",RightUpperArm:"rightUpperArm",RightLowerArm:"rightLowerArm",RightHand:"rightHand"},H_e=new Set(["1.0","1.0-beta"]),oj={leftThumbProximal:"leftThumbMetacarpal",leftThumbIntermediate:"leftThumbProximal",rightThumbProximal:"rightThumbMetacarpal",rightThumbIntermediate:"rightThumbProximal"},V_e=class{get name(){return"VRMHumanoidLoaderPlugin"}constructor(t,e){this.parser=t,this.helperRoot=e==null?void 0:e.helperRoot,this.autoUpdateHumanBones=e==null?void 0:e.autoUpdateHumanBones}afterRoot(t){return Un(this,null,function*(){t.userData.vrmHumanoid=yield this._import(t)})}_import(t){return Un(this,null,function*(){const e=yield this._v1Import(t);if(e)return e;const n=yield this._v0Import(t);return n||null})}_v1Import(t){return Un(this,null,function*(){var e,n;const r=this.parser.json;if(!(((e=r.extensionsUsed)==null?void 0:e.indexOf("VRMC_vrm"))!==-1))return null;const s=(n=r.extensions)==null?void 0:n.VRMC_vrm;if(!s)return null;const o=s.specVersion;if(!H_e.has(o))return console.warn(`VRMHumanoidLoaderPlugin: Unknown VRMC_vrm specVersion "${o}"`),null;const a=s.humanoid;if(!a)return null;const l=a.humanBones.leftThumbIntermediate!=null||a.humanBones.rightThumbIntermediate!=null,c={};a.humanBones!=null&&(yield Promise.all(Object.entries(a.humanBones).map(f=>Un(this,[f],function*([m,y]){let x=m;const S=y.node;if(l){const w=oj[x];w!=null&&(x=w)}const _=yield this.parser.getDependency("node",S);if(_==null){console.warn(`A glTF node bound to the humanoid bone ${x} (index = ${S}) does not exist`);return}c[x]={node:_}}))));const d=new sj(this._ensureRequiredBonesExist(c),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(t.scene.add(d.normalizedHumanBonesRoot),this.helperRoot){const f=new rj(d);this.helperRoot.add(f),f.renderOrder=this.helperRoot.renderOrder}return d})}_v0Import(t){return Un(this,null,function*(){var e;const r=(e=this.parser.json.extensions)==null?void 0:e.VRM;if(!r)return null;const i=r.humanoid;if(!i)return null;const s={};i.humanBones!=null&&(yield Promise.all(i.humanBones.map(a=>Un(this,null,function*(){const l=a.bone,c=a.node;if(l==null||c==null)return;if(c<0){console.warn(`A glTF node index for the humanoid bone ${l} is negative (${c}), ignoring this bone.`);return}const d=yield this.parser.getDependency("node",c);if(d==null){console.warn(`A glTF node bound to the humanoid bone ${l} (index = ${c}) does not exist`);return}const f=oj[l],m=f??l;if(s[m]!=null){console.warn(`Multiple bone entries for ${m} detected (index = ${c}), ignoring duplicated entries.`);return}s[m]={node:d}}))));const o=new sj(this._ensureRequiredBonesExist(s),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(t.scene.add(o.normalizedHumanBonesRoot),this.helperRoot){const a=new rj(o);this.helperRoot.add(a),a.renderOrder=this.helperRoot.renderOrder}return o})}_ensureRequiredBonesExist(t){const e=Object.values(B_e).filter(n=>t[n]==null);if(e.length>0)throw new Error(`VRMHumanoidLoaderPlugin: These humanoid bones are required but not exist: ${e.join(", ")}`);return t}},aj=class extends Zt{constructor(){super(),this._currentTheta=0,this._currentRadius=0,this.theta=0,this.radius=0,this._currentTheta=0,this._currentRadius=0,this._attrPos=new Qt(new Float32Array(195),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Qt(new Uint16Array(189),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;this._currentTheta!==this.theta&&(this._currentTheta=this.theta,t=!0),this._currentRadius!==this.radius&&(this._currentRadius=this.radius,t=!0),t&&this._buildPosition()}_buildPosition(){this._attrPos.setXYZ(0,0,0,0);for(let t=0;t<64;t++){const e=t/63*this._currentTheta;this._attrPos.setXYZ(t+1,this._currentRadius*Math.sin(e),0,this._currentRadius*Math.cos(e))}this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<63;t++)this._attrIndex.setXYZ(t*3,0,t+1,t+2);this._attrIndex.needsUpdate=!0}},G_e=class extends Zt{constructor(){super(),this.radius=0,this._currentRadius=0,this.tail=new X,this._currentTail=new X,this._attrPos=new Qt(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Qt(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;this._currentRadius!==this.radius&&(this._currentRadius=this.radius,t=!0),this._currentTail.equals(this.tail)||(this._currentTail.copy(this.tail),t=!0),t&&this._buildPosition()}_buildPosition(){for(let t=0;t<32;t++){const e=t/16*Math.PI;this._attrPos.setXYZ(t,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+t,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+t,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<32;t++){const e=(t+1)%32;this._attrIndex.setXY(t*2,t,e),this._attrIndex.setXY(64+t*2,32+t,32+e),this._attrIndex.setXY(128+t*2,64+t,64+e)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}},I_=new qt,lj=new qt,R0=new X,cj=new X,uj=Math.sqrt(2)/2,W_e=new qt(0,0,-uj,uj),$_e=new X(0,1,0),X_e=class extends Ts{constructor(t){super(),this.matrixAutoUpdate=!1,this.vrmLookAt=t;{const e=new aj;e.radius=.5;const n=new As({color:65280,transparent:!0,opacity:.5,side:xo,depthTest:!1,depthWrite:!1});this._meshPitch=new yr(e,n),this.add(this._meshPitch)}{const e=new aj;e.radius=.5;const n=new As({color:16711680,transparent:!0,opacity:.5,side:xo,depthTest:!1,depthWrite:!1});this._meshYaw=new yr(e,n),this.add(this._meshYaw)}{const e=new G_e;e.radius=.1;const n=new $r({color:16777215,depthTest:!1,depthWrite:!1});this._lineTarget=new Js(e,n),this._lineTarget.frustumCulled=!1,this.add(this._lineTarget)}}dispose(){this._meshYaw.geometry.dispose(),this._meshYaw.material.dispose(),this._meshPitch.geometry.dispose(),this._meshPitch.material.dispose(),this._lineTarget.geometry.dispose(),this._lineTarget.material.dispose()}updateMatrixWorld(t){const e=gr.DEG2RAD*this.vrmLookAt.yaw;this._meshYaw.geometry.theta=e,this._meshYaw.geometry.update();const n=gr.DEG2RAD*this.vrmLookAt.pitch;this._meshPitch.geometry.theta=n,this._meshPitch.geometry.update(),this.vrmLookAt.getLookAtWorldPosition(R0),this.vrmLookAt.getLookAtWorldQuaternion(I_),I_.multiply(this.vrmLookAt.getFaceFrontQuaternion(lj)),this._meshYaw.position.copy(R0),this._meshYaw.quaternion.copy(I_),this._meshPitch.position.copy(R0),this._meshPitch.quaternion.copy(I_),this._meshPitch.quaternion.multiply(lj.setFromAxisAngle($_e,e)),this._meshPitch.quaternion.multiply(W_e);const{target:r,autoUpdate:i}=this.vrmLookAt;r!=null&&i&&(r.getWorldPosition(cj).sub(R0),this._lineTarget.geometry.tail.copy(cj),this._lineTarget.geometry.update(),this._lineTarget.position.copy(R0)),super.updateMatrixWorld(t)}},q_e=new X,K_e=new X;function lP(t,e){return t.matrixWorld.decompose(q_e,e,K_e),e}function K_(t){return[Math.atan2(-t.z,t.x),Math.atan2(t.y,Math.sqrt(t.x*t.x+t.z*t.z))]}function dj(t){const e=Math.round(t/2/Math.PI);return t-2*Math.PI*e}var fj=new X(0,0,1),Y_e=new X,Z_e=new X,Q_e=new X,J_e=new qt,tT=new qt,hj=new qt,ewe=new qt,nT=new as,jG=class FG{constructor(e,n){this.offsetFromHeadBone=new X,this.autoUpdate=!0,this.faceFront=new X(0,0,1),this.humanoid=e,this.applier=n,this._yaw=0,this._pitch=0,this._needsUpdate=!0,this._restHeadWorldQuaternion=this.getLookAtWorldQuaternion(new qt)}get yaw(){return this._yaw}set yaw(e){this._yaw=e,this._needsUpdate=!0}get pitch(){return this._pitch}set pitch(e){this._pitch=e,this._needsUpdate=!0}get euler(){return console.warn("VRMLookAt: euler is deprecated. use getEuler() instead."),this.getEuler(new as)}getEuler(e){return e.set(gr.DEG2RAD*this._pitch,gr.DEG2RAD*this._yaw,0,"YXZ")}copy(e){if(this.humanoid!==e.humanoid)throw new Error("VRMLookAt: humanoid must be same in order to copy");return this.offsetFromHeadBone.copy(e.offsetFromHeadBone),this.applier=e.applier,this.autoUpdate=e.autoUpdate,this.target=e.target,this.faceFront.copy(e.faceFront),this}clone(){return new FG(this.humanoid,this.applier).copy(this)}reset(){this._yaw=0,this._pitch=0,this._needsUpdate=!0}getLookAtWorldPosition(e){const n=this.humanoid.getRawBoneNode("head");return e.copy(this.offsetFromHeadBone).applyMatrix4(n.matrixWorld)}getLookAtWorldQuaternion(e){const n=this.humanoid.getRawBoneNode("head");return lP(n,e)}getFaceFrontQuaternion(e){if(this.faceFront.distanceToSquared(fj)<.01)return e.copy(this._restHeadWorldQuaternion).invert();const[n,r]=K_(this.faceFront);return nT.set(0,.5*Math.PI+n,r,"YZX"),e.setFromEuler(nT).premultiply(ewe.copy(this._restHeadWorldQuaternion).invert())}getLookAtWorldDirection(e){return this.getLookAtWorldQuaternion(tT),this.getFaceFrontQuaternion(hj),e.copy(fj).applyQuaternion(tT).applyQuaternion(hj).applyEuler(this.getEuler(nT))}lookAt(e){const n=J_e.copy(this._restHeadWorldQuaternion).multiply(LG(this.getLookAtWorldQuaternion(tT))),r=this.getLookAtWorldPosition(Z_e),i=Q_e.copy(e).sub(r).applyQuaternion(n).normalize(),[s,o]=K_(this.faceFront),[a,l]=K_(i),c=dj(a-s),d=dj(o-l);this._yaw=gr.RAD2DEG*c,this._pitch=gr.RAD2DEG*d,this._needsUpdate=!0}update(e){this.target!=null&&this.autoUpdate&&this.lookAt(this.target.getWorldPosition(Y_e)),this._needsUpdate&&(this._needsUpdate=!1,this.applier.applyYawPitch(this._yaw,this._pitch))}};jG.EULER_ORDER="YXZ";var twe=jG,nwe=new X(0,0,1),ml=new qt,km=new qt,Fo=new as(0,0,0,"YXZ"),Y_=class{constructor(t,e,n,r,i){this.humanoid=t,this.rangeMapHorizontalInner=e,this.rangeMapHorizontalOuter=n,this.rangeMapVerticalDown=r,this.rangeMapVerticalUp=i,this.faceFront=new X(0,0,1),this._restQuatLeftEye=new qt,this._restQuatRightEye=new qt,this._restLeftEyeParentWorldQuat=new qt,this._restRightEyeParentWorldQuat=new qt;const s=this.humanoid.getRawBoneNode("leftEye"),o=this.humanoid.getRawBoneNode("rightEye");s&&(this._restQuatLeftEye.copy(s.quaternion),lP(s.parent,this._restLeftEyeParentWorldQuat)),o&&(this._restQuatRightEye.copy(o.quaternion),lP(o.parent,this._restRightEyeParentWorldQuat))}applyYawPitch(t,e){const n=this.humanoid.getRawBoneNode("leftEye"),r=this.humanoid.getRawBoneNode("rightEye"),i=this.humanoid.getNormalizedBoneNode("leftEye"),s=this.humanoid.getNormalizedBoneNode("rightEye");n&&(e<0?Fo.x=-gr.DEG2RAD*this.rangeMapVerticalDown.map(-e):Fo.x=gr.DEG2RAD*this.rangeMapVerticalUp.map(e),t<0?Fo.y=-gr.DEG2RAD*this.rangeMapHorizontalInner.map(-t):Fo.y=gr.DEG2RAD*this.rangeMapHorizontalOuter.map(t),ml.setFromEuler(Fo),this._getWorldFaceFrontQuat(km),i.quaternion.copy(km).multiply(ml).multiply(km.invert()),ml.copy(this._restLeftEyeParentWorldQuat),n.quaternion.copy(i.quaternion).multiply(ml).premultiply(ml.invert()).multiply(this._restQuatLeftEye)),r&&(e<0?Fo.x=-gr.DEG2RAD*this.rangeMapVerticalDown.map(-e):Fo.x=gr.DEG2RAD*this.rangeMapVerticalUp.map(e),t<0?Fo.y=-gr.DEG2RAD*this.rangeMapHorizontalOuter.map(-t):Fo.y=gr.DEG2RAD*this.rangeMapHorizontalInner.map(t),ml.setFromEuler(Fo),this._getWorldFaceFrontQuat(km),s.quaternion.copy(km).multiply(ml).multiply(km.invert()),ml.copy(this._restRightEyeParentWorldQuat),r.quaternion.copy(s.quaternion).multiply(ml).premultiply(ml.invert()).multiply(this._restQuatRightEye))}lookAt(t){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const e=gr.RAD2DEG*t.y,n=gr.RAD2DEG*t.x;this.applyYawPitch(e,n)}_getWorldFaceFrontQuat(t){if(this.faceFront.distanceToSquared(nwe)<.01)return t.identity();const[e,n]=K_(this.faceFront);return Fo.set(0,.5*Math.PI+e,n,"YZX"),t.setFromEuler(Fo)}};Y_.type="bone";var cP=class{constructor(t,e,n,r,i){this.expressions=t,this.rangeMapHorizontalInner=e,this.rangeMapHorizontalOuter=n,this.rangeMapVerticalDown=r,this.rangeMapVerticalUp=i}applyYawPitch(t,e){e<0?(this.expressions.setValue("lookDown",0),this.expressions.setValue("lookUp",this.rangeMapVerticalUp.map(-e))):(this.expressions.setValue("lookUp",0),this.expressions.setValue("lookDown",this.rangeMapVerticalDown.map(e))),t<0?(this.expressions.setValue("lookLeft",0),this.expressions.setValue("lookRight",this.rangeMapHorizontalOuter.map(-t))):(this.expressions.setValue("lookRight",0),this.expressions.setValue("lookLeft",this.rangeMapHorizontalOuter.map(t)))}lookAt(t){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const e=gr.RAD2DEG*t.y,n=gr.RAD2DEG*t.x;this.applyYawPitch(e,n)}};cP.type="expression";var pj=class{constructor(t,e){this.inputMaxValue=t,this.outputScale=e}map(t){return this.outputScale*TG(t/this.inputMaxValue)}},rwe=new Set(["1.0","1.0-beta"]),k_=.01,iwe=class{get name(){return"VRMLookAtLoaderPlugin"}constructor(t,e){this.parser=t,this.helperRoot=e==null?void 0:e.helperRoot}afterRoot(t){return Un(this,null,function*(){const e=t.userData.vrmHumanoid;if(e===null)return;if(e===void 0)throw new Error("VRMLookAtLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");const n=t.userData.vrmExpressionManager;if(n!==null){if(n===void 0)throw new Error("VRMLookAtLoaderPlugin: vrmExpressionManager is undefined. VRMExpressionLoaderPlugin have to be used first");t.userData.vrmLookAt=yield this._import(t,e,n)}})}_import(t,e,n){return Un(this,null,function*(){if(e==null||n==null)return null;const r=yield this._v1Import(t,e,n);if(r)return r;const i=yield this._v0Import(t,e,n);return i||null})}_v1Import(t,e,n){return Un(this,null,function*(){var r,i,s;const o=this.parser.json;if(!(((r=o.extensionsUsed)==null?void 0:r.indexOf("VRMC_vrm"))!==-1))return null;const l=(i=o.extensions)==null?void 0:i.VRMC_vrm;if(!l)return null;const c=l.specVersion;if(!rwe.has(c))return console.warn(`VRMLookAtLoaderPlugin: Unknown VRMC_vrm specVersion "${c}"`),null;const d=l.lookAt;if(!d)return null;const f=d.type==="expression"?1:10,m=this._v1ImportRangeMap(d.rangeMapHorizontalInner,f),y=this._v1ImportRangeMap(d.rangeMapHorizontalOuter,f),x=this._v1ImportRangeMap(d.rangeMapVerticalDown,f),S=this._v1ImportRangeMap(d.rangeMapVerticalUp,f);let _;d.type==="expression"?_=new cP(n,m,y,x,S):_=new Y_(e,m,y,x,S);const w=this._importLookAt(e,_);return w.offsetFromHeadBone.fromArray((s=d.offsetFromHeadBone)!=null?s:[0,.06,0]),w})}_v1ImportRangeMap(t,e){var n,r;let i=(n=t==null?void 0:t.inputMaxValue)!=null?n:90;const s=(r=t==null?void 0:t.outputScale)!=null?r:e;return i<k_&&(console.warn("VRMLookAtLoaderPlugin: inputMaxValue of a range map is too small. Consider reviewing the range map!"),i=k_),new pj(i,s)}_v0Import(t,e,n){return Un(this,null,function*(){var r,i,s,o;const l=(r=this.parser.json.extensions)==null?void 0:r.VRM;if(!l)return null;const c=l.firstPerson;if(!c)return null;const d=c.lookAtTypeName==="BlendShape"?1:10,f=this._v0ImportDegreeMap(c.lookAtHorizontalInner,d),m=this._v0ImportDegreeMap(c.lookAtHorizontalOuter,d),y=this._v0ImportDegreeMap(c.lookAtVerticalDown,d),x=this._v0ImportDegreeMap(c.lookAtVerticalUp,d);let S;c.lookAtTypeName==="BlendShape"?S=new cP(n,f,m,y,x):S=new Y_(e,f,m,y,x);const _=this._importLookAt(e,S);return c.firstPersonBoneOffset?_.offsetFromHeadBone.set((i=c.firstPersonBoneOffset.x)!=null?i:0,(s=c.firstPersonBoneOffset.y)!=null?s:.06,-((o=c.firstPersonBoneOffset.z)!=null?o:0)):_.offsetFromHeadBone.set(0,.06,0),_.faceFront.set(0,0,-1),S instanceof Y_&&S.faceFront.set(0,0,-1),_})}_v0ImportDegreeMap(t,e){var n,r;const i=t==null?void 0:t.curve;JSON.stringify(i)!=="[0,0,0,1,1,1,1,0]"&&console.warn("Curves of LookAtDegreeMap defined in VRM 0.0 are not supported");let s=(n=t==null?void 0:t.xRange)!=null?n:90;const o=(r=t==null?void 0:t.yRange)!=null?r:e;return s<k_&&(console.warn("VRMLookAtLoaderPlugin: xRange of a degree map is too small. Consider reviewing the degree map!"),s=k_),new pj(s,o)}_importLookAt(t,e){const n=new twe(t,e);if(this.helperRoot){const r=new X_e(n);this.helperRoot.add(r),r.renderOrder=this.helperRoot.renderOrder}return n}};function swe(t,e){return typeof t!="string"||t===""?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t)?t:e+t)}var owe=new Set(["1.0","1.0-beta"]),awe=class{get name(){return"VRMMetaLoaderPlugin"}constructor(t,e){var n,r,i;this.parser=t,this.needThumbnailImage=(n=e==null?void 0:e.needThumbnailImage)!=null?n:!1,this.acceptLicenseUrls=(r=e==null?void 0:e.acceptLicenseUrls)!=null?r:["https://vrm.dev/licenses/1.0/"],this.acceptV0Meta=(i=e==null?void 0:e.acceptV0Meta)!=null?i:!0}afterRoot(t){return Un(this,null,function*(){t.userData.vrmMeta=yield this._import(t)})}_import(t){return Un(this,null,function*(){const e=yield this._v1Import(t);if(e!=null)return e;const n=yield this._v0Import(t);return n??null})}_v1Import(t){return Un(this,null,function*(){var e,n,r;const i=this.parser.json;if(!(((e=i.extensionsUsed)==null?void 0:e.indexOf("VRMC_vrm"))!==-1))return null;const o=(n=i.extensions)==null?void 0:n.VRMC_vrm;if(o==null)return null;const a=o.specVersion;if(!owe.has(a))return console.warn(`VRMMetaLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=o.meta;if(!l)return null;const c=l.licenseUrl;if(!new Set(this.acceptLicenseUrls).has(c))throw new Error(`VRMMetaLoaderPlugin: The license url "${c}" is not accepted`);let f;return this.needThumbnailImage&&l.thumbnailImage!=null&&(f=(r=yield this._extractGLTFImage(l.thumbnailImage))!=null?r:void 0),{metaVersion:"1",name:l.name,version:l.version,authors:l.authors,copyrightInformation:l.copyrightInformation,contactInformation:l.contactInformation,references:l.references,thirdPartyLicenses:l.thirdPartyLicenses,thumbnailImage:f,licenseUrl:l.licenseUrl,avatarPermission:l.avatarPermission,allowExcessivelyViolentUsage:l.allowExcessivelyViolentUsage,allowExcessivelySexualUsage:l.allowExcessivelySexualUsage,commercialUsage:l.commercialUsage,allowPoliticalOrReligiousUsage:l.allowPoliticalOrReligiousUsage,allowAntisocialOrHateUsage:l.allowAntisocialOrHateUsage,creditNotation:l.creditNotation,allowRedistribution:l.allowRedistribution,modification:l.modification,otherLicenseUrl:l.otherLicenseUrl}})}_v0Import(t){return Un(this,null,function*(){var e;const r=(e=this.parser.json.extensions)==null?void 0:e.VRM;if(!r)return null;const i=r.meta;if(!i)return null;if(!this.acceptV0Meta)throw new Error("VRMMetaLoaderPlugin: Attempted to load VRM0.0 meta but acceptV0Meta is false");let s;return this.needThumbnailImage&&i.texture!=null&&i.texture!==-1&&(s=yield this.parser.getDependency("texture",i.texture)),{metaVersion:"0",allowedUserName:i.allowedUserName,author:i.author,commercialUssageName:i.commercialUssageName,contactInformation:i.contactInformation,licenseName:i.licenseName,otherLicenseUrl:i.otherLicenseUrl,otherPermissionUrl:i.otherPermissionUrl,reference:i.reference,sexualUssageName:i.sexualUssageName,texture:s??void 0,title:i.title,version:i.version,violentUssageName:i.violentUssageName}})}_extractGLTFImage(t){return Un(this,null,function*(){var e;const r=(e=this.parser.json.images)==null?void 0:e[t];if(r==null)return console.warn(`VRMMetaLoaderPlugin: Attempt to use images[${t}] of glTF as a thumbnail but the image doesn't exist`),null;let i=r.uri;if(r.bufferView!=null){const o=yield this.parser.getDependency("bufferView",r.bufferView),a=new Blob([o],{type:r.mimeType});i=URL.createObjectURL(a)}return i==null?(console.warn(`VRMMetaLoaderPlugin: Attempt to use images[${t}] of glTF as a thumbnail but the image couldn't load properly`),null):yield new Ug().loadAsync(swe(i,this.parser.options.path)).catch(o=>(console.error(o),console.warn("VRMMetaLoaderPlugin: Failed to load a thumbnail image"),null))})}},lwe=class{constructor(t){this.scene=t.scene,this.meta=t.meta,this.humanoid=t.humanoid,this.expressionManager=t.expressionManager,this.firstPerson=t.firstPerson,this.lookAt=t.lookAt}update(t){this.humanoid.update(),this.lookAt&&this.lookAt.update(t),this.expressionManager&&this.expressionManager.update()}},cwe=class extends lwe{constructor(t){super(t),this.materials=t.materials,this.springBoneManager=t.springBoneManager,this.nodeConstraintManager=t.nodeConstraintManager}update(t){super.update(t),this.nodeConstraintManager&&this.nodeConstraintManager.update(),this.springBoneManager&&this.springBoneManager.update(t),this.materials&&this.materials.forEach(e=>{e.update&&e.update(t)})}},uwe=Object.defineProperty,mj=Object.getOwnPropertySymbols,dwe=Object.prototype.hasOwnProperty,fwe=Object.prototype.propertyIsEnumerable,gj=(t,e,n)=>e in t?uwe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,vj=(t,e)=>{for(var n in e||(e={}))dwe.call(e,n)&&gj(t,n,e[n]);if(mj)for(var n of mj(e))fwe.call(e,n)&&gj(t,n,e[n]);return t},ch=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),hwe={"":3e3,srgb:3001};function pwe(t,e){parseInt(Td,10)>=152?t.colorSpace=e:t.encoding=hwe[e]}var mwe=class{get pending(){return Promise.all(this._pendings)}constructor(t,e){this._parser=t,this._materialParams=e,this._pendings=[]}assignPrimitive(t,e){e!=null&&(this._materialParams[t]=e)}assignColor(t,e,n){if(e!=null){const r=new ot().fromArray(e);n&&r.convertSRGBToLinear(),this._materialParams[t]=r}}assignTexture(t,e,n){return ch(this,null,function*(){const r=ch(this,null,function*(){if(e!=null){const i=yield this._parser.assignTexture(this._materialParams,t,e);if(i==null){console.warn("GLTFMToonMaterialParamsAssignHelper: Failed to load texture. The rendering result may be wrong");return}n&&pwe(i,"srgb")}});return this._pendings.push(r),r})}assignTextureByIndex(t,e,n){return ch(this,null,function*(){return this.assignTexture(t,e!=null?{index:e}:void 0,n)})}},gwe=`// #define PHONG
|
||
|
||
varying vec3 vViewPosition;
|
||
|
||
#ifndef FLAT_SHADED
|
||
varying vec3 vNormal;
|
||
#endif
|
||
|
||
#include <common>
|
||
|
||
// #include <uv_pars_vertex>
|
||
#ifdef MTOON_USE_UV
|
||
varying vec2 vUv;
|
||
|
||
// COMPAT: pre-r151 uses a common uvTransform
|
||
#if THREE_VRM_THREE_REVISION < 151
|
||
uniform mat3 uvTransform;
|
||
#endif
|
||
#endif
|
||
|
||
// #include <uv2_pars_vertex>
|
||
// COMAPT: pre-r151 uses uv2 for lightMap and aoMap
|
||
#if THREE_VRM_THREE_REVISION < 151
|
||
#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
|
||
attribute vec2 uv2;
|
||
varying vec2 vUv2;
|
||
uniform mat3 uv2Transform;
|
||
#endif
|
||
#endif
|
||
|
||
// #include <displacementmap_pars_vertex>
|
||
// #include <envmap_pars_vertex>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <shadowmap_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
|
||
#ifdef USE_OUTLINEWIDTHMULTIPLYTEXTURE
|
||
uniform sampler2D outlineWidthMultiplyTexture;
|
||
uniform mat3 outlineWidthMultiplyTextureUvTransform;
|
||
#endif
|
||
|
||
uniform float outlineWidthFactor;
|
||
|
||
void main() {
|
||
|
||
// #include <uv_vertex>
|
||
#ifdef MTOON_USE_UV
|
||
// COMPAT: pre-r151 uses a common uvTransform
|
||
#if THREE_VRM_THREE_REVISION >= 151
|
||
vUv = uv;
|
||
#else
|
||
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
||
#endif
|
||
#endif
|
||
|
||
// #include <uv2_vertex>
|
||
// COMAPT: pre-r151 uses uv2 for lightMap and aoMap
|
||
#if THREE_VRM_THREE_REVISION < 151
|
||
#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
|
||
vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;
|
||
#endif
|
||
#endif
|
||
|
||
#include <color_vertex>
|
||
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
|
||
// we need this to compute the outline properly
|
||
objectNormal = normalize( objectNormal );
|
||
|
||
#include <defaultnormal_vertex>
|
||
|
||
#ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED
|
||
vNormal = normalize( transformedNormal );
|
||
#endif
|
||
|
||
#include <begin_vertex>
|
||
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
// #include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
|
||
vViewPosition = - mvPosition.xyz;
|
||
|
||
#ifdef OUTLINE
|
||
float worldNormalLength = length( transformedNormal );
|
||
vec3 outlineOffset = outlineWidthFactor * worldNormalLength * objectNormal;
|
||
|
||
#ifdef USE_OUTLINEWIDTHMULTIPLYTEXTURE
|
||
vec2 outlineWidthMultiplyTextureUv = ( outlineWidthMultiplyTextureUvTransform * vec3( vUv, 1 ) ).xy;
|
||
float outlineTex = texture2D( outlineWidthMultiplyTexture, outlineWidthMultiplyTextureUv ).g;
|
||
outlineOffset *= outlineTex;
|
||
#endif
|
||
|
||
#ifdef OUTLINE_WIDTH_SCREEN
|
||
outlineOffset *= vViewPosition.z / projectionMatrix[ 1 ].y;
|
||
#endif
|
||
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( outlineOffset + transformed, 1.0 );
|
||
|
||
gl_Position.z += 1E-6 * gl_Position.w; // anti-artifact magic
|
||
#endif
|
||
|
||
#include <worldpos_vertex>
|
||
// #include <envmap_vertex>
|
||
#include <shadowmap_vertex>
|
||
#include <fog_vertex>
|
||
|
||
}`,vwe=`// #define PHONG
|
||
|
||
uniform vec3 litFactor;
|
||
|
||
uniform float opacity;
|
||
|
||
uniform vec3 shadeColorFactor;
|
||
#ifdef USE_SHADEMULTIPLYTEXTURE
|
||
uniform sampler2D shadeMultiplyTexture;
|
||
uniform mat3 shadeMultiplyTextureUvTransform;
|
||
#endif
|
||
|
||
uniform float shadingShiftFactor;
|
||
uniform float shadingToonyFactor;
|
||
|
||
#ifdef USE_SHADINGSHIFTTEXTURE
|
||
uniform sampler2D shadingShiftTexture;
|
||
uniform mat3 shadingShiftTextureUvTransform;
|
||
uniform float shadingShiftTextureScale;
|
||
#endif
|
||
|
||
uniform float giEqualizationFactor;
|
||
|
||
uniform vec3 parametricRimColorFactor;
|
||
#ifdef USE_RIMMULTIPLYTEXTURE
|
||
uniform sampler2D rimMultiplyTexture;
|
||
uniform mat3 rimMultiplyTextureUvTransform;
|
||
#endif
|
||
uniform float rimLightingMixFactor;
|
||
uniform float parametricRimFresnelPowerFactor;
|
||
uniform float parametricRimLiftFactor;
|
||
|
||
#ifdef USE_MATCAPTEXTURE
|
||
uniform vec3 matcapFactor;
|
||
uniform sampler2D matcapTexture;
|
||
uniform mat3 matcapTextureUvTransform;
|
||
#endif
|
||
|
||
uniform vec3 emissive;
|
||
uniform float emissiveIntensity;
|
||
|
||
uniform vec3 outlineColorFactor;
|
||
uniform float outlineLightingMixFactor;
|
||
|
||
#ifdef USE_UVANIMATIONMASKTEXTURE
|
||
uniform sampler2D uvAnimationMaskTexture;
|
||
uniform mat3 uvAnimationMaskTextureUvTransform;
|
||
#endif
|
||
|
||
uniform float uvAnimationScrollXOffset;
|
||
uniform float uvAnimationScrollYOffset;
|
||
uniform float uvAnimationRotationPhase;
|
||
|
||
#include <common>
|
||
#include <packing>
|
||
#include <dithering_pars_fragment>
|
||
#include <color_pars_fragment>
|
||
|
||
// #include <uv_pars_fragment>
|
||
#if ( defined( MTOON_USE_UV ) && !defined( MTOON_UVS_VERTEX_ONLY ) )
|
||
varying vec2 vUv;
|
||
#endif
|
||
|
||
// #include <uv2_pars_fragment>
|
||
// COMAPT: pre-r151 uses uv2 for lightMap and aoMap
|
||
#if THREE_VRM_THREE_REVISION < 151
|
||
#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
|
||
varying vec2 vUv2;
|
||
#endif
|
||
#endif
|
||
|
||
#include <map_pars_fragment>
|
||
|
||
#ifdef USE_MAP
|
||
uniform mat3 mapUvTransform;
|
||
#endif
|
||
|
||
// #include <alphamap_pars_fragment>
|
||
|
||
#include <alphatest_pars_fragment>
|
||
|
||
#include <aomap_pars_fragment>
|
||
// #include <lightmap_pars_fragment>
|
||
#include <emissivemap_pars_fragment>
|
||
|
||
#ifdef USE_EMISSIVEMAP
|
||
uniform mat3 emissiveMapUvTransform;
|
||
#endif
|
||
|
||
// #include <envmap_common_pars_fragment>
|
||
// #include <envmap_pars_fragment>
|
||
// #include <cube_uv_reflection_fragment>
|
||
#include <fog_pars_fragment>
|
||
|
||
// #include <bsdfs>
|
||
// COMPAT: pre-r151 doesn't have BRDF_Lambert in <common>
|
||
#if THREE_VRM_THREE_REVISION < 151
|
||
vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
|
||
return RECIPROCAL_PI * diffuseColor;
|
||
}
|
||
#endif
|
||
|
||
#include <lights_pars_begin>
|
||
|
||
#include <normal_pars_fragment>
|
||
|
||
// #include <lights_phong_pars_fragment>
|
||
varying vec3 vViewPosition;
|
||
|
||
struct MToonMaterial {
|
||
vec3 diffuseColor;
|
||
vec3 shadeColor;
|
||
float shadingShift;
|
||
};
|
||
|
||
float linearstep( float a, float b, float t ) {
|
||
return clamp( ( t - a ) / ( b - a ), 0.0, 1.0 );
|
||
}
|
||
|
||
/**
|
||
* Convert NdotL into toon shading factor using shadingShift and shadingToony
|
||
*/
|
||
float getShading(
|
||
const in float dotNL,
|
||
const in float shadow,
|
||
const in float shadingShift
|
||
) {
|
||
float shading = dotNL;
|
||
shading = shading + shadingShift;
|
||
shading = linearstep( -1.0 + shadingToonyFactor, 1.0 - shadingToonyFactor, shading );
|
||
shading *= shadow;
|
||
return shading;
|
||
}
|
||
|
||
/**
|
||
* Mix diffuseColor and shadeColor using shading factor and light color
|
||
*/
|
||
vec3 getDiffuse(
|
||
const in MToonMaterial material,
|
||
const in float shading,
|
||
in vec3 lightColor
|
||
) {
|
||
#ifdef DEBUG_LITSHADERATE
|
||
return vec3( BRDF_Lambert( shading * lightColor ) );
|
||
#endif
|
||
|
||
vec3 col = lightColor * BRDF_Lambert( mix( material.shadeColor, material.diffuseColor, shading ) );
|
||
|
||
// The "comment out if you want to PBR absolutely" line
|
||
#ifdef V0_COMPAT_SHADE
|
||
col = min( col, material.diffuseColor );
|
||
#endif
|
||
|
||
return col;
|
||
}
|
||
|
||
// COMPAT: pre-r156 uses a struct GeometricContext
|
||
#if THREE_VRM_THREE_REVISION >= 157
|
||
void RE_Direct_MToon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in MToonMaterial material, const in float shadow, inout ReflectedLight reflectedLight ) {
|
||
float dotNL = clamp( dot( geometryNormal, directLight.direction ), -1.0, 1.0 );
|
||
vec3 irradiance = directLight.color;
|
||
|
||
// directSpecular will be used for rim lighting, not an actual specular
|
||
reflectedLight.directSpecular += irradiance;
|
||
|
||
irradiance *= dotNL;
|
||
|
||
float shading = getShading( dotNL, shadow, material.shadingShift );
|
||
|
||
// toon shaded diffuse
|
||
reflectedLight.directDiffuse += getDiffuse( material, shading, directLight.color );
|
||
}
|
||
|
||
void RE_IndirectDiffuse_MToon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in MToonMaterial material, inout ReflectedLight reflectedLight ) {
|
||
// indirect diffuse will use diffuseColor, no shadeColor involved
|
||
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
||
|
||
// directSpecular will be used for rim lighting, not an actual specular
|
||
reflectedLight.directSpecular += irradiance;
|
||
}
|
||
#else
|
||
void RE_Direct_MToon( const in IncidentLight directLight, const in GeometricContext geometry, const in MToonMaterial material, const in float shadow, inout ReflectedLight reflectedLight ) {
|
||
float dotNL = clamp( dot( geometry.normal, directLight.direction ), -1.0, 1.0 );
|
||
vec3 irradiance = directLight.color;
|
||
|
||
// directSpecular will be used for rim lighting, not an actual specular
|
||
reflectedLight.directSpecular += irradiance;
|
||
|
||
irradiance *= dotNL;
|
||
|
||
float shading = getShading( dotNL, shadow, material.shadingShift );
|
||
|
||
// toon shaded diffuse
|
||
reflectedLight.directDiffuse += getDiffuse( material, shading, directLight.color );
|
||
}
|
||
|
||
void RE_IndirectDiffuse_MToon( const in vec3 irradiance, const in GeometricContext geometry, const in MToonMaterial material, inout ReflectedLight reflectedLight ) {
|
||
// indirect diffuse will use diffuseColor, no shadeColor involved
|
||
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
||
|
||
// directSpecular will be used for rim lighting, not an actual specular
|
||
reflectedLight.directSpecular += irradiance;
|
||
}
|
||
#endif
|
||
|
||
#define RE_Direct RE_Direct_MToon
|
||
#define RE_IndirectDiffuse RE_IndirectDiffuse_MToon
|
||
#define Material_LightProbeLOD( material ) (0)
|
||
|
||
#include <shadowmap_pars_fragment>
|
||
// #include <bumpmap_pars_fragment>
|
||
|
||
// #include <normalmap_pars_fragment>
|
||
#ifdef USE_NORMALMAP
|
||
|
||
uniform sampler2D normalMap;
|
||
uniform mat3 normalMapUvTransform;
|
||
uniform vec2 normalScale;
|
||
|
||
#endif
|
||
|
||
// COMPAT: pre-r151
|
||
// USE_NORMALMAP_OBJECTSPACE used to be OBJECTSPACE_NORMALMAP in pre-r151
|
||
#if defined( USE_NORMALMAP_OBJECTSPACE ) || defined( OBJECTSPACE_NORMALMAP )
|
||
|
||
uniform mat3 normalMatrix;
|
||
|
||
#endif
|
||
|
||
// COMPAT: pre-r151
|
||
// USE_NORMALMAP_TANGENTSPACE used to be TANGENTSPACE_NORMALMAP in pre-r151
|
||
#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( TANGENTSPACE_NORMALMAP ) )
|
||
|
||
// Per-Pixel Tangent Space Normal Mapping
|
||
// http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html
|
||
|
||
// three-vrm specific change: it requires \`uv\` as an input in order to support uv scrolls
|
||
|
||
// Temporary compat against shader change @ Three.js r126, r151
|
||
#if THREE_VRM_THREE_REVISION >= 151
|
||
|
||
mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
|
||
|
||
vec3 q0 = dFdx( eye_pos.xyz );
|
||
vec3 q1 = dFdy( eye_pos.xyz );
|
||
vec2 st0 = dFdx( uv.st );
|
||
vec2 st1 = dFdy( uv.st );
|
||
|
||
vec3 N = surf_norm;
|
||
|
||
vec3 q1perp = cross( q1, N );
|
||
vec3 q0perp = cross( N, q0 );
|
||
|
||
vec3 T = q1perp * st0.x + q0perp * st1.x;
|
||
vec3 B = q1perp * st0.y + q0perp * st1.y;
|
||
|
||
float det = max( dot( T, T ), dot( B, B ) );
|
||
float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
|
||
|
||
return mat3( T * scale, B * scale, N );
|
||
|
||
}
|
||
|
||
#else
|
||
|
||
vec3 perturbNormal2Arb( vec2 uv, vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {
|
||
|
||
vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );
|
||
vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );
|
||
vec2 st0 = dFdx( uv.st );
|
||
vec2 st1 = dFdy( uv.st );
|
||
|
||
vec3 N = normalize( surf_norm );
|
||
|
||
vec3 q1perp = cross( q1, N );
|
||
vec3 q0perp = cross( N, q0 );
|
||
|
||
vec3 T = q1perp * st0.x + q0perp * st1.x;
|
||
vec3 B = q1perp * st0.y + q0perp * st1.y;
|
||
|
||
// three-vrm specific change: Workaround for the issue that happens when delta of uv = 0.0
|
||
// TODO: Is this still required? Or shall I make a PR about it?
|
||
if ( length( T ) == 0.0 || length( B ) == 0.0 ) {
|
||
return surf_norm;
|
||
}
|
||
|
||
float det = max( dot( T, T ), dot( B, B ) );
|
||
float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );
|
||
|
||
return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );
|
||
|
||
}
|
||
|
||
#endif
|
||
|
||
#endif
|
||
|
||
// #include <specularmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
|
||
// == post correction ==========================================================
|
||
void postCorrection() {
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
#include <dithering_fragment>
|
||
}
|
||
|
||
// == main procedure ===========================================================
|
||
void main() {
|
||
#include <clipping_planes_fragment>
|
||
|
||
vec2 uv = vec2(0.5, 0.5);
|
||
|
||
#if ( defined( MTOON_USE_UV ) && !defined( MTOON_UVS_VERTEX_ONLY ) )
|
||
uv = vUv;
|
||
|
||
float uvAnimMask = 1.0;
|
||
#ifdef USE_UVANIMATIONMASKTEXTURE
|
||
vec2 uvAnimationMaskTextureUv = ( uvAnimationMaskTextureUvTransform * vec3( uv, 1 ) ).xy;
|
||
uvAnimMask = texture2D( uvAnimationMaskTexture, uvAnimationMaskTextureUv ).b;
|
||
#endif
|
||
|
||
float uvRotCos = cos( uvAnimationRotationPhase * uvAnimMask );
|
||
float uvRotSin = sin( uvAnimationRotationPhase * uvAnimMask );
|
||
uv = mat2( uvRotCos, -uvRotSin, uvRotSin, uvRotCos ) * ( uv - 0.5 ) + 0.5;
|
||
uv = uv + vec2( uvAnimationScrollXOffset, uvAnimationScrollYOffset ) * uvAnimMask;
|
||
#endif
|
||
|
||
#ifdef DEBUG_UV
|
||
gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
|
||
#if ( defined( MTOON_USE_UV ) && !defined( MTOON_UVS_VERTEX_ONLY ) )
|
||
gl_FragColor = vec4( uv, 0.0, 1.0 );
|
||
#endif
|
||
return;
|
||
#endif
|
||
|
||
vec4 diffuseColor = vec4( litFactor, opacity );
|
||
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
||
vec3 totalEmissiveRadiance = emissive * emissiveIntensity;
|
||
|
||
#include <logdepthbuf_fragment>
|
||
|
||
// #include <map_fragment>
|
||
#ifdef USE_MAP
|
||
vec2 mapUv = ( mapUvTransform * vec3( uv, 1 ) ).xy;
|
||
vec4 sampledDiffuseColor = texture2D( map, mapUv );
|
||
#ifdef DECODE_VIDEO_TEXTURE
|
||
sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );
|
||
#endif
|
||
diffuseColor *= sampledDiffuseColor;
|
||
#endif
|
||
|
||
// #include <color_fragment>
|
||
#if ( defined( USE_COLOR ) && !defined( IGNORE_VERTEX_COLOR ) )
|
||
diffuseColor.rgb *= vColor;
|
||
#endif
|
||
|
||
// #include <alphamap_fragment>
|
||
|
||
#include <alphatest_fragment>
|
||
|
||
// #include <specularmap_fragment>
|
||
|
||
// #include <normal_fragment_begin>
|
||
float faceDirection = gl_FrontFacing ? 1.0 : -1.0;
|
||
|
||
#ifdef FLAT_SHADED
|
||
|
||
vec3 fdx = dFdx( vViewPosition );
|
||
vec3 fdy = dFdy( vViewPosition );
|
||
vec3 normal = normalize( cross( fdx, fdy ) );
|
||
|
||
#else
|
||
|
||
vec3 normal = normalize( vNormal );
|
||
|
||
#ifdef DOUBLE_SIDED
|
||
|
||
normal *= faceDirection;
|
||
|
||
#endif
|
||
|
||
#endif
|
||
|
||
#ifdef USE_NORMALMAP
|
||
|
||
vec2 normalMapUv = ( normalMapUvTransform * vec3( uv, 1 ) ).xy;
|
||
|
||
#endif
|
||
|
||
#ifdef USE_NORMALMAP_TANGENTSPACE
|
||
|
||
#ifdef USE_TANGENT
|
||
|
||
mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
|
||
|
||
#else
|
||
|
||
mat3 tbn = getTangentFrame( - vViewPosition, normal, normalMapUv );
|
||
|
||
#endif
|
||
|
||
#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
|
||
|
||
tbn[0] *= faceDirection;
|
||
tbn[1] *= faceDirection;
|
||
|
||
#endif
|
||
|
||
#endif
|
||
|
||
#ifdef USE_CLEARCOAT_NORMALMAP
|
||
|
||
#ifdef USE_TANGENT
|
||
|
||
mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
|
||
|
||
#else
|
||
|
||
mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
|
||
|
||
#endif
|
||
|
||
#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
|
||
|
||
tbn2[0] *= faceDirection;
|
||
tbn2[1] *= faceDirection;
|
||
|
||
#endif
|
||
|
||
#endif
|
||
|
||
// non perturbed normal for clearcoat among others
|
||
|
||
vec3 nonPerturbedNormal = normal;
|
||
|
||
#ifdef OUTLINE
|
||
normal *= -1.0;
|
||
#endif
|
||
|
||
// #include <normal_fragment_maps>
|
||
|
||
// COMPAT: pre-r151
|
||
// USE_NORMALMAP_OBJECTSPACE used to be OBJECTSPACE_NORMALMAP in pre-r151
|
||
#if defined( USE_NORMALMAP_OBJECTSPACE ) || defined( OBJECTSPACE_NORMALMAP )
|
||
|
||
normal = texture2D( normalMap, normalMapUv ).xyz * 2.0 - 1.0; // overrides both flatShading and attribute normals
|
||
|
||
#ifdef FLIP_SIDED
|
||
|
||
normal = - normal;
|
||
|
||
#endif
|
||
|
||
#ifdef DOUBLE_SIDED
|
||
|
||
normal = normal * faceDirection;
|
||
|
||
#endif
|
||
|
||
normal = normalize( normalMatrix * normal );
|
||
|
||
// COMPAT: pre-r151
|
||
// USE_NORMALMAP_TANGENTSPACE used to be TANGENTSPACE_NORMALMAP in pre-r151
|
||
#elif defined( USE_NORMALMAP_TANGENTSPACE ) || defined( TANGENTSPACE_NORMALMAP )
|
||
|
||
vec3 mapN = texture2D( normalMap, normalMapUv ).xyz * 2.0 - 1.0;
|
||
mapN.xy *= normalScale;
|
||
|
||
// COMPAT: pre-r151
|
||
#if THREE_VRM_THREE_REVISION >= 151 || defined( USE_TANGENT )
|
||
|
||
normal = normalize( tbn * mapN );
|
||
|
||
#else
|
||
|
||
normal = perturbNormal2Arb( uv, -vViewPosition, normal, mapN, faceDirection );
|
||
|
||
#endif
|
||
|
||
#endif
|
||
|
||
// #include <emissivemap_fragment>
|
||
#ifdef USE_EMISSIVEMAP
|
||
vec2 emissiveMapUv = ( emissiveMapUvTransform * vec3( uv, 1 ) ).xy;
|
||
totalEmissiveRadiance *= texture2D( emissiveMap, emissiveMapUv ).rgb;
|
||
#endif
|
||
|
||
#ifdef DEBUG_NORMAL
|
||
gl_FragColor = vec4( 0.5 + 0.5 * normal, 1.0 );
|
||
return;
|
||
#endif
|
||
|
||
// -- MToon: lighting --------------------------------------------------------
|
||
// accumulation
|
||
// #include <lights_phong_fragment>
|
||
MToonMaterial material;
|
||
|
||
material.diffuseColor = diffuseColor.rgb;
|
||
|
||
material.shadeColor = shadeColorFactor;
|
||
#ifdef USE_SHADEMULTIPLYTEXTURE
|
||
vec2 shadeMultiplyTextureUv = ( shadeMultiplyTextureUvTransform * vec3( uv, 1 ) ).xy;
|
||
material.shadeColor *= texture2D( shadeMultiplyTexture, shadeMultiplyTextureUv ).rgb;
|
||
#endif
|
||
|
||
#if ( defined( USE_COLOR ) && !defined( IGNORE_VERTEX_COLOR ) )
|
||
material.shadeColor.rgb *= vColor;
|
||
#endif
|
||
|
||
material.shadingShift = shadingShiftFactor;
|
||
#ifdef USE_SHADINGSHIFTTEXTURE
|
||
vec2 shadingShiftTextureUv = ( shadingShiftTextureUvTransform * vec3( uv, 1 ) ).xy;
|
||
material.shadingShift += texture2D( shadingShiftTexture, shadingShiftTextureUv ).r * shadingShiftTextureScale;
|
||
#endif
|
||
|
||
// #include <lights_fragment_begin>
|
||
|
||
// MToon Specific changes:
|
||
// Since we want to take shadows into account of shading instead of irradiance,
|
||
// we had to modify the codes that multiplies the results of shadowmap into color of direct lights.
|
||
|
||
// COMPAT: pre-r156 uses a struct GeometricContext
|
||
#if THREE_VRM_THREE_REVISION >= 157
|
||
vec3 geometryPosition = - vViewPosition;
|
||
vec3 geometryNormal = normal;
|
||
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
|
||
|
||
vec3 geometryClearcoatNormal;
|
||
|
||
#ifdef USE_CLEARCOAT
|
||
|
||
geometryClearcoatNormal = clearcoatNormal;
|
||
|
||
#endif
|
||
#else
|
||
GeometricContext geometry;
|
||
|
||
geometry.position = - vViewPosition;
|
||
geometry.normal = normal;
|
||
geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
|
||
|
||
#ifdef USE_CLEARCOAT
|
||
|
||
geometry.clearcoatNormal = clearcoatNormal;
|
||
|
||
#endif
|
||
#endif
|
||
|
||
IncidentLight directLight;
|
||
|
||
// since these variables will be used in unrolled loop, we have to define in prior
|
||
float shadow;
|
||
|
||
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
|
||
|
||
PointLight pointLight;
|
||
#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
|
||
PointLightShadow pointLightShadow;
|
||
#endif
|
||
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
|
||
|
||
pointLight = pointLights[ i ];
|
||
|
||
// COMPAT: pre-r156 uses a struct GeometricContext
|
||
#if THREE_VRM_THREE_REVISION >= 157
|
||
getPointLightInfo( pointLight, geometryPosition, directLight );
|
||
#else
|
||
getPointLightInfo( pointLight, geometry, directLight );
|
||
#endif
|
||
|
||
shadow = 1.0;
|
||
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
|
||
pointLightShadow = pointLightShadows[ i ];
|
||
// COMPAT: pre-r166
|
||
// r166 introduced shadowIntensity
|
||
#if THREE_VRM_THREE_REVISION >= 166
|
||
shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
|
||
#else
|
||
shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
|
||
#endif
|
||
#endif
|
||
|
||
// COMPAT: pre-r156 uses a struct GeometricContext
|
||
#if THREE_VRM_THREE_REVISION >= 157
|
||
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, shadow, reflectedLight );
|
||
#else
|
||
RE_Direct( directLight, geometry, material, shadow, reflectedLight );
|
||
#endif
|
||
|
||
}
|
||
#pragma unroll_loop_end
|
||
|
||
#endif
|
||
|
||
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
|
||
|
||
SpotLight spotLight;
|
||
// COMPAT: pre-r144 uses NUM_SPOT_LIGHT_SHADOWS, r144+ uses NUM_SPOT_LIGHT_COORDS
|
||
#if THREE_VRM_THREE_REVISION >= 144
|
||
#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_COORDS > 0
|
||
SpotLightShadow spotLightShadow;
|
||
#endif
|
||
#elif defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
|
||
SpotLightShadow spotLightShadow;
|
||
#endif
|
||
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
|
||
|
||
spotLight = spotLights[ i ];
|
||
|
||
// COMPAT: pre-r156 uses a struct GeometricContext
|
||
#if THREE_VRM_THREE_REVISION >= 157
|
||
getSpotLightInfo( spotLight, geometryPosition, directLight );
|
||
#else
|
||
getSpotLightInfo( spotLight, geometry, directLight );
|
||
#endif
|
||
|
||
shadow = 1.0;
|
||
// COMPAT: pre-r144 uses NUM_SPOT_LIGHT_SHADOWS and vSpotShadowCoord, r144+ uses NUM_SPOT_LIGHT_COORDS and vSpotLightCoord
|
||
// COMPAT: pre-r166 does not have shadowIntensity, r166+ has shadowIntensity
|
||
#if THREE_VRM_THREE_REVISION >= 166
|
||
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_COORDS )
|
||
spotLightShadow = spotLightShadows[ i ];
|
||
shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
|
||
#endif
|
||
#elif THREE_VRM_THREE_REVISION >= 144
|
||
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_COORDS )
|
||
spotLightShadow = spotLightShadows[ i ];
|
||
shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
|
||
#endif
|
||
#elif defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
|
||
spotLightShadow = spotLightShadows[ i ];
|
||
shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
|
||
#endif
|
||
|
||
// COMPAT: pre-r156 uses a struct GeometricContext
|
||
#if THREE_VRM_THREE_REVISION >= 157
|
||
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, shadow, reflectedLight );
|
||
#else
|
||
RE_Direct( directLight, geometry, material, shadow, reflectedLight );
|
||
#endif
|
||
|
||
}
|
||
#pragma unroll_loop_end
|
||
|
||
#endif
|
||
|
||
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
|
||
|
||
DirectionalLight directionalLight;
|
||
#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
|
||
DirectionalLightShadow directionalLightShadow;
|
||
#endif
|
||
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
|
||
|
||
directionalLight = directionalLights[ i ];
|
||
|
||
// COMPAT: pre-r156 uses a struct GeometricContext
|
||
#if THREE_VRM_THREE_REVISION >= 157
|
||
getDirectionalLightInfo( directionalLight, directLight );
|
||
#else
|
||
getDirectionalLightInfo( directionalLight, geometry, directLight );
|
||
#endif
|
||
|
||
shadow = 1.0;
|
||
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
|
||
directionalLightShadow = directionalLightShadows[ i ];
|
||
// COMPAT: pre-r166
|
||
// r166 introduced shadowIntensity
|
||
#if THREE_VRM_THREE_REVISION >= 166
|
||
shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
|
||
#else
|
||
shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
|
||
#endif
|
||
#endif
|
||
|
||
// COMPAT: pre-r156 uses a struct GeometricContext
|
||
#if THREE_VRM_THREE_REVISION >= 157
|
||
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, shadow, reflectedLight );
|
||
#else
|
||
RE_Direct( directLight, geometry, material, shadow, reflectedLight );
|
||
#endif
|
||
|
||
}
|
||
#pragma unroll_loop_end
|
||
|
||
#endif
|
||
|
||
// #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
|
||
|
||
// RectAreaLight rectAreaLight;
|
||
|
||
// #pragma unroll_loop_start
|
||
// for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
|
||
|
||
// rectAreaLight = rectAreaLights[ i ];
|
||
// RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );
|
||
|
||
// }
|
||
// #pragma unroll_loop_end
|
||
|
||
// #endif
|
||
|
||
#if defined( RE_IndirectDiffuse )
|
||
|
||
vec3 iblIrradiance = vec3( 0.0 );
|
||
|
||
vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
|
||
|
||
// COMPAT: pre-r156 uses a struct GeometricContext
|
||
// COMPAT: pre-r156 doesn't have a define USE_LIGHT_PROBES
|
||
#if THREE_VRM_THREE_REVISION >= 157
|
||
#if defined( USE_LIGHT_PROBES )
|
||
irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
|
||
#endif
|
||
#else
|
||
irradiance += getLightProbeIrradiance( lightProbe, geometry.normal );
|
||
#endif
|
||
|
||
#if ( NUM_HEMI_LIGHTS > 0 )
|
||
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
|
||
|
||
// COMPAT: pre-r156 uses a struct GeometricContext
|
||
#if THREE_VRM_THREE_REVISION >= 157
|
||
irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
|
||
#else
|
||
irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );
|
||
#endif
|
||
|
||
}
|
||
#pragma unroll_loop_end
|
||
|
||
#endif
|
||
|
||
#endif
|
||
|
||
// #if defined( RE_IndirectSpecular )
|
||
|
||
// vec3 radiance = vec3( 0.0 );
|
||
// vec3 clearcoatRadiance = vec3( 0.0 );
|
||
|
||
// #endif
|
||
|
||
#include <lights_fragment_maps>
|
||
#include <lights_fragment_end>
|
||
|
||
// modulation
|
||
#include <aomap_fragment>
|
||
|
||
vec3 col = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
|
||
|
||
#ifdef DEBUG_LITSHADERATE
|
||
gl_FragColor = vec4( col, diffuseColor.a );
|
||
postCorrection();
|
||
return;
|
||
#endif
|
||
|
||
// -- MToon: rim lighting -----------------------------------------
|
||
vec3 viewDir = normalize( vViewPosition );
|
||
|
||
#ifndef PHYSICALLY_CORRECT_LIGHTS
|
||
reflectedLight.directSpecular /= PI;
|
||
#endif
|
||
vec3 rimMix = mix( vec3( 1.0 ), reflectedLight.directSpecular, rimLightingMixFactor );
|
||
|
||
vec3 rim = parametricRimColorFactor * pow( saturate( 1.0 - dot( viewDir, normal ) + parametricRimLiftFactor ), parametricRimFresnelPowerFactor );
|
||
|
||
#ifdef USE_MATCAPTEXTURE
|
||
{
|
||
vec3 x = normalize( vec3( viewDir.z, 0.0, -viewDir.x ) );
|
||
vec3 y = cross( viewDir, x ); // guaranteed to be normalized
|
||
vec2 sphereUv = 0.5 + 0.5 * vec2( dot( x, normal ), -dot( y, normal ) );
|
||
sphereUv = ( matcapTextureUvTransform * vec3( sphereUv, 1 ) ).xy;
|
||
vec3 matcap = texture2D( matcapTexture, sphereUv ).rgb;
|
||
rim += matcapFactor * matcap;
|
||
}
|
||
#endif
|
||
|
||
#ifdef USE_RIMMULTIPLYTEXTURE
|
||
vec2 rimMultiplyTextureUv = ( rimMultiplyTextureUvTransform * vec3( uv, 1 ) ).xy;
|
||
rim *= texture2D( rimMultiplyTexture, rimMultiplyTextureUv ).rgb;
|
||
#endif
|
||
|
||
col += rimMix * rim;
|
||
|
||
// -- MToon: Emission --------------------------------------------------------
|
||
col += totalEmissiveRadiance;
|
||
|
||
// #include <envmap_fragment>
|
||
|
||
// -- Almost done! -----------------------------------------------------------
|
||
#if defined( OUTLINE )
|
||
col = outlineColorFactor.rgb * mix( vec3( 1.0 ), col, outlineLightingMixFactor );
|
||
#endif
|
||
|
||
#ifdef OPAQUE
|
||
diffuseColor.a = 1.0;
|
||
#endif
|
||
|
||
gl_FragColor = vec4( col, diffuseColor.a );
|
||
postCorrection();
|
||
}
|
||
`,ywe={None:"none"},yj={None:"none",ScreenCoordinates:"screenCoordinates"},xwe={3e3:"",3001:"srgb"};function rT(t){return parseInt(Td,10)>=152?t.colorSpace:xwe[t.encoding]}var bwe=class extends Qo{constructor(t={}){var e;super({vertexShader:gwe,fragmentShader:vwe}),this.uvAnimationScrollXSpeedFactor=0,this.uvAnimationScrollYSpeedFactor=0,this.uvAnimationRotationSpeedFactor=0,this.fog=!0,this.normalMapType=lu,this._ignoreVertexColor=!0,this._v0CompatShade=!1,this._debugMode=ywe.None,this._outlineWidthMode=yj.None,this._isOutline=!1,t.transparentWithZWrite&&(t.depthWrite=!0),delete t.transparentWithZWrite,t.fog=!0,t.lights=!0,t.clipping=!0,this.uniforms=E2.merge([ht.common,ht.normalmap,ht.emissivemap,ht.fog,ht.lights,{litFactor:{value:new ot(1,1,1)},mapUvTransform:{value:new Xt},colorAlpha:{value:1},normalMapUvTransform:{value:new Xt},shadeColorFactor:{value:new ot(0,0,0)},shadeMultiplyTexture:{value:null},shadeMultiplyTextureUvTransform:{value:new Xt},shadingShiftFactor:{value:0},shadingShiftTexture:{value:null},shadingShiftTextureUvTransform:{value:new Xt},shadingShiftTextureScale:{value:1},shadingToonyFactor:{value:.9},giEqualizationFactor:{value:.9},matcapFactor:{value:new ot(1,1,1)},matcapTexture:{value:null},matcapTextureUvTransform:{value:new Xt},parametricRimColorFactor:{value:new ot(0,0,0)},rimMultiplyTexture:{value:null},rimMultiplyTextureUvTransform:{value:new Xt},rimLightingMixFactor:{value:1},parametricRimFresnelPowerFactor:{value:5},parametricRimLiftFactor:{value:0},emissive:{value:new ot(0,0,0)},emissiveIntensity:{value:1},emissiveMapUvTransform:{value:new Xt},outlineWidthMultiplyTexture:{value:null},outlineWidthMultiplyTextureUvTransform:{value:new Xt},outlineWidthFactor:{value:0},outlineColorFactor:{value:new ot(0,0,0)},outlineLightingMixFactor:{value:1},uvAnimationMaskTexture:{value:null},uvAnimationMaskTextureUvTransform:{value:new Xt},uvAnimationScrollXOffset:{value:0},uvAnimationScrollYOffset:{value:0},uvAnimationRotationPhase:{value:0}},(e=t.uniforms)!=null?e:{}]),this.setValues(t),this._uploadUniformsWorkaround(),this.customProgramCacheKey=()=>[...Object.entries(this._generateDefines()).map(([n,r])=>`${n}:${r}`),this.matcapTexture?`matcapTextureColorSpace:${rT(this.matcapTexture)}`:"",this.shadeMultiplyTexture?`shadeMultiplyTextureColorSpace:${rT(this.shadeMultiplyTexture)}`:"",this.rimMultiplyTexture?`rimMultiplyTextureColorSpace:${rT(this.rimMultiplyTexture)}`:""].join(","),this.onBeforeCompile=n=>{const r=parseInt(Td,10),i=Object.entries(vj(vj({},this._generateDefines()),this.defines)).filter(([s,o])=>!!o).map(([s,o])=>`#define ${s} ${o}`).join(`
|
||
`)+`
|
||
`;n.vertexShader=i+n.vertexShader,n.fragmentShader=i+n.fragmentShader,r<154&&(n.fragmentShader=n.fragmentShader.replace("#include <colorspace_fragment>","#include <encodings_fragment>"))}}get color(){return this.uniforms.litFactor.value}set color(t){this.uniforms.litFactor.value=t}get map(){return this.uniforms.map.value}set map(t){this.uniforms.map.value=t}get normalMap(){return this.uniforms.normalMap.value}set normalMap(t){this.uniforms.normalMap.value=t}get normalScale(){return this.uniforms.normalScale.value}set normalScale(t){this.uniforms.normalScale.value=t}get emissive(){return this.uniforms.emissive.value}set emissive(t){this.uniforms.emissive.value=t}get emissiveIntensity(){return this.uniforms.emissiveIntensity.value}set emissiveIntensity(t){this.uniforms.emissiveIntensity.value=t}get emissiveMap(){return this.uniforms.emissiveMap.value}set emissiveMap(t){this.uniforms.emissiveMap.value=t}get shadeColorFactor(){return this.uniforms.shadeColorFactor.value}set shadeColorFactor(t){this.uniforms.shadeColorFactor.value=t}get shadeMultiplyTexture(){return this.uniforms.shadeMultiplyTexture.value}set shadeMultiplyTexture(t){this.uniforms.shadeMultiplyTexture.value=t}get shadingShiftFactor(){return this.uniforms.shadingShiftFactor.value}set shadingShiftFactor(t){this.uniforms.shadingShiftFactor.value=t}get shadingShiftTexture(){return this.uniforms.shadingShiftTexture.value}set shadingShiftTexture(t){this.uniforms.shadingShiftTexture.value=t}get shadingShiftTextureScale(){return this.uniforms.shadingShiftTextureScale.value}set shadingShiftTextureScale(t){this.uniforms.shadingShiftTextureScale.value=t}get shadingToonyFactor(){return this.uniforms.shadingToonyFactor.value}set shadingToonyFactor(t){this.uniforms.shadingToonyFactor.value=t}get giEqualizationFactor(){return this.uniforms.giEqualizationFactor.value}set giEqualizationFactor(t){this.uniforms.giEqualizationFactor.value=t}get matcapFactor(){return this.uniforms.matcapFactor.value}set matcapFactor(t){this.uniforms.matcapFactor.value=t}get matcapTexture(){return this.uniforms.matcapTexture.value}set matcapTexture(t){this.uniforms.matcapTexture.value=t}get parametricRimColorFactor(){return this.uniforms.parametricRimColorFactor.value}set parametricRimColorFactor(t){this.uniforms.parametricRimColorFactor.value=t}get rimMultiplyTexture(){return this.uniforms.rimMultiplyTexture.value}set rimMultiplyTexture(t){this.uniforms.rimMultiplyTexture.value=t}get rimLightingMixFactor(){return this.uniforms.rimLightingMixFactor.value}set rimLightingMixFactor(t){this.uniforms.rimLightingMixFactor.value=t}get parametricRimFresnelPowerFactor(){return this.uniforms.parametricRimFresnelPowerFactor.value}set parametricRimFresnelPowerFactor(t){this.uniforms.parametricRimFresnelPowerFactor.value=t}get parametricRimLiftFactor(){return this.uniforms.parametricRimLiftFactor.value}set parametricRimLiftFactor(t){this.uniforms.parametricRimLiftFactor.value=t}get outlineWidthMultiplyTexture(){return this.uniforms.outlineWidthMultiplyTexture.value}set outlineWidthMultiplyTexture(t){this.uniforms.outlineWidthMultiplyTexture.value=t}get outlineWidthFactor(){return this.uniforms.outlineWidthFactor.value}set outlineWidthFactor(t){this.uniforms.outlineWidthFactor.value=t}get outlineColorFactor(){return this.uniforms.outlineColorFactor.value}set outlineColorFactor(t){this.uniforms.outlineColorFactor.value=t}get outlineLightingMixFactor(){return this.uniforms.outlineLightingMixFactor.value}set outlineLightingMixFactor(t){this.uniforms.outlineLightingMixFactor.value=t}get uvAnimationMaskTexture(){return this.uniforms.uvAnimationMaskTexture.value}set uvAnimationMaskTexture(t){this.uniforms.uvAnimationMaskTexture.value=t}get uvAnimationScrollXOffset(){return this.uniforms.uvAnimationScrollXOffset.value}set uvAnimationScrollXOffset(t){this.uniforms.uvAnimationScrollXOffset.value=t}get uvAnimationScrollYOffset(){return this.uniforms.uvAnimationScrollYOffset.value}set uvAnimationScrollYOffset(t){this.uniforms.uvAnimationScrollYOffset.value=t}get uvAnimationRotationPhase(){return this.uniforms.uvAnimationRotationPhase.value}set uvAnimationRotationPhase(t){this.uniforms.uvAnimationRotationPhase.value=t}get ignoreVertexColor(){return this._ignoreVertexColor}set ignoreVertexColor(t){this._ignoreVertexColor=t,this.needsUpdate=!0}get v0CompatShade(){return this._v0CompatShade}set v0CompatShade(t){this._v0CompatShade=t,this.needsUpdate=!0}get debugMode(){return this._debugMode}set debugMode(t){this._debugMode=t,this.needsUpdate=!0}get outlineWidthMode(){return this._outlineWidthMode}set outlineWidthMode(t){this._outlineWidthMode=t,this.needsUpdate=!0}get isOutline(){return this._isOutline}set isOutline(t){this._isOutline=t,this.needsUpdate=!0}get isMToonMaterial(){return!0}update(t){this._uploadUniformsWorkaround(),this._updateUVAnimation(t)}copy(t){return super.copy(t),this.map=t.map,this.normalMap=t.normalMap,this.emissiveMap=t.emissiveMap,this.shadeMultiplyTexture=t.shadeMultiplyTexture,this.shadingShiftTexture=t.shadingShiftTexture,this.matcapTexture=t.matcapTexture,this.rimMultiplyTexture=t.rimMultiplyTexture,this.outlineWidthMultiplyTexture=t.outlineWidthMultiplyTexture,this.uvAnimationMaskTexture=t.uvAnimationMaskTexture,this.normalMapType=t.normalMapType,this.uvAnimationScrollXSpeedFactor=t.uvAnimationScrollXSpeedFactor,this.uvAnimationScrollYSpeedFactor=t.uvAnimationScrollYSpeedFactor,this.uvAnimationRotationSpeedFactor=t.uvAnimationRotationSpeedFactor,this.ignoreVertexColor=t.ignoreVertexColor,this.v0CompatShade=t.v0CompatShade,this.debugMode=t.debugMode,this.outlineWidthMode=t.outlineWidthMode,this.isOutline=t.isOutline,this.needsUpdate=!0,this}_updateUVAnimation(t){this.uniforms.uvAnimationScrollXOffset.value+=t*this.uvAnimationScrollXSpeedFactor,this.uniforms.uvAnimationScrollYOffset.value+=t*this.uvAnimationScrollYSpeedFactor,this.uniforms.uvAnimationRotationPhase.value+=t*this.uvAnimationRotationSpeedFactor,this.uniforms.alphaTest.value=this.alphaTest,this.uniformsNeedUpdate=!0}_uploadUniformsWorkaround(){this.uniforms.opacity.value=this.opacity,this._updateTextureMatrix(this.uniforms.map,this.uniforms.mapUvTransform),this._updateTextureMatrix(this.uniforms.normalMap,this.uniforms.normalMapUvTransform),this._updateTextureMatrix(this.uniforms.emissiveMap,this.uniforms.emissiveMapUvTransform),this._updateTextureMatrix(this.uniforms.shadeMultiplyTexture,this.uniforms.shadeMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.shadingShiftTexture,this.uniforms.shadingShiftTextureUvTransform),this._updateTextureMatrix(this.uniforms.matcapTexture,this.uniforms.matcapTextureUvTransform),this._updateTextureMatrix(this.uniforms.rimMultiplyTexture,this.uniforms.rimMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.outlineWidthMultiplyTexture,this.uniforms.outlineWidthMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.uvAnimationMaskTexture,this.uniforms.uvAnimationMaskTextureUvTransform),this.uniformsNeedUpdate=!0}_generateDefines(){const t=parseInt(Td,10),e=this.outlineWidthMultiplyTexture!==null,n=this.map!==null||this.normalMap!==null||this.emissiveMap!==null||this.shadeMultiplyTexture!==null||this.shadingShiftTexture!==null||this.rimMultiplyTexture!==null||this.uvAnimationMaskTexture!==null;return{THREE_VRM_THREE_REVISION:t,OUTLINE:this._isOutline,MTOON_USE_UV:e||n,MTOON_UVS_VERTEX_ONLY:e&&!n,V0_COMPAT_SHADE:this._v0CompatShade,USE_SHADEMULTIPLYTEXTURE:this.shadeMultiplyTexture!==null,USE_SHADINGSHIFTTEXTURE:this.shadingShiftTexture!==null,USE_MATCAPTEXTURE:this.matcapTexture!==null,USE_RIMMULTIPLYTEXTURE:this.rimMultiplyTexture!==null,USE_OUTLINEWIDTHMULTIPLYTEXTURE:this._isOutline&&this.outlineWidthMultiplyTexture!==null,USE_UVANIMATIONMASKTEXTURE:this.uvAnimationMaskTexture!==null,IGNORE_VERTEX_COLOR:this._ignoreVertexColor===!0,DEBUG_NORMAL:this._debugMode==="normal",DEBUG_LITSHADERATE:this._debugMode==="litShadeRate",DEBUG_UV:this._debugMode==="uv",OUTLINE_WIDTH_SCREEN:this._isOutline&&this._outlineWidthMode===yj.ScreenCoordinates}}_updateTextureMatrix(t,e){t.value&&(t.value.matrixAutoUpdate&&t.value.updateMatrix(),e.value.copy(t.value.matrix))}},_we=new Set(["1.0","1.0-beta"]),zG=class Z_{get name(){return Z_.EXTENSION_NAME}constructor(e,n={}){var r,i,s,o;this.parser=e,this.materialType=(r=n.materialType)!=null?r:bwe,this.renderOrderOffset=(i=n.renderOrderOffset)!=null?i:0,this.v0CompatShade=(s=n.v0CompatShade)!=null?s:!1,this.debugMode=(o=n.debugMode)!=null?o:"none",this._mToonMaterialSet=new Set}beforeRoot(){return ch(this,null,function*(){this._removeUnlitExtensionIfMToonExists()})}afterRoot(e){return ch(this,null,function*(){e.userData.vrmMToonMaterials=Array.from(this._mToonMaterialSet)})}getMaterialType(e){return this._getMToonExtension(e)?this.materialType:null}extendMaterialParams(e,n){const r=this._getMToonExtension(e);return r?this._extendMaterialParams(r,n):null}loadMesh(e){return ch(this,null,function*(){var n;const r=this.parser,s=(n=r.json.meshes)==null?void 0:n[e];if(s==null)throw new Error(`MToonMaterialLoaderPlugin: Attempt to use meshes[${e}] of glTF but the mesh doesn't exist`);const o=s.primitives,a=yield r.loadMesh(e);if(o.length===1){const l=a,c=o[0].material;c!=null&&this._setupPrimitive(l,c)}else{const l=a;for(let c=0;c<o.length;c++){const d=l.children[c],f=o[c].material;f!=null&&this._setupPrimitive(d,f)}}return a})}_removeUnlitExtensionIfMToonExists(){const r=this.parser.json.materials;r==null||r.map((i,s)=>{var o;this._getMToonExtension(s)&&((o=i.extensions)!=null&&o.KHR_materials_unlit)&&delete i.extensions.KHR_materials_unlit})}_getMToonExtension(e){var n,r;const o=(n=this.parser.json.materials)==null?void 0:n[e];if(o==null){console.warn(`MToonMaterialLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}const a=(r=o.extensions)==null?void 0:r[Z_.EXTENSION_NAME];if(a==null)return;const l=a.specVersion;if(!_we.has(l)){console.warn(`MToonMaterialLoaderPlugin: Unknown ${Z_.EXTENSION_NAME} specVersion "${l}"`);return}return a}_extendMaterialParams(e,n){return ch(this,null,function*(){var r;delete n.metalness,delete n.roughness;const i=new mwe(this.parser,n);i.assignPrimitive("transparentWithZWrite",e.transparentWithZWrite),i.assignColor("shadeColorFactor",e.shadeColorFactor),i.assignTexture("shadeMultiplyTexture",e.shadeMultiplyTexture,!0),i.assignPrimitive("shadingShiftFactor",e.shadingShiftFactor),i.assignTexture("shadingShiftTexture",e.shadingShiftTexture,!0),i.assignPrimitive("shadingShiftTextureScale",(r=e.shadingShiftTexture)==null?void 0:r.scale),i.assignPrimitive("shadingToonyFactor",e.shadingToonyFactor),i.assignPrimitive("giEqualizationFactor",e.giEqualizationFactor),i.assignColor("matcapFactor",e.matcapFactor),i.assignTexture("matcapTexture",e.matcapTexture,!0),i.assignColor("parametricRimColorFactor",e.parametricRimColorFactor),i.assignTexture("rimMultiplyTexture",e.rimMultiplyTexture,!0),i.assignPrimitive("rimLightingMixFactor",e.rimLightingMixFactor),i.assignPrimitive("parametricRimFresnelPowerFactor",e.parametricRimFresnelPowerFactor),i.assignPrimitive("parametricRimLiftFactor",e.parametricRimLiftFactor),i.assignPrimitive("outlineWidthMode",e.outlineWidthMode),i.assignPrimitive("outlineWidthFactor",e.outlineWidthFactor),i.assignTexture("outlineWidthMultiplyTexture",e.outlineWidthMultiplyTexture,!1),i.assignColor("outlineColorFactor",e.outlineColorFactor),i.assignPrimitive("outlineLightingMixFactor",e.outlineLightingMixFactor),i.assignTexture("uvAnimationMaskTexture",e.uvAnimationMaskTexture,!1),i.assignPrimitive("uvAnimationScrollXSpeedFactor",e.uvAnimationScrollXSpeedFactor),i.assignPrimitive("uvAnimationScrollYSpeedFactor",e.uvAnimationScrollYSpeedFactor),i.assignPrimitive("uvAnimationRotationSpeedFactor",e.uvAnimationRotationSpeedFactor),i.assignPrimitive("v0CompatShade",this.v0CompatShade),i.assignPrimitive("debugMode",this.debugMode),yield i.pending})}_setupPrimitive(e,n){const r=this._getMToonExtension(n);if(r){const i=this._parseRenderOrder(r);e.renderOrder=i+this.renderOrderOffset,this._generateOutline(e),this._addToMaterialSet(e);return}}_shouldGenerateOutline(e){return typeof e.outlineWidthMode=="string"&&e.outlineWidthMode!=="none"&&typeof e.outlineWidthFactor=="number"&&e.outlineWidthFactor>0}_generateOutline(e){const n=e.material;if(!(n instanceof Gr)||!this._shouldGenerateOutline(n))return;e.material=[n];const r=n.clone();r.name+=" (Outline)",r.isOutline=!0,r.side=ss,e.material.push(r);const i=e.geometry,s=i.index?i.index.count:i.attributes.position.count/3;i.addGroup(0,s,0),i.addGroup(0,s,1)}_addToMaterialSet(e){const n=e.material,r=new Set;Array.isArray(n)?n.forEach(i=>r.add(i)):r.add(n);for(const i of r)this._mToonMaterialSet.add(i)}_parseRenderOrder(e){var n;return(e.transparentWithZWrite?0:19)+((n=e.renderQueueOffsetNumber)!=null?n:0)}};zG.EXTENSION_NAME="VRMC_materials_mtoon";var wwe=zG,Swe=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),BG=class uP{get name(){return uP.EXTENSION_NAME}constructor(e){this.parser=e}extendMaterialParams(e,n){return Swe(this,null,function*(){const r=this._getHDREmissiveMultiplierExtension(e);if(r==null)return;console.warn("VRMMaterialsHDREmissiveMultiplierLoaderPlugin: `VRMC_materials_hdr_emissiveMultiplier` is archived. Use `KHR_materials_emissive_strength` instead.");const i=r.emissiveMultiplier;n.emissiveIntensity=i})}_getHDREmissiveMultiplierExtension(e){var n,r;const o=(n=this.parser.json.materials)==null?void 0:n[e];if(o==null){console.warn(`VRMMaterialsHDREmissiveMultiplierLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}const a=(r=o.extensions)==null?void 0:r[uP.EXTENSION_NAME];if(a!=null)return a}};BG.EXTENSION_NAME="VRMC_materials_hdr_emissiveMultiplier";var Mwe=BG,Ewe=Object.defineProperty,Awe=Object.defineProperties,Twe=Object.getOwnPropertyDescriptors,xj=Object.getOwnPropertySymbols,Cwe=Object.prototype.hasOwnProperty,Pwe=Object.prototype.propertyIsEnumerable,bj=(t,e,n)=>e in t?Ewe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,gl=(t,e)=>{for(var n in e||(e={}))Cwe.call(e,n)&&bj(t,n,e[n]);if(xj)for(var n of xj(e))Pwe.call(e,n)&&bj(t,n,e[n]);return t},_j=(t,e)=>Awe(t,Twe(e)),Rwe=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())});function Om(t){return Math.pow(t,2.2)}var Nwe=class{get name(){return"VRMMaterialsV0CompatPlugin"}constructor(t){var e;this.parser=t,this._renderQueueMapTransparent=new Map,this._renderQueueMapTransparentZWrite=new Map;const n=this.parser.json;n.extensionsUsed=(e=n.extensionsUsed)!=null?e:[],n.extensionsUsed.indexOf("KHR_texture_transform")===-1&&n.extensionsUsed.push("KHR_texture_transform")}beforeRoot(){return Rwe(this,null,function*(){var t;const e=this.parser.json,n=(t=e.extensions)==null?void 0:t.VRM,r=n==null?void 0:n.materialProperties;r&&(this._populateRenderQueueMap(r),r.forEach((i,s)=>{var o,a;const l=(o=e.materials)==null?void 0:o[s];if(l==null){console.warn(`VRMMaterialsV0CompatPlugin: Attempt to use materials[${s}] of glTF but the material doesn't exist`);return}if(i.shader==="VRM/MToon"){const c=this._parseV0MToonProperties(i,l);e.materials[s]=c}else if((a=i.shader)!=null&&a.startsWith("VRM/Unlit")){const c=this._parseV0UnlitProperties(i,l);e.materials[s]=c}else i.shader==="VRM_USE_GLTFSHADER"||console.warn(`VRMMaterialsV0CompatPlugin: Unknown shader: ${i.shader}`)}))})}_parseV0MToonProperties(t,e){var n,r,i,s,o,a,l,c,d,f,m,y,x,S,_,w,A,T,C,O,N,D,F,V,k,j,H,ne,te,pe,oe,ce,B,K,q,$,Z,ge,ae,fe,_e,Se,$e,Me,He,Xe,ue,Q,Ge,Ue,We,Qe,xt,at,ee;const W=(r=(n=t.keywordMap)==null?void 0:n._ALPHABLEND_ON)!=null?r:!1,Be=((i=t.floatProperties)==null?void 0:i._ZWrite)===1&&W,le=this._v0ParseRenderQueue(t),Ce=(o=(s=t.keywordMap)==null?void 0:s._ALPHATEST_ON)!=null?o:!1,lt=W?"BLEND":Ce?"MASK":"OPAQUE",rt=Ce?(l=(a=t.floatProperties)==null?void 0:a._Cutoff)!=null?l:.5:void 0,nn=((d=(c=t.floatProperties)==null?void 0:c._CullMode)!=null?d:2)===0,qe=this._portTextureTransform(t),dt=((m=(f=t.vectorProperties)==null?void 0:f._Color)!=null?m:[1,1,1,1]).map((et,vt)=>vt===3?et:Om(et)),Dt=(y=t.textureProperties)==null?void 0:y._MainTex,Ut=Dt!=null?{index:Dt,extensions:gl({},qe)}:void 0,pt=(S=(x=t.floatProperties)==null?void 0:x._BumpScale)!=null?S:1,de=(_=t.textureProperties)==null?void 0:_._BumpMap,J=de!=null?{index:de,scale:pt,extensions:gl({},qe)}:void 0,Ae=((A=(w=t.vectorProperties)==null?void 0:w._EmissionColor)!=null?A:[0,0,0,1]).map(Om),re=(T=t.textureProperties)==null?void 0:T._EmissionMap,Fe=re!=null?{index:re,extensions:gl({},qe)}:void 0,Te=((O=(C=t.vectorProperties)==null?void 0:C._ShadeColor)!=null?O:[.97,.81,.86,1]).map(Om),Le=(N=t.textureProperties)==null?void 0:N._ShadeTexture,Ke=Le!=null?{index:Le,extensions:gl({},qe)}:void 0;let ut=(F=(D=t.floatProperties)==null?void 0:D._ShadeShift)!=null?F:0,Kt=(k=(V=t.floatProperties)==null?void 0:V._ShadeToony)!=null?k:.9;Kt=gr.lerp(Kt,1,.5+.5*ut),ut=-ut-(1-Kt);const un=(H=(j=t.floatProperties)==null?void 0:j._IndirectLightIntensity)!=null?H:.1,Cn=un?1-un:void 0,Jt=(ne=t.textureProperties)==null?void 0:ne._SphereAdd,Hn=Jt!=null?[1,1,1]:void 0,hr=Jt!=null?{index:Jt}:void 0,Si=(pe=(te=t.floatProperties)==null?void 0:te._RimLightingMix)!=null?pe:0,ra=(oe=t.textureProperties)==null?void 0:oe._RimTexture,Mi=ra!=null?{index:ra,extensions:gl({},qe)}:void 0,Ka=((B=(ce=t.vectorProperties)==null?void 0:ce._RimColor)!=null?B:[0,0,0,1]).map(Om),Ns=(q=(K=t.floatProperties)==null?void 0:K._RimFresnelPower)!=null?q:1,ia=(Z=($=t.floatProperties)==null?void 0:$._RimLift)!=null?Z:0,Ei=["none","worldCoordinates","screenCoordinates"][(ae=(ge=t.floatProperties)==null?void 0:ge._OutlineWidthMode)!=null?ae:0];let Ao=(_e=(fe=t.floatProperties)==null?void 0:fe._OutlineWidth)!=null?_e:0;Ao=.01*Ao;const sa=(Se=t.textureProperties)==null?void 0:Se._OutlineWidthTexture,cu=sa!=null?{index:sa,extensions:gl({},qe)}:void 0,uu=((Me=($e=t.vectorProperties)==null?void 0:$e._OutlineColor)!=null?Me:[0,0,0]).map(Om),du=((Xe=(He=t.floatProperties)==null?void 0:He._OutlineColorMode)!=null?Xe:0)===1?(Q=(ue=t.floatProperties)==null?void 0:ue._OutlineLightingMix)!=null?Q:1:0,Hl=(Ge=t.textureProperties)==null?void 0:Ge._UvAnimMaskTexture,Y=Hl!=null?{index:Hl,extensions:gl({},qe)}:void 0,xe=(We=(Ue=t.floatProperties)==null?void 0:Ue._UvAnimScrollX)!=null?We:0;let Re=(xt=(Qe=t.floatProperties)==null?void 0:Qe._UvAnimScrollY)!=null?xt:0;Re!=null&&(Re=-Re);const ke=(ee=(at=t.floatProperties)==null?void 0:at._UvAnimRotation)!=null?ee:0,we={specVersion:"1.0",transparentWithZWrite:Be,renderQueueOffsetNumber:le,shadeColorFactor:Te,shadeMultiplyTexture:Ke,shadingShiftFactor:ut,shadingToonyFactor:Kt,giEqualizationFactor:Cn,matcapFactor:Hn,matcapTexture:hr,rimLightingMixFactor:Si,rimMultiplyTexture:Mi,parametricRimColorFactor:Ka,parametricRimFresnelPowerFactor:Ns,parametricRimLiftFactor:ia,outlineWidthMode:Ei,outlineWidthFactor:Ao,outlineWidthMultiplyTexture:cu,outlineColorFactor:uu,outlineLightingMixFactor:du,uvAnimationMaskTexture:Y,uvAnimationScrollXSpeedFactor:xe,uvAnimationScrollYSpeedFactor:Re,uvAnimationRotationSpeedFactor:ke};return _j(gl({},e),{pbrMetallicRoughness:{baseColorFactor:dt,baseColorTexture:Ut},normalTexture:J,emissiveTexture:Fe,emissiveFactor:Ae,alphaMode:lt,alphaCutoff:rt,doubleSided:nn,extensions:{VRMC_materials_mtoon:we}})}_parseV0UnlitProperties(t,e){var n,r,i,s,o;const a=t.shader==="VRM/UnlitTransparentZWrite",l=t.shader==="VRM/UnlitTransparent"||a,c=this._v0ParseRenderQueue(t),d=t.shader==="VRM/UnlitCutout",f=l?"BLEND":d?"MASK":"OPAQUE",m=d?(r=(n=t.floatProperties)==null?void 0:n._Cutoff)!=null?r:.5:void 0,y=this._portTextureTransform(t),x=((s=(i=t.vectorProperties)==null?void 0:i._Color)!=null?s:[1,1,1,1]).map(Om),S=(o=t.textureProperties)==null?void 0:o._MainTex,_=S!=null?{index:S,extensions:gl({},y)}:void 0,w={specVersion:"1.0",transparentWithZWrite:a,renderQueueOffsetNumber:c,shadeColorFactor:x,shadeMultiplyTexture:_};return _j(gl({},e),{pbrMetallicRoughness:{baseColorFactor:x,baseColorTexture:_},alphaMode:f,alphaCutoff:m,extensions:{VRMC_materials_mtoon:w}})}_portTextureTransform(t){var e,n,r,i,s;const o=(e=t.vectorProperties)==null?void 0:e._MainTex;if(o==null)return{};const a=[(n=o==null?void 0:o[0])!=null?n:0,(r=o==null?void 0:o[1])!=null?r:0],l=[(i=o==null?void 0:o[2])!=null?i:1,(s=o==null?void 0:o[3])!=null?s:1];return a[1]=1-l[1]-a[1],{KHR_texture_transform:{offset:a,scale:l}}}_v0ParseRenderQueue(t){var e,n;const r=t.shader==="VRM/UnlitTransparentZWrite",i=((e=t.keywordMap)==null?void 0:e._ALPHABLEND_ON)!=null||t.shader==="VRM/UnlitTransparent"||r,s=((n=t.floatProperties)==null?void 0:n._ZWrite)===1||r;let o=0;if(i){const a=t.renderQueue;a!=null&&(s?o=this._renderQueueMapTransparentZWrite.get(a):o=this._renderQueueMapTransparent.get(a))}return o}_populateRenderQueueMap(t){const e=new Set,n=new Set;t.forEach(r=>{var i,s;const o=r.shader==="VRM/UnlitTransparentZWrite",a=((i=r.keywordMap)==null?void 0:i._ALPHABLEND_ON)!=null||r.shader==="VRM/UnlitTransparent"||o,l=((s=r.floatProperties)==null?void 0:s._ZWrite)===1||o;if(a){const c=r.renderQueue;c!=null&&(l?n.add(c):e.add(c))}}),e.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${e.size} render queues for Transparent materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),n.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${n.size} render queues for TransparentZWrite materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),Array.from(e).sort().forEach((r,i)=>{const s=Math.min(Math.max(i-e.size+1,-9),0);this._renderQueueMapTransparent.set(r,s)}),Array.from(n).sort().forEach((r,i)=>{const s=Math.min(Math.max(i,0),9);this._renderQueueMapTransparentZWrite.set(r,s)})}},wj=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),id=new X,iT=class extends Ts{constructor(t){super(),this._attrPosition=new Qt(new Float32Array([0,0,0,0,0,0]),3),this._attrPosition.setUsage(t6);const e=new Zt;e.setAttribute("position",this._attrPosition);const n=new $r({color:16711935,depthTest:!1,depthWrite:!1});this._line=new jl(e,n),this.add(this._line),this.constraint=t}updateMatrixWorld(t){id.setFromMatrixPosition(this.constraint.destination.matrixWorld),this._attrPosition.setXYZ(0,id.x,id.y,id.z),this.constraint.source&&id.setFromMatrixPosition(this.constraint.source.matrixWorld),this._attrPosition.setXYZ(1,id.x,id.y,id.z),this._attrPosition.needsUpdate=!0,super.updateMatrixWorld(t)}};function Sj(t,e){return e.set(t.elements[12],t.elements[13],t.elements[14])}var Iwe=new X,kwe=new X;function Owe(t,e){return t.decompose(Iwe,e,kwe),e}function U1(t){return t.invert?t.invert():t.inverse(),t}var iN=class{constructor(t,e){this.destination=t,this.source=e,this.weight=1}},Lwe=new X,Dwe=new X,Uwe=new X,jwe=new qt,Fwe=new qt,zwe=new qt,Bwe=class extends iN{get aimAxis(){return this._aimAxis}set aimAxis(t){this._aimAxis=t,this._v3AimAxis.set(t==="PositiveX"?1:t==="NegativeX"?-1:0,t==="PositiveY"?1:t==="NegativeY"?-1:0,t==="PositiveZ"?1:t==="NegativeZ"?-1:0)}get dependencies(){const t=new Set([this.source]);return this.destination.parent&&t.add(this.destination.parent),t}constructor(t,e){super(t,e),this._aimAxis="PositiveX",this._v3AimAxis=new X(1,0,0),this._dstRestQuat=new qt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion)}update(){this.destination.updateWorldMatrix(!0,!1),this.source.updateWorldMatrix(!0,!1);const t=jwe.identity(),e=Fwe.identity();this.destination.parent&&(Owe(this.destination.parent.matrixWorld,t),U1(e.copy(t)));const n=Lwe.copy(this._v3AimAxis).applyQuaternion(this._dstRestQuat).applyQuaternion(t),r=Sj(this.source.matrixWorld,Dwe).sub(Sj(this.destination.matrixWorld,Uwe)).normalize(),i=zwe.setFromUnitVectors(n,r).premultiply(e).multiply(t).multiply(this._dstRestQuat);this.destination.quaternion.copy(this._dstRestQuat).slerp(i,this.weight)}};function Hwe(t,e){const n=[t];let r=t.parent;for(;r!==null;)n.unshift(r),r=r.parent;n.forEach(i=>{e(i)})}var Vwe=class{constructor(){this._constraints=new Set,this._objectConstraintsMap=new Map}get constraints(){return this._constraints}addConstraint(t){this._constraints.add(t);let e=this._objectConstraintsMap.get(t.destination);e==null&&(e=new Set,this._objectConstraintsMap.set(t.destination,e)),e.add(t)}deleteConstraint(t){this._constraints.delete(t),this._objectConstraintsMap.get(t.destination).delete(t)}setInitState(){const t=new Set,e=new Set;for(const n of this._constraints)this._processConstraint(n,t,e,r=>r.setInitState())}update(){const t=new Set,e=new Set;for(const n of this._constraints)this._processConstraint(n,t,e,r=>r.update())}_processConstraint(t,e,n,r){if(n.has(t))return;if(e.has(t))throw new Error("VRMNodeConstraintManager: Circular dependency detected while updating constraints");e.add(t);const i=t.dependencies;for(const s of i)Hwe(s,o=>{const a=this._objectConstraintsMap.get(o);if(a)for(const l of a)this._processConstraint(l,e,n,r)});r(t),n.add(t)}},Gwe=new qt,Wwe=new qt,$we=class extends iN{get dependencies(){return new Set([this.source])}constructor(t,e){super(t,e),this._dstRestQuat=new qt,this._invSrcRestQuat=new qt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),U1(this._invSrcRestQuat.copy(this.source.quaternion))}update(){const t=Gwe.copy(this._invSrcRestQuat).multiply(this.source.quaternion),e=Wwe.copy(this._dstRestQuat).multiply(t);this.destination.quaternion.copy(this._dstRestQuat).slerp(e,this.weight)}},Xwe=new X,qwe=new qt,Kwe=new qt,Ywe=class extends iN{get rollAxis(){return this._rollAxis}set rollAxis(t){this._rollAxis=t,this._v3RollAxis.set(t==="X"?1:0,t==="Y"?1:0,t==="Z"?1:0)}get dependencies(){return new Set([this.source])}constructor(t,e){super(t,e),this._rollAxis="X",this._v3RollAxis=new X(1,0,0),this._dstRestQuat=new qt,this._invDstRestQuat=new qt,this._invSrcRestQuatMulDstRestQuat=new qt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),U1(this._invDstRestQuat.copy(this._dstRestQuat)),U1(this._invSrcRestQuatMulDstRestQuat.copy(this.source.quaternion)).multiply(this._dstRestQuat)}update(){const t=qwe.copy(this._invDstRestQuat).multiply(this.source.quaternion).multiply(this._invSrcRestQuatMulDstRestQuat),e=Xwe.copy(this._v3RollAxis).applyQuaternion(t),r=Kwe.setFromUnitVectors(e,this._v3RollAxis).premultiply(this._dstRestQuat).multiply(t);this.destination.quaternion.copy(this._dstRestQuat).slerp(r,this.weight)}},Zwe=new Set(["1.0","1.0-beta"]),HG=class z0{get name(){return z0.EXTENSION_NAME}constructor(e,n){this.parser=e,this.helperRoot=n==null?void 0:n.helperRoot}afterRoot(e){return wj(this,null,function*(){e.userData.vrmNodeConstraintManager=yield this._import(e)})}_import(e){return wj(this,null,function*(){var n;const r=this.parser.json;if(!(((n=r.extensionsUsed)==null?void 0:n.indexOf(z0.EXTENSION_NAME))!==-1))return null;const s=new Vwe,o=yield this.parser.getDependencies("node");return o.forEach((a,l)=>{var c;const d=r.nodes[l],f=(c=d==null?void 0:d.extensions)==null?void 0:c[z0.EXTENSION_NAME];if(f==null)return;const m=f.specVersion;if(!Zwe.has(m)){console.warn(`VRMNodeConstraintLoaderPlugin: Unknown ${z0.EXTENSION_NAME} specVersion "${m}"`);return}const y=f.constraint;if(y.roll!=null){const x=this._importRollConstraint(a,o,y.roll);s.addConstraint(x)}else if(y.aim!=null){const x=this._importAimConstraint(a,o,y.aim);s.addConstraint(x)}else if(y.rotation!=null){const x=this._importRotationConstraint(a,o,y.rotation);s.addConstraint(x)}}),e.scene.updateMatrixWorld(),s.setInitState(),s})}_importRollConstraint(e,n,r){const{source:i,rollAxis:s,weight:o}=r,a=n[i],l=new Ywe(e,a);if(s!=null&&(l.rollAxis=s),o!=null&&(l.weight=o),this.helperRoot){const c=new iT(l);this.helperRoot.add(c)}return l}_importAimConstraint(e,n,r){const{source:i,aimAxis:s,weight:o}=r,a=n[i],l=new Bwe(e,a);if(s!=null&&(l.aimAxis=s),o!=null&&(l.weight=o),this.helperRoot){const c=new iT(l);this.helperRoot.add(c)}return l}_importRotationConstraint(e,n,r){const{source:i,weight:s}=r,o=n[i],a=new $we(e,o);if(s!=null&&(a.weight=s),this.helperRoot){const l=new iT(a);this.helperRoot.add(l)}return a}};HG.EXTENSION_NAME="VRMC_node_constraint";var Qwe=HG,O_=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),sN=class{},sT=new X,Hf=new X,VG=class extends sN{get type(){return"capsule"}constructor(t){var e,n,r,i;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new X(0,0,0),this.tail=(n=t==null?void 0:t.tail)!=null?n:new X(0,0,0),this.radius=(r=t==null?void 0:t.radius)!=null?r:0,this.inside=(i=t==null?void 0:t.inside)!=null?i:!1}calculateCollision(t,e,n,r){sT.setFromMatrixPosition(t),Hf.subVectors(this.tail,this.offset).applyMatrix4(t),Hf.sub(sT);const i=Hf.lengthSq();r.copy(e).sub(sT);const s=Hf.dot(r);s<=0||(i<=s||Hf.multiplyScalar(s/i),r.sub(Hf));const o=r.length(),a=this.inside?this.radius-n-o:o-n-this.radius;return a<0&&(r.multiplyScalar(1/o),this.inside&&r.negate()),a}},oT=new X,Mj=new Xt,GG=class extends sN{get type(){return"plane"}constructor(t){var e,n;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new X(0,0,0),this.normal=(n=t==null?void 0:t.normal)!=null?n:new X(0,0,1)}calculateCollision(t,e,n,r){r.setFromMatrixPosition(t),r.negate().add(e),Mj.getNormalMatrix(t),oT.copy(this.normal).applyNormalMatrix(Mj).normalize();const i=r.dot(oT)-n;return r.copy(oT),i}},Jwe=new X,WG=class extends sN{get type(){return"sphere"}constructor(t){var e,n,r;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new X(0,0,0),this.radius=(n=t==null?void 0:t.radius)!=null?n:0,this.inside=(r=t==null?void 0:t.inside)!=null?r:!1}calculateCollision(t,e,n,r){r.subVectors(e,Jwe.setFromMatrixPosition(t));const i=r.length(),s=this.inside?this.radius-n-i:i-n-this.radius;return s<0&&(r.multiplyScalar(1/i),this.inside&&r.negate()),s}},vl=new X,e1e=class extends Zt{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new X,this._currentTail=new X,this._shape=t,this._attrPos=new Qt(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Qt(new Uint16Array(264),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;const e=this._shape.radius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,t=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),t=!0);const n=vl.copy(this._shape.tail).divideScalar(this.worldScale);this._currentTail.distanceToSquared(n)>1e-10&&(this._currentTail.copy(n),t=!0),t&&this._buildPosition()}_buildPosition(){vl.copy(this._currentTail).sub(this._currentOffset);const t=vl.length()/this._currentRadius;for(let r=0;r<=16;r++){const i=r/16*Math.PI;this._attrPos.setXYZ(r,-Math.sin(i),-Math.cos(i),0),this._attrPos.setXYZ(17+r,t+Math.sin(i),Math.cos(i),0),this._attrPos.setXYZ(34+r,-Math.sin(i),0,-Math.cos(i)),this._attrPos.setXYZ(51+r,t+Math.sin(i),0,Math.cos(i))}for(let r=0;r<32;r++){const i=r/16*Math.PI;this._attrPos.setXYZ(68+r,0,Math.sin(i),Math.cos(i)),this._attrPos.setXYZ(100+r,t,Math.sin(i),Math.cos(i))}const e=Math.atan2(vl.y,Math.sqrt(vl.x*vl.x+vl.z*vl.z)),n=-Math.atan2(vl.z,vl.x);this.rotateZ(e),this.rotateY(n),this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<34;t++){const e=(t+1)%34;this._attrIndex.setXY(t*2,t,e),this._attrIndex.setXY(68+t*2,34+t,34+e)}for(let t=0;t<32;t++){const e=(t+1)%32;this._attrIndex.setXY(136+t*2,68+t,68+e),this._attrIndex.setXY(200+t*2,100+t,100+e)}this._attrIndex.needsUpdate=!0}},t1e=class extends Zt{constructor(t){super(),this.worldScale=1,this._currentOffset=new X,this._currentNormal=new X,this._shape=t,this._attrPos=new Qt(new Float32Array(18),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Qt(new Uint16Array(10),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),t=!0),this._currentNormal.equals(this._shape.normal)||(this._currentNormal.copy(this._shape.normal),t=!0),t&&this._buildPosition()}_buildPosition(){this._attrPos.setXYZ(0,-.5,-.5,0),this._attrPos.setXYZ(1,.5,-.5,0),this._attrPos.setXYZ(2,.5,.5,0),this._attrPos.setXYZ(3,-.5,.5,0),this._attrPos.setXYZ(4,0,0,0),this._attrPos.setXYZ(5,0,0,.25),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this.lookAt(this._currentNormal),this._attrPos.needsUpdate=!0}_buildIndex(){this._attrIndex.setXY(0,0,1),this._attrIndex.setXY(2,1,2),this._attrIndex.setXY(4,2,3),this._attrIndex.setXY(6,3,0),this._attrIndex.setXY(8,4,5),this._attrIndex.needsUpdate=!0}},n1e=class extends Zt{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new X,this._shape=t,this._attrPos=new Qt(new Float32Array(288),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Qt(new Uint16Array(192),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;const e=this._shape.radius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,t=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),t=!0),t&&this._buildPosition()}_buildPosition(){for(let t=0;t<32;t++){const e=t/16*Math.PI;this._attrPos.setXYZ(t,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+t,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+t,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<32;t++){const e=(t+1)%32;this._attrIndex.setXY(t*2,t,e),this._attrIndex.setXY(64+t*2,32+t,32+e),this._attrIndex.setXY(128+t*2,64+t,64+e)}this._attrIndex.needsUpdate=!0}},r1e=new X,aT=class extends Ts{constructor(t){if(super(),this.matrixAutoUpdate=!1,this.collider=t,this.collider.shape instanceof WG)this._geometry=new n1e(this.collider.shape);else if(this.collider.shape instanceof VG)this._geometry=new e1e(this.collider.shape);else if(this.collider.shape instanceof GG)this._geometry=new t1e(this.collider.shape);else throw new Error("VRMSpringBoneColliderHelper: Unknown collider shape type detected");const e=new $r({color:16711935,depthTest:!1,depthWrite:!1});this._line=new Js(this._geometry,e),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(t){this.collider.updateWorldMatrix(!0,!1),this.matrix.copy(this.collider.matrixWorld);const e=this.matrix.elements;this._geometry.worldScale=r1e.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(t)}},i1e=class extends Zt{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentTail=new X,this._springBone=t,this._attrPos=new Qt(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Qt(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;const e=this._springBone.settings.hitRadius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,t=!0),this._currentTail.equals(this._springBone.initialLocalChildPosition)||(this._currentTail.copy(this._springBone.initialLocalChildPosition),t=!0),t&&this._buildPosition()}_buildPosition(){for(let t=0;t<32;t++){const e=t/16*Math.PI;this._attrPos.setXYZ(t,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+t,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+t,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<32;t++){const e=(t+1)%32;this._attrIndex.setXY(t*2,t,e),this._attrIndex.setXY(64+t*2,32+t,32+e),this._attrIndex.setXY(128+t*2,64+t,64+e)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}},s1e=new X,o1e=class extends Ts{constructor(t){super(),this.matrixAutoUpdate=!1,this.springBone=t,this._geometry=new i1e(this.springBone);const e=new $r({color:16776960,depthTest:!1,depthWrite:!1});this._line=new Js(this._geometry,e),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(t){this.springBone.bone.updateWorldMatrix(!0,!1),this.matrix.copy(this.springBone.bone.matrixWorld);const e=this.matrix.elements;this._geometry.worldScale=s1e.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(t)}},lT=class extends mn{constructor(t){super(),this.colliderMatrix=new Ct,this.shape=t}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),a1e(this.colliderMatrix,this.matrixWorld,this.shape.offset)}};function a1e(t,e,n){const r=e.elements;t.copy(e),n&&(t.elements[12]=r[0]*n.x+r[4]*n.y+r[8]*n.z+r[12],t.elements[13]=r[1]*n.x+r[5]*n.y+r[9]*n.z+r[13],t.elements[14]=r[2]*n.x+r[6]*n.y+r[10]*n.z+r[14])}var l1e=new Ct;function c1e(t){return t.invert?t.invert():t.getInverse(l1e.copy(t)),t}var u1e=class{constructor(t){this._inverseCache=new Ct,this._shouldUpdateInverse=!0,this.matrix=t;const e={set:(n,r,i)=>(this._shouldUpdateInverse=!0,n[r]=i,!0)};this._originalElements=t.elements,t.elements=new Proxy(t.elements,e)}get inverse(){return this._shouldUpdateInverse&&(c1e(this._inverseCache.copy(this.matrix)),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}},cT=new Ct,Lm=new X,N0=new X,I0=new X,k0=new X,d1e=new Ct,f1e=class{constructor(t,e,n={},r=[]){this._currentTail=new X,this._prevTail=new X,this._boneAxis=new X,this._worldSpaceBoneLength=0,this._center=null,this._initialLocalMatrix=new Ct,this._initialLocalRotation=new qt,this._initialLocalChildPosition=new X;var i,s,o,a,l,c;this.bone=t,this.bone.matrixAutoUpdate=!1,this.child=e,this.settings={hitRadius:(i=n.hitRadius)!=null?i:0,stiffness:(s=n.stiffness)!=null?s:1,gravityPower:(o=n.gravityPower)!=null?o:0,gravityDir:(l=(a=n.gravityDir)==null?void 0:a.clone())!=null?l:new X(0,-1,0),dragForce:(c=n.dragForce)!=null?c:.4},this.colliderGroups=r}get dependencies(){const t=new Set,e=this.bone.parent;e&&t.add(e);for(let n=0;n<this.colliderGroups.length;n++)for(let r=0;r<this.colliderGroups[n].colliders.length;r++)t.add(this.colliderGroups[n].colliders[r]);return t}get center(){return this._center}set center(t){var e;(e=this._center)!=null&&e.userData.inverseCacheProxy&&(this._center.userData.inverseCacheProxy.revert(),delete this._center.userData.inverseCacheProxy),this._center=t,this._center&&(this._center.userData.inverseCacheProxy||(this._center.userData.inverseCacheProxy=new u1e(this._center.matrixWorld)))}get initialLocalChildPosition(){return this._initialLocalChildPosition}get _parentMatrixWorld(){return this.bone.parent?this.bone.parent.matrixWorld:cT}setInitState(){this._initialLocalMatrix.copy(this.bone.matrix),this._initialLocalRotation.copy(this.bone.quaternion),this.child?this._initialLocalChildPosition.copy(this.child.position):this._initialLocalChildPosition.copy(this.bone.position).normalize().multiplyScalar(.07);const t=this._getMatrixWorldToCenter();this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(t),this._prevTail.copy(this._currentTail),this._boneAxis.copy(this._initialLocalChildPosition).normalize()}reset(){this.bone.quaternion.copy(this._initialLocalRotation),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix);const t=this._getMatrixWorldToCenter();this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(t),this._prevTail.copy(this._currentTail)}update(t){if(t<=0)return;this._calcWorldSpaceBoneLength();const e=N0.copy(this._boneAxis).transformDirection(this._initialLocalMatrix).transformDirection(this._parentMatrixWorld);k0.copy(this._currentTail).add(Lm.subVectors(this._currentTail,this._prevTail).multiplyScalar(1-this.settings.dragForce)).applyMatrix4(this._getMatrixCenterToWorld()).addScaledVector(e,this.settings.stiffness*t).addScaledVector(this.settings.gravityDir,this.settings.gravityPower*t),I0.setFromMatrixPosition(this.bone.matrixWorld),k0.sub(I0).normalize().multiplyScalar(this._worldSpaceBoneLength).add(I0),this._collision(k0),this._prevTail.copy(this._currentTail),this._currentTail.copy(k0).applyMatrix4(this._getMatrixWorldToCenter());const n=d1e.multiplyMatrices(this._parentMatrixWorld,this._initialLocalMatrix).invert();this.bone.quaternion.setFromUnitVectors(this._boneAxis,Lm.copy(k0).applyMatrix4(n).normalize()).premultiply(this._initialLocalRotation),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix)}_collision(t){for(let e=0;e<this.colliderGroups.length;e++)for(let n=0;n<this.colliderGroups[e].colliders.length;n++){const r=this.colliderGroups[e].colliders[n],i=r.shape.calculateCollision(r.colliderMatrix,t,this.settings.hitRadius,Lm);if(i<0){t.addScaledVector(Lm,-i),t.sub(I0);const s=t.length();t.multiplyScalar(this._worldSpaceBoneLength/s).add(I0)}}}_calcWorldSpaceBoneLength(){Lm.setFromMatrixPosition(this.bone.matrixWorld),this.child?N0.setFromMatrixPosition(this.child.matrixWorld):(N0.copy(this._initialLocalChildPosition),N0.applyMatrix4(this.bone.matrixWorld)),this._worldSpaceBoneLength=Lm.sub(N0).length()}_getMatrixCenterToWorld(){return this._center?this._center.matrixWorld:cT}_getMatrixWorldToCenter(){return this._center?this._center.userData.inverseCacheProxy.inverse:cT}};function h1e(t,e){const n=[];let r=t;for(;r!==null;)n.unshift(r),r=r.parent;n.forEach(i=>{e(i)})}function dP(t,e){t.children.forEach(n=>{e(n)||dP(n,e)})}function p1e(t){var e;const n=new Map;for(const r of t){let i=r;do{const s=((e=n.get(i))!=null?e:0)+1;if(s===t.size)return i;n.set(i,s),i=i.parent}while(i!==null)}return null}var Ej=class{constructor(){this._joints=new Set,this._sortedJoints=[],this._hasWarnedCircularDependency=!1,this._ancestors=[],this._objectSpringBonesMap=new Map,this._isSortedJointsDirty=!1,this._relevantChildrenUpdated=this._relevantChildrenUpdated.bind(this)}get joints(){return this._joints}get springBones(){return console.warn("VRMSpringBoneManager: springBones is deprecated. use joints instead."),this._joints}get colliderGroups(){const t=new Set;return this._joints.forEach(e=>{e.colliderGroups.forEach(n=>{t.add(n)})}),Array.from(t)}get colliders(){const t=new Set;return this.colliderGroups.forEach(e=>{e.colliders.forEach(n=>{t.add(n)})}),Array.from(t)}addJoint(t){this._joints.add(t);let e=this._objectSpringBonesMap.get(t.bone);e==null&&(e=new Set,this._objectSpringBonesMap.set(t.bone,e)),e.add(t),this._isSortedJointsDirty=!0}addSpringBone(t){console.warn("VRMSpringBoneManager: addSpringBone() is deprecated. use addJoint() instead."),this.addJoint(t)}deleteJoint(t){this._joints.delete(t),this._objectSpringBonesMap.get(t.bone).delete(t),this._isSortedJointsDirty=!0}deleteSpringBone(t){console.warn("VRMSpringBoneManager: deleteSpringBone() is deprecated. use deleteJoint() instead."),this.deleteJoint(t)}setInitState(){this._sortJoints();for(let t=0;t<this._sortedJoints.length;t++){const e=this._sortedJoints[t];e.bone.updateMatrix(),e.bone.updateWorldMatrix(!1,!1),e.setInitState()}}reset(){this._sortJoints();for(let t=0;t<this._sortedJoints.length;t++){const e=this._sortedJoints[t];e.bone.updateMatrix(),e.bone.updateWorldMatrix(!1,!1),e.reset()}}update(t){this._sortJoints();for(let e=0;e<this._ancestors.length;e++)this._ancestors[e].updateWorldMatrix(e===0,!1);for(let e=0;e<this._sortedJoints.length;e++){const n=this._sortedJoints[e];n.bone.updateMatrix(),n.bone.updateWorldMatrix(!1,!1),n.update(t),dP(n.bone,this._relevantChildrenUpdated)}}_sortJoints(){if(!this._isSortedJointsDirty)return;const t=[],e=new Set,n=new Set,r=new Set;for(const s of this._joints)this._insertJointSort(s,e,n,t,r);this._sortedJoints=t;const i=p1e(r);this._ancestors=[],i&&(this._ancestors.push(i),dP(i,s=>{var o,a;return((a=(o=this._objectSpringBonesMap.get(s))==null?void 0:o.size)!=null?a:0)>0?!0:(this._ancestors.push(s),!1)})),this._isSortedJointsDirty=!1}_insertJointSort(t,e,n,r,i){if(n.has(t))return;if(e.has(t)){this._hasWarnedCircularDependency||(console.warn("VRMSpringBoneManager: Circular dependency detected"),this._hasWarnedCircularDependency=!0);return}e.add(t);const s=t.dependencies;for(const o of s){let a=!1,l=null;h1e(o,c=>{const d=this._objectSpringBonesMap.get(c);if(d)for(const f of d)a=!0,this._insertJointSort(f,e,n,r,i);else a||(l=c)}),l&&i.add(l)}r.push(t),n.add(t)}_relevantChildrenUpdated(t){var e,n;return((n=(e=this._objectSpringBonesMap.get(t))==null?void 0:e.size)!=null?n:0)>0?!0:(t.updateWorldMatrix(!1,!1),!1)}},Aj="VRMC_springBone_extended_collider",m1e=new Set(["1.0","1.0-beta"]),g1e=new Set(["1.0"]),$G=class Hm{get name(){return Hm.EXTENSION_NAME}constructor(e,n){var r;this.parser=e,this.jointHelperRoot=n==null?void 0:n.jointHelperRoot,this.colliderHelperRoot=n==null?void 0:n.colliderHelperRoot,this.useExtendedColliders=(r=n==null?void 0:n.useExtendedColliders)!=null?r:!0}afterRoot(e){return O_(this,null,function*(){e.userData.vrmSpringBoneManager=yield this._import(e)})}_import(e){return O_(this,null,function*(){const n=yield this._v1Import(e);if(n!=null)return n;const r=yield this._v0Import(e);return r??null})}_v1Import(e){return O_(this,null,function*(){var n,r,i,s,o;const a=e.parser.json;if(!(((n=a.extensionsUsed)==null?void 0:n.indexOf(Hm.EXTENSION_NAME))!==-1))return null;const c=new Ej,d=yield e.parser.getDependencies("node"),f=(r=a.extensions)==null?void 0:r[Hm.EXTENSION_NAME];if(!f)return null;const m=f.specVersion;if(!m1e.has(m))return console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${Hm.EXTENSION_NAME} specVersion "${m}"`),null;const y=(i=f.colliders)==null?void 0:i.map((S,_)=>{var w,A,T,C,O,N,D,F,V,k,j,H,ne,te,pe;const oe=d[S.node];if(oe==null)return console.warn(`VRMSpringBoneLoaderPlugin: The collider #${_} attempted to reference a node #${S.node} but not found. Skipping the collider`),null;const ce=S.shape,B=(w=S.extensions)==null?void 0:w[Aj];if(this.useExtendedColliders&&B!=null){const K=B.specVersion;if(!g1e.has(K))console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${Aj} specVersion "${K}". Fallbacking to the ${Hm.EXTENSION_NAME} definition`);else{const q=B.shape;if(q.sphere)return this._importSphereCollider(oe,{offset:new X().fromArray((A=q.sphere.offset)!=null?A:[0,0,0]),radius:(T=q.sphere.radius)!=null?T:0,inside:(C=q.sphere.inside)!=null?C:!1});if(q.capsule)return this._importCapsuleCollider(oe,{offset:new X().fromArray((O=q.capsule.offset)!=null?O:[0,0,0]),radius:(N=q.capsule.radius)!=null?N:0,tail:new X().fromArray((D=q.capsule.tail)!=null?D:[0,0,0]),inside:(F=q.capsule.inside)!=null?F:!1});if(q.plane)return this._importPlaneCollider(oe,{offset:new X().fromArray((V=q.plane.offset)!=null?V:[0,0,0]),normal:new X().fromArray((k=q.plane.normal)!=null?k:[0,0,1])})}}if(ce.sphere)return this._importSphereCollider(oe,{offset:new X().fromArray((j=ce.sphere.offset)!=null?j:[0,0,0]),radius:(H=ce.sphere.radius)!=null?H:0,inside:!1});if(ce.capsule)return this._importCapsuleCollider(oe,{offset:new X().fromArray((ne=ce.capsule.offset)!=null?ne:[0,0,0]),radius:(te=ce.capsule.radius)!=null?te:0,tail:new X().fromArray((pe=ce.capsule.tail)!=null?pe:[0,0,0]),inside:!1});console.warn(`VRMSpringBoneLoaderPlugin: The collider #${_} has no valid shape. Skipping the collider`)}),x=(s=f.colliderGroups)==null?void 0:s.map((S,_)=>{var w;return{colliders:((w=S.colliders)!=null?w:[]).map(T=>{const C=y==null?void 0:y[T];return C??(console.warn(`VRMSpringBoneLoaderPlugin: The collider group #${_} attempted to reference a collider #${T} but not found. Skipping the collider`),null)}).filter(T=>T!=null),name:S.name}});return(o=f.springs)==null||o.forEach((S,_)=>{var w;const A=S.joints,T=(w=S.colliderGroups)==null?void 0:w.map(N=>{const D=x==null?void 0:x[N];return D??(console.warn(`VRMSpringBoneLoaderPlugin: The spring #${_} attempted to reference a collider group #${N} but not found. Skipping the collider group`),null)}).filter(N=>N!=null),C=S.center!=null?d[S.center]:void 0;let O;A.forEach(N=>{if(O){const D=O.node,F=d[D],V=N.node,k=d[V],j={hitRadius:O.hitRadius,dragForce:O.dragForce,gravityPower:O.gravityPower,stiffness:O.stiffness,gravityDir:O.gravityDir!=null?new X().fromArray(O.gravityDir):void 0},H=this._importJoint(F,k,j,T);C&&(H.center=C),c.addJoint(H)}O=N})}),c.setInitState(),c})}_v0Import(e){return O_(this,null,function*(){var n,r,i;const s=e.parser.json;if(!(((n=s.extensionsUsed)==null?void 0:n.indexOf("VRM"))!==-1))return null;const a=(r=s.extensions)==null?void 0:r.VRM,l=a==null?void 0:a.secondaryAnimation;if(!l)return null;const c=l==null?void 0:l.boneGroups;if(!c)return null;const d=new Ej,f=yield e.parser.getDependencies("node"),m=(i=l.colliderGroups)==null?void 0:i.map((y,x)=>{var S;const _=f[y.node];return _==null?(console.warn(`VRMSpringBoneLoaderPlugin: The collider group #${x} attempted to reference a node #${y.node} but not found. Skipping the collider group`),null):{colliders:((S=y.colliders)!=null?S:[]).map((A,T)=>{var C,O,N;const D=new X(0,0,0);return A.offset&&D.set((C=A.offset.x)!=null?C:0,(O=A.offset.y)!=null?O:0,A.offset.z?-A.offset.z:0),this._importSphereCollider(_,{offset:D,radius:(N=A.radius)!=null?N:0,inside:!1})})}});return c==null||c.forEach((y,x)=>{const S=y.bones;S&&S.forEach(_=>{var w,A,T,C;const O=f[_];if(O==null){console.warn(`VRMSpringBoneLoaderPlugin: The spring bone group #${x} attempted to reference a node #${_} but not found. Skipping the node`);return}const N=new X;y.gravityDir?N.set((w=y.gravityDir.x)!=null?w:0,(A=y.gravityDir.y)!=null?A:0,(T=y.gravityDir.z)!=null?T:0):N.set(0,-1,0);const D=y.center!=null?f[y.center]:void 0,F={hitRadius:y.hitRadius,dragForce:y.dragForce,gravityPower:y.gravityPower,stiffness:y.stiffiness,gravityDir:N},V=(C=y.colliderGroups)==null?void 0:C.map(k=>{const j=m==null?void 0:m[k];return j??(console.warn(`VRMSpringBoneLoaderPlugin: The spring #${x} attempted to reference a collider group #${k} but not found. Skipping the collider group`),null)}).filter(k=>k!=null);O.traverse(k=>{var j;const H=(j=k.children[0])!=null?j:null,ne=this._importJoint(k,H,F,V);D&&(ne.center=D),d.addJoint(ne)})})}),e.scene.updateMatrixWorld(),d.setInitState(),d})}_importJoint(e,n,r,i){const s=new f1e(e,n,r,i);if(this.jointHelperRoot){const o=new o1e(s);this.jointHelperRoot.add(o),o.renderOrder=this.jointHelperRoot.renderOrder}return s}_importSphereCollider(e,n){const r=new WG(n),i=new lT(r);if(e.add(i),this.colliderHelperRoot){const s=new aT(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importCapsuleCollider(e,n){const r=new VG(n),i=new lT(r);if(e.add(i),this.colliderHelperRoot){const s=new aT(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importPlaneCollider(e,n){const r=new GG(n),i=new lT(r);if(e.add(i),this.colliderHelperRoot){const s=new aT(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}};$G.EXTENSION_NAME="VRMC_springBone";var v1e=$G,y1e=class{get name(){return"VRMLoaderPlugin"}constructor(t,e){var n,r,i,s,o,a,l,c,d,f;this.parser=t;const m=e==null?void 0:e.helperRoot,y=e==null?void 0:e.autoUpdateHumanBones;this.expressionPlugin=(n=e==null?void 0:e.expressionPlugin)!=null?n:new O_e(t),this.firstPersonPlugin=(r=e==null?void 0:e.firstPersonPlugin)!=null?r:new D_e(t),this.humanoidPlugin=(i=e==null?void 0:e.humanoidPlugin)!=null?i:new V_e(t,{helperRoot:m,autoUpdateHumanBones:y}),this.lookAtPlugin=(s=e==null?void 0:e.lookAtPlugin)!=null?s:new iwe(t,{helperRoot:m}),this.metaPlugin=(o=e==null?void 0:e.metaPlugin)!=null?o:new awe(t),this.mtoonMaterialPlugin=(a=e==null?void 0:e.mtoonMaterialPlugin)!=null?a:new wwe(t),this.materialsHDREmissiveMultiplierPlugin=(l=e==null?void 0:e.materialsHDREmissiveMultiplierPlugin)!=null?l:new Mwe(t),this.materialsV0CompatPlugin=(c=e==null?void 0:e.materialsV0CompatPlugin)!=null?c:new Nwe(t),this.springBonePlugin=(d=e==null?void 0:e.springBonePlugin)!=null?d:new v1e(t,{colliderHelperRoot:m,jointHelperRoot:m}),this.nodeConstraintPlugin=(f=e==null?void 0:e.nodeConstraintPlugin)!=null?f:new Qwe(t,{helperRoot:m})}beforeRoot(){return N_(this,null,function*(){yield this.materialsV0CompatPlugin.beforeRoot(),yield this.mtoonMaterialPlugin.beforeRoot()})}loadMesh(t){return N_(this,null,function*(){return yield this.mtoonMaterialPlugin.loadMesh(t)})}getMaterialType(t){const e=this.mtoonMaterialPlugin.getMaterialType(t);return e??null}extendMaterialParams(t,e){return N_(this,null,function*(){yield this.materialsHDREmissiveMultiplierPlugin.extendMaterialParams(t,e),yield this.mtoonMaterialPlugin.extendMaterialParams(t,e)})}afterRoot(t){return N_(this,null,function*(){yield this.metaPlugin.afterRoot(t),yield this.humanoidPlugin.afterRoot(t),yield this.expressionPlugin.afterRoot(t),yield this.lookAtPlugin.afterRoot(t),yield this.firstPersonPlugin.afterRoot(t),yield this.springBonePlugin.afterRoot(t),yield this.nodeConstraintPlugin.afterRoot(t),yield this.mtoonMaterialPlugin.afterRoot(t);const e=t.userData.vrmMeta,n=t.userData.vrmHumanoid;if(e&&n){const r=new cwe({scene:t.scene,expressionManager:t.userData.vrmExpressionManager,firstPerson:t.userData.vrmFirstPerson,humanoid:n,lookAt:t.userData.vrmLookAt,meta:e,materials:t.userData.vrmMToonMaterials,springBoneManager:t.userData.vrmSpringBoneManager,nodeConstraintManager:t.userData.vrmNodeConstraintManager});t.userData.vrm=r}})}};function x1e(t){const e=new Set;return t.traverse(n=>{if(!n.isMesh)return;const r=n;e.add(r)}),e}function Tj(t,e,n){if(e.size===1){const o=e.values().next().value;if(o.weight===1)return t[o.index]}const r=new Float32Array(t[0].count*3);let i=0;if(n)i=1;else for(const o of e)i+=o.weight;for(const o of e){const a=t[o.index],l=o.weight/i;for(let c=0;c<a.count;c++)r[c*3+0]+=a.getX(c)*l,r[c*3+1]+=a.getY(c)*l,r[c*3+2]+=a.getZ(c)*l}return new Qt(r,3)}function b1e(t){var e;const n=x1e(t.scene),r=new Map,i=(e=t.expressionManager)==null?void 0:e.expressionMap;if(i!=null)for(const[s,o]of Object.entries(i)){const a=new Set;for(const l of o.binds)if(l instanceof D1){if(l.weight!==0)for(const c of l.primitives){let d=r.get(c);d==null&&(d=new Map,r.set(c,d));let f=d.get(s);f==null&&(f=new Set,d.set(s,f)),f.add(l)}a.add(l)}for(const l of a)o.deleteBind(l)}for(const s of n){const o=r.get(s);if(o==null)continue;const a=s.geometry.morphAttributes;s.geometry.morphAttributes={};const l=s.geometry.clone();s.geometry=l;const c=l.morphTargetsRelative,d=a.position!=null,f=a.normal!=null,m={},y={},x=[];if(d||f){d&&(m.position=[]),f&&(m.normal=[]);let S=0;for(const[_,w]of o)d&&(m.position[S]=Tj(a.position,w,c)),f&&(m.normal[S]=Tj(a.normal,w,c)),i==null||i[_].addBind(new D1({index:S,weight:1,primitives:[s]})),y[_]=S,x.push(0),S++}l.morphAttributes=m,s.morphTargetDictionary=y,s.morphTargetInfluences=x}}function j1(t,e,n){if(t.getComponent)return t.getComponent(e,n);{let r=t.array[e*t.itemSize+n];return t.normalized&&(r=gr.denormalize(r,t.array)),r}}function XG(t,e,n,r){t.setComponent?t.setComponent(e,n,r):(t.normalized&&(r=gr.normalize(r,t.array)),t.array[e*t.itemSize+n]=r)}function _1e(t){var e;const n=w1e(t),r=new Set;for(const f of n)r.has(f.geometry)&&(f.geometry=C1e(f.geometry)),r.add(f.geometry);const i=new Map;for(const f of r){const m=f.getAttribute("skinIndex"),y=(e=i.get(m))!=null?e:new Map;i.set(m,y);const x=f.getAttribute("skinWeight"),S=S1e(m,x);y.set(x,S)}const s=new Map;for(const f of n){const m=M1e(f,i);s.set(f,m)}const o=[];for(const[f,m]of s){let y=!1;for(const x of o)if(E1e(m,x.boneInverseMap)){y=!0,x.meshes.add(f);for(const[_,w]of m)x.boneInverseMap.set(_,w);break}y||o.push({boneInverseMap:m,meshes:new Set([f])})}const a=new Map,l=new uT,c=new uT,d=new uT;for(const f of o){const{boneInverseMap:m,meshes:y}=f,x=Array.from(m.keys()),S=Array.from(m.values()),_=new Id(x,S),w=c.getOrCreate(_);for(const A of y){const T=A.geometry.getAttribute("skinIndex"),C=l.getOrCreate(T),O=A.skeleton.bones,N=O.map(V=>d.getOrCreate(V)).join(","),D=`${C};${w};${N}`;let F=a.get(D);F==null&&(F=T.clone(),A1e(F,O,x),a.set(D,F)),A.geometry.setAttribute("skinIndex",F)}for(const A of y)A.bind(_,new Ct)}}function w1e(t){const e=new Set;return t.traverse(n=>{if(!n.isSkinnedMesh)return;const r=n;e.add(r)}),e}function S1e(t,e){const n=new Set;for(let r=0;r<t.count;r++)for(let i=0;i<t.itemSize;i++){const s=j1(t,r,i);j1(e,r,i)!==0&&n.add(s)}return n}function M1e(t,e){const n=new Map,r=t.skeleton,i=t.geometry,s=i.getAttribute("skinIndex"),o=i.getAttribute("skinWeight"),a=e.get(s),l=a==null?void 0:a.get(o);if(!l)throw new Error("Unreachable. attributeUsedIndexSetMap does not know the skin index attribute or the skin weight attribute.");for(const c of l)n.set(r.bones[c],r.boneInverses[c]);return n}function E1e(t,e){for(const[n,r]of t.entries()){const i=e.get(n);if(i!=null&&!T1e(r,i))return!1}return!0}function A1e(t,e,n){const r=new Map;for(const s of e)r.set(s,r.size);const i=new Map;for(const[s,o]of n.entries()){const a=r.get(o);i.set(a,s)}for(let s=0;s<t.count;s++)for(let o=0;o<t.itemSize;o++){const a=j1(t,s,o),l=i.get(a);XG(t,s,o,l)}t.needsUpdate=!0}function T1e(t,e,n){if(n=n||1e-4,t.elements.length!=e.elements.length)return!1;for(let r=0,i=t.elements.length;r<i;r++)if(Math.abs(t.elements[r]-e.elements[r])>n)return!1;return!0}var uT=class{constructor(){this._objectIndexMap=new Map,this._index=0}get(t){return this._objectIndexMap.get(t)}getOrCreate(t){let e=this._objectIndexMap.get(t);return e==null&&(e=this._index,this._objectIndexMap.set(t,e),this._index++),e}};function C1e(t){var e,n,r,i;const s=new Zt;s.name=t.name,s.setIndex(t.index);for(const[o,a]of Object.entries(t.attributes))s.setAttribute(o,a);for(const[o,a]of Object.entries(t.morphAttributes)){const l=o;s.morphAttributes[l]=a.concat()}s.morphTargetsRelative=t.morphTargetsRelative,s.groups=[];for(const o of t.groups)s.addGroup(o.start,o.count,o.materialIndex);return s.boundingSphere=(n=(e=t.boundingSphere)==null?void 0:e.clone())!=null?n:null,s.boundingBox=(i=(r=t.boundingBox)==null?void 0:r.clone())!=null?i:null,s.drawRange.start=t.drawRange.start,s.drawRange.count=t.drawRange.count,s.userData=t.userData,s}function Cj(t){if(Object.values(t).forEach(e=>{e!=null&&e.isTexture&&e.dispose()}),t.isShaderMaterial){const e=t.uniforms;e&&Object.values(e).forEach(n=>{const r=n.value;r!=null&&r.isTexture&&r.dispose()})}t.dispose()}function P1e(t){const e=t.geometry;e&&e.dispose();const n=t.skeleton;n&&n.dispose();const r=t.material;r&&(Array.isArray(r)?r.forEach(i=>Cj(i)):r&&Cj(r))}function R1e(t){t.traverse(P1e)}function N1e(t,e){var n,r;console.warn("VRMUtils.removeUnnecessaryJoints: removeUnnecessaryJoints is deprecated. Use combineSkeletons instead. combineSkeletons contributes more to the performance improvement. This function will be removed in the next major version.");const i=(n=e==null?void 0:e.experimentalSameBoneCounts)!=null?n:!1,s=[];t.traverse(l=>{l.type==="SkinnedMesh"&&s.push(l)});const o=new Map;let a=0;for(const l of s){const d=l.geometry.getAttribute("skinIndex");if(o.has(d))continue;const f=new Map,m=new Map;for(let y=0;y<d.count;y++)for(let x=0;x<d.itemSize;x++){const S=j1(d,y,x);let _=f.get(S);_==null&&(_=f.size,f.set(S,_),m.set(_,S)),XG(d,y,x,_)}d.needsUpdate=!0,o.set(d,m),a=Math.max(a,f.size)}for(const l of s){const d=l.geometry.getAttribute("skinIndex"),f=o.get(d),m=[],y=[],x=i?a:f.size;for(let _=0;_<x;_++){const w=(r=f.get(_))!=null?r:0;m.push(l.skeleton.bones[w]),y.push(l.skeleton.boneInverses[w])}const S=new Id(m,y);l.bind(S,new Ct)}}function I1e(t,e){const n=t.position.count,r=new Array(n);let i=0;const s=e.array;for(let o=0;o<s.length;o++){const a=s[o];r[a]||(r[a]=!0,i++)}return{isVertexUsed:r,vertexCount:n,verticesUsed:i}}function k1e(t){const e=[],n=[];let r=0;for(let i=0;i<t.length;i++)if(t[i]){const s=r++;e[i]=s,n[s]=i}return{originalIndexNewIndexMap:e,newIndexOriginalIndexMap:n}}function O1e(t,e){var n,r,i,s;e.name=t.name,e.morphTargetsRelative=t.morphTargetsRelative,t.groups.forEach(o=>{e.addGroup(o.start,o.count,o.materialIndex)}),e.boundingBox=(r=(n=t.boundingBox)==null?void 0:n.clone())!=null?r:null,e.boundingSphere=(s=(i=t.boundingSphere)==null?void 0:i.clone())!=null?s:null,e.setDrawRange(t.drawRange.start,t.drawRange.count),e.userData=t.userData}function L1e(t,e,n){const r=e.array,i=new r.constructor(r.length);for(let s=0;s<r.length;s++){const o=r[s];i[s]=n[o]}t.setIndex(new Qt(i,e.itemSize,e.normalized))}function F1(t,e,n){const r=t.constructor,i=new r(e.length*n);let s=!0;for(let o=0;o<e.length;o++){const l=e[o]*n,c=o*n;for(let d=0;d<n;d++){const f=t[l+d];i[c+d]=f,s=s&&f===0}}return[i,s]}function D1e(t){var e;const n=new Map,r=[];for(const[i,s]of Object.entries(t))if(s.isInterleavedBufferAttribute){const o=s,a=o.data,l=(e=n.get(a))!=null?e:[];n.set(a,l),l.push([i,o])}else{const o=s;r.push([i,o])}return[n,r]}function U1e(t,e,n){const[r,i]=D1e(e);for(const[s,o]of r){const a=s.array,{stride:l}=s,[c]=F1(a,n,l),d=new tp(c,l);d.setUsage(s.usage);for(const[f,m]of o){const{itemSize:y,offset:x,normalized:S}=m,_=new Ul(d,y,x,S);t.setAttribute(f,_)}}for(const[s,o]of i){const a=o.array,{itemSize:l,normalized:c}=o,[d]=F1(a,n,l);t.setAttribute(s,new Qt(d,l,c))}}function j1e(t){var e;const n=new Map,r=[];for(const[i,s]of Object.entries(t)){const o=i;for(let a=0;a<s.length;a++){const l=s[a];if(l.isInterleavedBufferAttribute){const c=l,d=c.data,f=(e=n.get(d))!=null?e:[];n.set(d,f),f.push([o,a,c])}else{const c=l;r.push([o,a,c])}}}return[n,r]}function F1e(t,e,n){var r,i;let s=!0;const[o,a]=j1e(e),l={};for(const[c,d]of o){const f=c.array,{stride:m}=c,[y,x]=F1(f,n,m);s=s&&x;const S=new tp(y,m);S.setUsage(c.usage);for(const[_,w,A]of d){const{itemSize:T,offset:C,normalized:O}=A,N=new Ul(S,T,C,O);(r=l[_])!=null||(l[_]=[]),l[_][w]=N}}for(const[c,d,f]of a){const m=f,y=m.array,{itemSize:x,normalized:S}=m,[_,w]=F1(y,n,x);s=s&&w,(i=l[c])!=null||(l[c]=[]),l[c][d]=new Qt(_,x,S)}t.morphAttributes=s?{}:l}function z1e(t){const e=new Map;t.traverse(n=>{if(!n.isMesh)return;const r=n,i=r.geometry,s=i.index;if(s==null)return;const o=e.get(i);if(o!=null){r.geometry=o;return}const{isVertexUsed:a,vertexCount:l,verticesUsed:c}=I1e(i.attributes,s);if(c===l)return;const{originalIndexNewIndexMap:d,newIndexOriginalIndexMap:f}=k1e(a),m=new Zt;O1e(i,m),e.set(i,m),L1e(m,s,d),U1e(m,i.attributes,f),F1e(m,i.morphAttributes,f),r.geometry=m}),Array.from(e.keys()).forEach(n=>{n.dispose()})}function B1e(t){var e;((e=t.meta)==null?void 0:e.metaVersion)==="0"&&(t.scene.rotation.y=Math.PI)}var Xc=class{constructor(){}};Xc.combineMorphs=b1e;Xc.combineSkeletons=_1e;Xc.deepDispose=R1e;Xc.removeUnnecessaryJoints=N1e;Xc.removeUnnecessaryVertices=z1e;Xc.rotateVRM0=B1e;/*!
|
||
* @pixiv/three-vrm-core v3.5.4
|
||
* The implementation of core features of VRM, for @pixiv/three-vrm
|
||
*
|
||
* Copyright (c) 2019-2026 pixiv Inc.
|
||
* @pixiv/three-vrm-core is distributed under MIT License
|
||
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
||
*//*!
|
||
* @pixiv/three-vrm-materials-mtoon v3.5.4
|
||
* MToon (toon material) module for @pixiv/three-vrm
|
||
*
|
||
* Copyright (c) 2019-2026 pixiv Inc.
|
||
* @pixiv/three-vrm-materials-mtoon is distributed under MIT License
|
||
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
||
*//*!
|
||
* @pixiv/three-vrm-materials-hdr-emissive-multiplier v3.5.4
|
||
* Support VRMC_hdr_emissiveMultiplier for @pixiv/three-vrm
|
||
*
|
||
* Copyright (c) 2019-2026 pixiv Inc.
|
||
* @pixiv/three-vrm-materials-hdr-emissive-multiplier is distributed under MIT License
|
||
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
||
*//*!
|
||
* @pixiv/three-vrm-materials-v0compat v3.5.4
|
||
* VRM0.0 materials compatibility layer plugin for @pixiv/three-vrm
|
||
*
|
||
* Copyright (c) 2019-2026 pixiv Inc.
|
||
* @pixiv/three-vrm-materials-v0compat is distributed under MIT License
|
||
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
||
*//*!
|
||
* @pixiv/three-vrm-node-constraint v3.5.4
|
||
* Node constraint module for @pixiv/three-vrm
|
||
*
|
||
* Copyright (c) 2019-2026 pixiv Inc.
|
||
* @pixiv/three-vrm-node-constraint is distributed under MIT License
|
||
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
||
*//*!
|
||
* @pixiv/three-vrm-springbone v3.5.4
|
||
* Spring bone module for @pixiv/three-vrm
|
||
*
|
||
* Copyright (c) 2019-2026 pixiv Inc.
|
||
* @pixiv/three-vrm-springbone is distributed under MIT License
|
||
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
||
*/const H1e={leftUpperArm:[0,0,1.2],rightUpperArm:[0,0,-1.2],leftLowerArm:[0,-.2,0],rightLowerArm:[0,.2,0]};function Ia(t,e,n,r,i){var o;const s=(o=t.humanoid)==null?void 0:o.getNormalizedBoneNode(e);s&&s.rotation.set(n,r,i)}function V1e(t){var e;for(const[n,r]of Object.entries(H1e))Ia(t,n,r[0],r[1],r[2]);(e=t.humanoid)==null||e.update()}function G1e(t,e,n,r,i,s){const o=Math.sin(e*1.7),a=Math.sin(e*.45),l=Math.sin(e*.32),c=Math.min(1,n*1.4),d=Math.sin(e*1.3)*c*.06;Ia(t,"hips",0,l*.045,l*.03),Ia(t,"spine",o*.025+s*.07,a*.022,-l*.03),Ia(t,"chest",o*.02+s*.02,a*.018,0),Ia(t,"upperChest",o*.015,0,0),Ia(t,"neck",i*.4+d*.5,r*.4,0),Ia(t,"head",i*.6+d*.5+Math.sin(e*.6)*.015,r*.6+Math.sin(e*.27)*.025,Math.sin(e*.5)*.02);const f=Math.sin(e*.8)*.035;Ia(t,"leftUpperArm",0,0,1.18+f+l*.04),Ia(t,"rightUpperArm",0,0,-1.18-f+l*.04),Ia(t,"leftLowerArm",0,-.18-Math.sin(e*.8)*.03,0),Ia(t,"rightLowerArm",0,.18+Math.sin(e*.8)*.03,0)}const W1e=["happy","angry","sad","surprised","relaxed"],$1e={neutral:null,happy:"happy",angry:"angry",sad:"sad",surprised:"surprised",relaxed:"relaxed"};function X1e({url:t,audioLevel:e,emotion:n,onError:r}){const[i,s]=R.useState(null),o=R.useRef({}),a=R.useRef({t:0,next:3,active:0}),l=R.useRef({yaw:0,pitch:0,tYaw:0,tPitch:0,t:0,next:2.5,lean:0});return R.useEffect(()=>{let c=!1,d=null;const f=new Ybe;return f.register(m=>new y1e(m)),f.load(t,m=>{var x;if(c)return;const y=m.userData.vrm;if(!y){r("Datei enthält kein gültiges VRM-Modell.");return}Xc.removeUnnecessaryVertices(m.scene),((x=y.meta)==null?void 0:x.metaVersion)==="0"&&Xc.rotateVRM0(y),y.scene.rotation.y=Math.PI,V1e(y),d=y,s(y)},void 0,m=>{console.error("VRM-Load-Fehler:",m),r("Avatar konnte nicht geladen werden (CORS/URL?).")}),()=>{c=!0,d&&Xc.deepDispose(d.scene),s(null)}},[t,r]),yG((c,d)=>{var x;if(!i)return;const f=((x=e.current)==null?void 0:x.current)??0;i.lookAt&&(i.lookAt.target=c.camera);const m=l.current;m.t+=d,m.t>m.next&&(m.tYaw=(Math.random()-.5)*.5,m.tPitch=(Math.random()-.5)*.24,m.t=0,m.next=2.5+Math.random()*3.5),m.yaw+=(m.tYaw-m.yaw)*Math.min(1,d*1.5),m.pitch+=(m.tPitch-m.pitch)*Math.min(1,d*1.5),m.lean+=(Math.min(1,f*1.6)-m.lean)*Math.min(1,d*3),G1e(i,c.clock.elapsedTime,f,m.yaw,m.pitch,m.lean);const y=i.expressionManager;if(y){const S=(o.current.aa??0)*.4+f*.6;o.current.aa=S,y.setValue("aa",S);const _=$1e[n.current];for(const T of W1e){const C=_===T?.75:0,O=o.current[T]??0,N=O+(C-O)*Math.min(1,d*4);o.current[T]=N,y.setValue(T,N)}const w=a.current;w.t+=d,w.active<=0&&w.t>w.next&&(w.active=.16,w.t=0,w.next=3+Math.random()*4);let A=0;if(w.active>0){w.active-=d;const T=1-w.active/.16;A=1-Math.abs(T-.5)*2}y.setValue("blink",Math.max(0,A))}i.update(d)}),i?v.jsx("primitive",{object:i.scene}):null}function q1e({url:t,audioLevel:e,emotion:n}){const[r,i]=R.useState(null);return v.jsxs("div",{className:"relative h-full w-full",children:[v.jsxs(zbe,{camera:{position:[0,1.35,1.25],fov:30},gl:{alpha:!0,antialias:!0},style:{background:"transparent"},children:[v.jsx("ambientLight",{intensity:.85}),v.jsx("directionalLight",{position:[1,2,2],intensity:1.1}),v.jsx("directionalLight",{position:[-1,1,-1],intensity:.4}),v.jsx(X1e,{url:t,audioLevel:e,emotion:n,onError:i},t),v.jsx(Kbe,{target:[0,1.3,0],enablePan:!1,minDistance:.7,maxDistance:3,minPolarAngle:Math.PI/3,maxPolarAngle:Math.PI/1.8})]}),r&&v.jsx("div",{className:"absolute inset-x-0 bottom-3 mx-auto w-fit rounded-md bg-red-500/15 border border-red-500/30 px-3 py-1.5 text-xs text-red-300",children:r})]})}const K1e=["elevenlabs","edge"],Y1e={elevenlabs:"ElevenLabs (premium)",edge:"Edge (natürlich · gratis)"};function Z1e(){const[t,e]=R.useState([]),[n,r]=R.useState(localStorage.getItem("mc_voice_engine")||"elevenlabs"),[i,s]=R.useState(localStorage.getItem("mc_voice_voice")||""),[o,a]=R.useState(!1),l=R.useRef(null),c=(x,S)=>{r(x),s(S),localStorage.setItem("mc_voice_engine",x),localStorage.setItem("mc_voice_voice",S)};R.useEffect(()=>{fetch("/api/voice/voices").then(x=>x.ok?x.json():Promise.reject()).then(x=>{const S=x.voices||[];if(e(S),!i){const _=S.find(w=>w.engine===n);_&&c(n,_.id)}}).catch(()=>e([]))},[]);const d=async()=>{var x;if(!o){a(!0);try{const S=await fetch("/api/voice/tts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:"Hallo! So klingt diese Stimme auf Deutsch.",engine:n,voice:i})});if(!S.ok)throw new Error(`TTS ${S.status}`);const _=URL.createObjectURL(await S.blob());(x=l.current)==null||x.pause();const w=new Audio(_);l.current=w,w.onended=()=>URL.revokeObjectURL(_),await w.play()}catch(S){console.error("Probe fehlgeschlagen:",S)}finally{a(!1)}}},f=x=>{const S=t.find(_=>_.engine===x);c(x,(S==null?void 0:S.id)||"")},m=t.filter(x=>x.engine===n),y=n==="elevenlabs"&&m.length===0;return v.jsxs("div",{className:"text-sm",children:[v.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[v.jsx(Vm,{className:"h-3.5 w-3.5"})," Stimme"]}),t.length===0?v.jsx("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-300",children:"Voice-Dienst nicht erreichbar — Stimmen werden geladen, sobald der Sidecar läuft."}):v.jsxs("div",{className:"space-y-2",children:[v.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:K1e.map(x=>v.jsx("button",{onClick:()=>f(x),className:`rounded-md border px-2.5 py-1.5 text-xs transition-colors ${n===x?"border-primary/50 bg-primary/10 text-primary":"border-border/40 hover:bg-accent"}`,children:Y1e[x]},x))}),v.jsx("select",{value:i,onChange:x=>c(n,x.target.value),className:"w-full rounded-md border border-border/40 bg-background/40 px-2.5 py-2 text-xs outline-none focus:border-primary/50",children:m.map(x=>v.jsx("option",{value:x.id,children:x.label},x.id))}),v.jsxs("button",{onClick:d,disabled:o||y,className:"flex w-full items-center justify-center gap-2 rounded-md border border-primary/40 bg-primary/10 px-2.5 py-2 text-xs text-primary hover:bg-primary/20 transition-colors disabled:opacity-60",children:[o?v.jsx(vP,{className:"h-3.5 w-3.5 animate-spin"}):v.jsx(lF,{className:"h-3.5 w-3.5"}),o?"Spielt …":"Probe hören"]}),y&&v.jsxs("p",{className:"text-[11px] text-amber-300",children:["Keine ElevenLabs-Stimmen — Key in ",v.jsx("code",{children:"~/.hermes/.env"})," fehlt, oder keine eigene Stimme angelegt."]}),n==="edge"&&v.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Edge: native deutsche Stimmen, gratis & ohne Key. Cloud (Text → Microsoft)."})]})]})}function Q1e(t){const[e,n]=R.useState(!1),r=R.useRef(null),i=R.useRef([]),s=R.useRef(null),o=R.useCallback(async()=>{if(r.current)return;let l;try{l=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(f){console.error("Mikrofon-Zugriff verweigert:",f);return}s.current=l;const c=MediaRecorder.isTypeSupported("audio/webm;codecs=opus")?"audio/webm;codecs=opus":"audio/webm",d=new MediaRecorder(l,{mimeType:c});i.current=[],d.ondataavailable=f=>{f.data.size&&i.current.push(f.data)},d.onstop=()=>{var m;const f=new Blob(i.current,{type:c});(m=s.current)==null||m.getTracks().forEach(y=>y.stop()),s.current=null,r.current=null,n(!1),f.size>1200&&t(f)},d.start(),r.current=d,n(!0)},[t]),a=R.useCallback(()=>{var l;(l=r.current)==null||l.stop()},[]);return R.useEffect(()=>()=>{var l,c;(l=r.current)==null||l.stop(),(c=s.current)==null||c.getTracks().forEach(d=>d.stop())},[]),{recording:e,start:o,stop:a}}class J1e{constructor(){fo(this,"ctx");fo(this,"analyser");fo(this,"queue",[]);fo(this,"playing",!1);fo(this,"raf",0);fo(this,"freq");fo(this,"level",{current:0});fo(this,"onSpeaking");const e=window.AudioContext||window.webkitAudioContext;this.ctx=new e,this.analyser=this.ctx.createAnalyser(),this.analyser.fftSize=256,this.analyser.smoothingTimeConstant=.6,this.analyser.connect(this.ctx.destination),this.freq=new Uint8Array(new ArrayBuffer(this.analyser.frequencyBinCount))}async enqueue(e){this.queue.push(e),this.playing||await this.playNext()}clear(){this.queue=[]}async playNext(){var i,s;const e=this.queue.shift();if(!e){this.playing=!1,this.stopMeter(),(i=this.onSpeaking)==null||i.call(this,!1);return}if(this.playing=!0,(s=this.onSpeaking)==null||s.call(this,!0),this.ctx.state==="suspended")try{await this.ctx.resume()}catch{}let n;try{n=await this.ctx.decodeAudioData(e.slice(0))}catch{return this.playNext()}const r=this.ctx.createBufferSource();r.buffer=n,r.connect(this.analyser),r.onended=()=>{this.playNext()},r.start(),this.startMeter()}startMeter(){cancelAnimationFrame(this.raf);const e=()=>{this.analyser.getByteFrequencyData(this.freq);const n=Math.min(this.freq.length,48);let r=0;for(let s=2;s<n;s++)r+=this.freq[s];const i=r/(n-2)/255;this.level.current=Math.min(1,i*1.9),this.raf=requestAnimationFrame(e)};e()}stopMeter(){cancelAnimationFrame(this.raf),this.level.current=0}}const eSe=[["happy",/(super|toll|klasse|freu|cool|prima|perfekt|danke|großartig|wunderbar|gerne|haha|:\)|😊|😄|🎉)/i],["surprised",/(wow|wirklich\?|krass|unglaublich|echt\?|tatsächlich|\?!|!\?|oha)/i],["angry",/(fehler|kaputt|mist|verdammt|nervt|schlecht|problem|ärgerlich|leider nicht|geht nicht)/i],["sad",/(leider|schade|traurig|tut mir leid|entschuldigung|sorry|bedauere)/i]];function tSe(t){for(const[e,n]of eSe)if(n.test(t))return e;return"neutral"}const nSe="Du sprichst per Sprache mit dem Nutzer. Antworte natürlich, freundlich und KNAPP in ganzen, gut vorlesbaren Sätzen. Kein Markdown, keine Codeblöcke, keine Aufzählungszeichen, keine Emojis — reiner Fließtext, den man laut vorlesen kann.";function Pj(){let t=localStorage.getItem("mc_voice_session");return t||(t="voice-"+Math.random().toString(36).slice(2)+Date.now().toString(36),localStorage.setItem("mc_voice_session",t)),t}function rSe(){return{engine:localStorage.getItem("mc_voice_engine")||"elevenlabs",voice:localStorage.getItem("mc_voice_voice")||""}}function iSe(t){const e=[],n=/[^.!?…]+[.!?…]+(\s|$)/g;let r=0,i;for(;i=n.exec(t);)e.push(i[0].trim()),r=n.lastIndex;return{sentences:e,rest:t.slice(r)}}function sSe(){const[t,e]=R.useState("idle"),[n,r]=R.useState([]),[i,s]=R.useState(null),o=R.useRef({current:0}),a=R.useRef("neutral"),l=R.useRef(null),c=R.useRef(Pj()),d=R.useCallback(()=>{if(!l.current){const A=new J1e;A.onSpeaking=T=>e(C=>T?"speaking":C==="speaking"?"idle":C),l.current=A,o.current=A.level}return l.current},[]),f=R.useCallback(async A=>{var ne,te,pe,oe;s(null);const T=d();T.clear(),e("transcribing");let C="";try{const ce=new FormData;ce.append("audio",A,"rec.webm");const B=await fetch("/api/voice/stt",{method:"POST",body:ce});if(!B.ok)throw new Error(`STT ${B.status}`);C=((ne=(await B.json()).text)==null?void 0:ne.trim())||""}catch(ce){e("error"),s(`Spracherkennung fehlgeschlagen: ${ce.message}`);return}if(!C){e("idle");return}r(ce=>[...ce,{role:"user",text:C}]),e("thinking");const{engine:O,voice:N}=rSe();let D="",F="";r(ce=>[...ce,{role:"assistant",text:""}]);let V=Promise.resolve(),k=!1,j=!1;const H=ce=>{ce.trim()&&(V=V.then(async()=>{try{const B=await fetch("/api/voice/tts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:ce,engine:O,voice:N})});if(!B.ok)throw new Error(`TTS ${B.status}`);await T.enqueue(await B.arrayBuffer()),k=!0}catch(B){j=!0,console.error("TTS-Fehler:",B)}}))};try{const ce=await fetch("/api/voice/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:C,session_id:c.current,system:nSe})});if(!ce.ok||!ce.body)throw new Error(`Agent ${ce.status}`);const B=ce.body.getReader(),K=new TextDecoder;let q="";for(;;){const{done:$,value:Z}=await B.read();if($)break;q+=K.decode(Z,{stream:!0});const ge=q.split(`
|
||
|
||
`);q=ge.pop()||"";for(const ae of ge){const fe=ae.split(`
|
||
`).find(Xe=>Xe.startsWith("data:"));if(!fe)continue;const _e=fe.slice(5).trim();if(_e==="[DONE]")continue;let Se;try{Se=JSON.parse(_e)}catch{continue}if(Se.error)throw new Error(Se.error);const $e=((oe=(pe=(te=Se.choices)==null?void 0:te[0])==null?void 0:pe.delta)==null?void 0:oe.content)||"";if(!$e)continue;D+=$e,F+=$e,a.current=tSe(D),r(Xe=>{const ue=Xe.slice();return ue[ue.length-1]={role:"assistant",text:D},ue});const{sentences:Me,rest:He}=iSe(F);F=He,Me.forEach(H)}}if(F.trim()&&H(F),await V,!D.trim()){e("idle");return}k||(e("error"),s(j?"Sprachausgabe fehlgeschlagen — Engine/Stimme prüfen.":"Keine Sprachausgabe erzeugt."))}catch(ce){e("error"),s(`Agent-Antwort fehlgeschlagen: ${ce.message}`)}},[d]),{recording:m,start:y,stop:x}=Q1e(f),S=R.useCallback(()=>{d(),e("listening"),y()},[d,y]),_=R.useCallback(()=>{x()},[x]),w=R.useCallback(()=>{var A;(A=l.current)==null||A.clear(),r([]),s(null),e("idle"),localStorage.removeItem("mc_voice_session"),c.current=Pj()},[]);return R.useEffect(()=>{!m&&t==="listening"&&e("transcribing")},[m,t]),{status:t,messages:n,error:i,recording:m,audioLevel:o,emotion:a,pressStart:S,pressEnd:_,reset:w}}const oSe="/avatar.vrm",aSe={idle:"Bereit — halte zum Sprechen",listening:"Höre zu …",transcribing:"Verstehe …",thinking:"Hermes denkt …",speaking:"Hermes spricht …",error:"Fehler"};function lSe(){const{status:t,messages:e,error:n,recording:r,audioLevel:i,emotion:s,pressStart:o,pressEnd:a,reset:l}=sSe(),c=R.useRef(!1);R.useEffect(()=>{const m=S=>S instanceof HTMLElement&&/^(INPUT|TEXTAREA|SELECT)$/.test(S.tagName),y=S=>{S.code!=="Space"||S.repeat||c.current||m(S.target)||(S.preventDefault(),c.current=!0,o())},x=S=>{S.code!=="Space"||!c.current||(S.preventDefault(),c.current=!1,a())};return window.addEventListener("keydown",y),window.addEventListener("keyup",x),()=>{window.removeEventListener("keydown",y),window.removeEventListener("keyup",x)}},[o,a]);const d=t==="speaking",f=t==="transcribing"||t==="thinking";return v.jsxs("div",{className:"flex h-full gap-5",children:[v.jsxs("div",{className:"relative flex min-w-0 flex-1 flex-col rounded-xl border border-border/40 bg-card/30 overflow-hidden",children:[v.jsx("div",{className:"flex-1 min-h-0",children:v.jsx(q1e,{url:oSe,audioLevel:i,emotion:s})}),v.jsxs("div",{className:"shrink-0 flex flex-col items-center gap-3 border-t border-border/40 bg-background/30 py-5 backdrop-blur-sm",children:[v.jsxs("div",{className:nt("flex items-center gap-2 text-sm",t==="error"?"text-red-400":d?"text-primary":"text-muted-foreground"),children:[f&&v.jsx(vP,{className:"h-4 w-4 animate-spin"}),d&&v.jsx(lF,{className:"h-4 w-4 animate-pulse"}),v.jsx("span",{children:n||aSe[t]})]}),v.jsx("button",{onPointerDown:m=>{m.preventDefault(),c.current=!0,o()},onPointerUp:()=>{c.current&&(c.current=!1,a())},onPointerLeave:()=>{c.current&&(c.current=!1,a())},className:nt("flex h-20 w-20 items-center justify-center rounded-full border-2 transition-all select-none touch-none",r?"border-red-500 bg-red-500/20 scale-110 shadow-lg shadow-red-500/30":"border-primary/60 bg-primary/15 hover:bg-primary/25 hover:scale-105"),title:"Gedrückt halten zum Sprechen (oder Leertaste halten)",children:v.jsx(sF,{className:nt("h-8 w-8",r?"text-red-400":"text-primary")})}),v.jsxs("div",{className:"text-[11px] text-muted-foreground",children:["Halten zum Sprechen · ",v.jsx("kbd",{className:"rounded bg-muted px-1 py-0.5 font-mono",children:"Leertaste"})," geht auch"]})]})]}),v.jsxs("div",{className:"flex w-80 shrink-0 flex-col gap-4",children:[v.jsx("div",{className:"rounded-xl border border-border/40 bg-card/40 p-4",children:v.jsx(Z1e,{})}),v.jsxs("div",{className:"flex min-h-0 flex-1 flex-col rounded-xl border border-border/40 bg-card/40",children:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/40 px-4 py-2.5",children:[v.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Gespräch"}),v.jsx("button",{onClick:l,className:"text-muted-foreground hover:text-foreground",title:"Neues Gespräch",children:v.jsx(q8,{className:"h-3.5 w-3.5"})})]}),v.jsxs("div",{className:"flex-1 space-y-2.5 overflow-y-auto p-4 scrollbar-thin",children:[e.length===0&&v.jsx("p",{className:"text-xs text-muted-foreground",children:"Halte den Knopf (oder die Leertaste) und sprich. Hermes hört zu, denkt mit seinem vollen Gedächtnis und seinen Werkzeugen — und antwortet hörbar."}),e.map((m,y)=>v.jsxs("div",{className:nt("text-sm",m.role==="user"?"text-foreground":"text-primary/90"),children:[v.jsx("span",{className:"mr-1.5 text-[10px] font-semibold uppercase text-muted-foreground",children:m.role==="user"?"Du":"Hermes"}),m.text||v.jsx("span",{className:"text-muted-foreground",children:"…"})]},y))]})]})]})]})}const Rj=[{id:"grundlagen",label:"Grundlagen"},{id:"moe",label:"MoE & Quant"},{id:"lokal",label:"Lokal betreiben"},{id:"modelle",label:"Modell-Landschaft"},{id:"gateway",label:"Gateway-Trick"},{id:"mcp",label:"MCP"},{id:"skills",label:"Skills"},{id:"memory",label:"Gedächtnis & RAG"},{id:"agents",label:"Agenten"},{id:"ide",label:"IDE anbinden"},{id:"tricks",label:"Tricks & Kniffe"},{id:"wartung",label:"Sicherheit & Wartung"},{id:"ressourcen",label:"Ressourcen"},{id:"troubleshooting",label:"Troubleshooting"}];function cSe(t){var e;(e=document.getElementById(t))==null||e.scrollIntoView({behavior:"smooth",block:"start"})}function mo({id:t,icon:e,color:n,title:r,kicker:i,children:s,wide:o}){return v.jsxs("section",{id:t,className:nt("scroll-mt-20 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-3",o&&"md:col-span-2"),children:[v.jsxs("div",{className:"flex items-center gap-2.5 border-b border-border/20 pb-3",children:[v.jsx(e,{className:nt("h-5 w-5 shrink-0",n)}),v.jsxs("div",{children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:r}),i&&v.jsx("span",{className:nt("text-[9px] font-mono",n),children:i})]})]}),v.jsx("div",{className:"text-xs text-muted-foreground space-y-2.5 leading-relaxed",children:s})]})}function Vf({children:t}){return v.jsxs("div",{className:"mt-1 rounded-xl border border-primary/25 bg-primary/[0.06] p-3 text-[11px] leading-relaxed",children:[v.jsxs("div",{className:"flex items-center gap-1.5 font-bold text-primary mb-1",children:[v.jsx(Vm,{className:"h-3 w-3"})," Bei dir konkret"]}),v.jsx("div",{className:"text-muted-foreground space-y-1",children:t})]})}function pn({children:t}){return v.jsx("code",{className:"rounded bg-background/40 border border-border/30 px-1.5 py-0.5 font-mono text-[10px] text-foreground",children:t})}function Or({href:t,name:e,note:n}){return v.jsxs("li",{className:"leading-relaxed",children:[v.jsxs("a",{href:t,target:"_blank",rel:"noopener",className:"text-primary hover:underline font-semibold inline-flex items-center gap-0.5",children:[e,v.jsx(v8,{className:"h-3 w-3 opacity-60"})]}),v.jsxs("span",{className:"text-muted-foreground",children:[" — ",n]})]})}function uSe(){const[t,e]=R.useState(!1);return v.jsxs("div",{className:"space-y-7",children:[v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 flex items-start gap-4",children:[v.jsx("div",{className:"h-11 w-11 rounded-xl bg-primary/15 flex items-center justify-center shrink-0",children:v.jsx(AT,{className:"h-6 w-6 text-primary"})}),v.jsxs("div",{className:"space-y-1",children:[v.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Die AI-Bibel"}),v.jsxs("p",{className:"text-sm text-muted-foreground leading-relaxed max-w-2xl",children:["Allgemeines Nachschlagewerk für lokale & agentische AI — Konzepte, Tricks, Kniffe und kuratierte Quellen. ",v.jsx("span",{className:"font-semibold text-foreground",children:"Stand Juni 2026."})," ","Das meiste gilt überall; ",v.jsx("span",{className:"text-primary font-semibold",children:'„Bei dir konkret"'}),"-Kästen zeigen, was dein Stack daraus macht."]})]})]}),v.jsx("div",{className:"sticky top-0 z-10 -mx-1 px-1",children:v.jsx("div",{className:"rounded-xl border border-border/50 bg-card/70 backdrop-blur-xl p-2 shadow-lg shadow-black/20",children:v.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[v.jsx(CT,{className:"h-3.5 w-3.5 text-primary ml-1 mr-0.5 shrink-0"}),(t?Rj:Rj.slice(0,9)).map(n=>v.jsx("button",{onClick:()=>cSe(n.id),className:"rounded-lg px-2.5 py-1 text-[11px] font-semibold text-muted-foreground hover:text-primary hover:bg-primary/10 transition-colors cursor-pointer",children:n.label},n.id)),v.jsx("button",{onClick:()=>e(n=>!n),className:"rounded-lg px-2 py-1 text-[11px] font-semibold text-primary hover:bg-primary/10 transition-colors cursor-pointer",children:t?"weniger":"+ mehr"})]})})}),v.jsxs("div",{className:"grid gap-5 md:grid-cols-2",children:[v.jsxs(mo,{id:"grundlagen",icon:El,color:"text-cyan-400",title:"1. Wie LLMs ticken",kicker:"Grundlagen",children:[v.jsxs("p",{children:["Ein LLM ist im Kern ein ",v.jsx("strong",{children:"Wahrscheinlichkeits-Rechner für das nächste Token"}),' (Wortteil). Es „weiß" nichts — es setzt fort, was statistisch am plausibelsten ist. Daraus folgt fast alles andere.']}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Tokens"})," sind die Einheit — ~¾ Wort. Ein- und Ausgabe werden in Tokens gezählt."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Kontextfenster"}),' = wie viele Tokens das Modell gleichzeitig „sehen" kann (Prompt + Antwort). Voll = Anfang fällt raus.']}),v.jsxs("li",{children:[v.jsx("strong",{children:"Parameter"})," = die trainierten Gewichte. Training ist einmalig, ",v.jsx("strong",{children:"Inferenz"})," ist jede Antwort."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Temperatur / Sampling"})," steuert Zufall: niedrig = deterministisch/präzise (Code), hoch = kreativ."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Halluzination"})," ist kein Bug, sondern die Kehrseite des Ratens. Gegenmittel: Grounding via Tools/RAG, Verifikation."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Reasoning-/Thinking-Modelle"}),' „denken" in unsichtbaren Tokens vor der Antwort — besser bei Logik, langsamer/teurer.']})]})]}),v.jsxs(mo,{id:"moe",icon:V1,color:"text-violet-400",title:"2. MoE & Quantisierung",kicker:"Mehr Modell, weniger Last",children:[v.jsxs("p",{children:[v.jsx("strong",{children:"Mixture of Experts (MoE):"})," Statt für jedes Token das ganze Netz zu aktivieren, wählt ein",v.jsx("em",{children:" Router"})," nur ein paar spezialisierte ",v.jsx("em",{children:"Experts"}),' aus. So läuft ein 100B-Modell mit der aktiven Rechenlast eines viel kleineren (z.B. „122B total / 10B aktiv").']}),v.jsxs("p",{children:[v.jsx("strong",{children:"Quantisierung:"})," Gewichte von FP16 auf weniger Bits eindampfen — kleiner & schneller bei minimalem Qualitätsverlust. Faustregel:"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(pn,{children:"Q8"})," nahezu verlustfrei, größter Footprint"]}),v.jsxs("li",{children:[v.jsx(pn,{children:"Q6_K"})," sehr gut, guter Mittelweg"]}),v.jsxs("li",{children:[v.jsx(pn,{children:"Q4_K_M"})," der Sweet-Spot für lokal — viel Modell pro GB"]})]}),v.jsxs(Vf,{children:["VRAM/RAM ist die harte Grenze — ",v.jsx("strong",{children:"darum"})," ist beides hier zentral: MoE lässt 100B+ überhaupt laufen, Quant entscheidet, was reinpasst. Dein Line-up fährt durchweg ",v.jsx(pn,{children:"Q4_K_M"}),"/",v.jsx(pn,{children:"Q6_K"}),"."]})]}),v.jsxs(mo,{id:"lokal",icon:xP,color:"text-emerald-400",title:"3. Lokal betreiben: Engines & Backends",kicker:"llama.cpp, vLLM & Co.",wide:!0,children:[v.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:[v.jsx("strong",{children:"Inference-Engines"})," — was die Modelle ausführt:"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"llama.cpp / GGUF"})," — der De-facto-Standard für lokal, CPU+GPU, läuft überall."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Ollama / LM Studio"})," — bequeme Wrapper mit One-Click-Downloads (LM Studio mit GUI)."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"vLLM / TGI"})," — Server-Engines für maximalen Durchsatz auf dicken GPUs."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"llama-swap"})," — Proxy, der ",v.jsx("em",{children:"mehrere"})," Modelle hinter ",v.jsx("em",{children:"einem"})," Port hält und je nach Anfrage automatisch ein-/aussattelt."]})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:[v.jsx("strong",{children:"GPU-Backends"})," — wie gerechnet wird:"]}),v.jsx("ul",{className:"list-disc pl-4 space-y-1",children:v.jsxs("li",{children:[v.jsx(pn,{children:"CUDA"})," NVIDIA · ",v.jsx(pn,{children:"ROCm"})," AMD · ",v.jsx(pn,{children:"Vulkan"})," herstellerübergreifend · ",v.jsx(pn,{children:"Metal"})," Apple"]})}),v.jsxs("p",{className:"pt-1",children:[v.jsx("strong",{children:"Begriffe, die immer wiederkommen:"})," Kontext (",v.jsx(pn,{children:"-c"}),"), Slots/Parallel, KV-Cache, Modell-TTL/Swap, ",v.jsx("strong",{children:"Speculative Decoding"})," (kleines Draft-Modell rät voraus → schneller)."]})]})]}),v.jsxs(Vf,{children:["Deine Box hat eine AMD-APU (gfx1151). ",v.jsx("strong",{children:"Einschränkung & Trick:"})," dort schlägt ",v.jsx(pn,{children:"Vulkan/RADV"})," das offizielle ",v.jsx(pn,{children:"ROCm"})," bei Token-Generierung um ~12–22 % — darum läuft die Engine auf Vulkan.",v.jsx(pn,{children:"llama-swap"})," hält die Alltags-Hirne dauerwarm; ",v.jsx(pn,{children:"coder"})," nutzt Spec-Decoding."]})]}),v.jsxs(mo,{id:"modelle",icon:TT,color:"text-sky-400",title:"4. Modell-Landschaft",kicker:"Stand Juni 2026",wide:!0,children:[v.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsx("p",{children:v.jsx("strong",{children:"Open-Weight (lokal nutzbar):"})}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Qwen"})," (Alibaba) — starke Allrounder + Coder + Vision, viele Größen/MoE."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Llama"})," (Meta), ",v.jsx("strong",{children:"Gemma"})," (Google), ",v.jsx("strong",{children:"Phi"})," (Microsoft) — solide Open-Familien."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"DeepSeek"}),", ",v.jsx("strong",{children:"Mistral/Mixtral"})," — kräftige MoE-/Reasoning-Modelle."]})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("p",{children:v.jsx("strong",{children:"Frontier (Cloud-API):"})}),v.jsx("ul",{className:"list-disc pl-4 space-y-1",children:v.jsxs("li",{children:[v.jsx("strong",{children:"Claude"})," (Anthropic), ",v.jsx("strong",{children:"GPT"})," (OpenAI), ",v.jsx("strong",{children:"Gemini"})," (Google) — die stärksten Allrounder, aber nicht lokal."]})}),v.jsxs("p",{className:"pt-1",children:[v.jsx("strong",{children:"Modellwahl nach Aufgabe:"})," schnelles Alltags-Hirn · großes Logik-Hirn für harte Tasks · dediziertes Code-Modell · multimodal für Bilder · Embedding-Modell fürs Gedächtnis."]})]})]}),v.jsx("p",{className:"text-[11px] italic",children:'Leaderboards (HF, LMArena) sind grobe Orientierung — der einzige Benchmark, der zählt, ist deine eigene Aufgabe. Vorsicht vor „Benchmaxxing".'}),v.jsxs(Vf,{children:["Dein Line-up via llama-swap: ",v.jsx(pn,{children:"fast"})," (Alltag/Vision/MoE) · ",v.jsx(pn,{children:"heavy"})," (schwere Logik) ·",v.jsx(pn,{children:"coder"})," · ",v.jsx(pn,{children:"scout"})," · ",v.jsx(pn,{children:"vision"})," · ",v.jsx(pn,{children:"embed"})," (fürs Gedächtnis) ·",v.jsx(pn,{children:"hermes"})," (Agent-Hirn). Verwalten/tauschen im ",v.jsx("strong",{children:"Modell-Manager"}),"-Tab."]})]}),v.jsxs(mo,{id:"gateway",icon:G8,color:"text-amber-400",title:"5. Der Gateway-Trick",kicker:"OpenAI-kompatibel = überall andocken",children:[v.jsxs("p",{children:["Fast jedes AI-Tool spricht heute das ",v.jsx("strong",{children:"OpenAI-Format"})," (",v.jsx(pn,{children:"/v1/chat/completions"}),"). Ein",v.jsx("strong",{children:" Gateway"})," davor gibt dir ",v.jsx("em",{children:"einen"})," Endpunkt für alles: zentrales Key-Management, Logging und transparentes ",v.jsx("strong",{children:"Routing"})," — der Client merkt nicht, welches Modell tatsächlich antwortet."]}),v.jsxs("p",{children:["Die ",v.jsx(pn,{children:"model:auto"}),'-Idee: du sagst „auto", das Gateway wählt das passende Modell je nach Anfrage und lädt es bei Bedarf.']}),v.jsxs(Vf,{children:["Dein Gateway: ",v.jsx(pn,{children:"http://192.168.178.151:9001/v1"}),", Model ",v.jsx(pn,{children:"auto"}),", API-Key beliebig. Fertige Configs erzeugt dir der ",v.jsx("strong",{children:"Verbinden"}),"-Tab live — eine Wahrheit, kein Abtippen."]})]}),v.jsxs(mo,{id:"mcp",icon:RT,color:"text-violet-400",title:"6. MCP — Werkzeuge für Agenten",kicker:"USB-C für AI-Tools",children:[v.jsxs("p",{children:["Das ",v.jsx("strong",{children:"Model Context Protocol"})," (offen, von Anthropic initiiert) standardisiert, wie ein AI-Client mit externen Tools & Datenquellen spricht. Ein ",v.jsx("strong",{children:"MCP-Server"})," bringt Fähigkeiten: Dateien, Web-Fetch, Git, Datenbanken, eigene APIs."]}),v.jsx("p",{children:"Statt für jeden Editor eigene Tools zu schreiben, bindet jeder MCP-fähige Agent denselben Server an."}),v.jsxs("div",{className:"flex items-start gap-1.5 rounded-xl border border-amber-500/25 bg-amber-500/[0.06] p-2.5 text-[11px]",children:[v.jsx(z8,{className:"h-3.5 w-3.5 text-amber-400 shrink-0 mt-0.5"}),v.jsxs("span",{children:[v.jsx("strong",{children:"Sicherheit:"})," ein MCP-Server hat echten Zugriff (Dateien, Shell). Nur vertrauenswürdige Server laufen lassen, Rechte minimal halten, Quelle prüfen."]})]})]}),v.jsxs(mo,{id:"skills",icon:X8,color:"text-emerald-400",title:"7. Agent Skills",kicker:"Wiederverwendbare Fähigkeiten",children:[v.jsxs("p",{children:["Ein ",v.jsx("strong",{children:"Skill"})," ist ein Ordner mit einer ",v.jsx(pn,{children:"SKILL.md"})," (YAML-Kopf + Anleitung, optional Skripte/Beispiele), den der Agent für eine bestimmte Aufgabe lädt — z.B. TDD, Code-Vereinfachung, API-Design."]}),v.jsx("pre",{className:"p-2.5 bg-background/25 rounded-lg border border-border/30 font-mono text-[9px] text-foreground overflow-x-auto whitespace-pre",children:`---
|
||
name: tdd-pro
|
||
description: Treibt Entwicklung mit strikter TDD-Praxis
|
||
---
|
||
# Instructions
|
||
...`}),v.jsxs("p",{children:["Suchen & installieren über die ",v.jsx("strong",{children:"skills.sh"}),"-Registry: ",v.jsx(pn,{children:"npx skills find"})," /",v.jsx(pn,{children:"npx skills add owner/repo"}),". Skills liegen projektweit (vom Agent beim Start gelesen) oder global."]})]}),v.jsxs(mo,{id:"memory",icon:P8,color:"text-indigo-400",title:"8. Gedächtnis & RAG",kicker:"Modelle vergessen — du nicht",wide:!0,children:[v.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:["LLMs sind ",v.jsx("strong",{children:"zustandslos"}),": ohne Hilfe weiß das Modell beim nächsten Turn nichts mehr. Gedächtnis lebt extern."]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Embeddings"})," wandeln Text in Vektoren; ein ",v.jsx("strong",{children:"Vektor-Store"})," (Chroma, …) findet semantisch Ähnliches."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"RAG"})," = relevante Fakten vor dem Turn heraussuchen und einblenden statt alles im Prompt zu halten."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Long-Context vs. RAG:"}),' riesige Fenster sind bequem, aber teuer & „lost in the middle" — gezieltes Abrufen skaliert besser.']})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:[v.jsx("strong",{children:"Auto-lernendes Gedächtnis"})," ist die nächste Stufe:"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:["extrahiert Fakten ",v.jsx("em",{children:"selbst"})," aus Gesprächen, statt nur abzuspeichern"]}),v.jsx("li",{children:"dedupliziert semantisch (kein 10× derselbe Fakt)"}),v.jsxs("li",{children:[v.jsx("strong",{children:"Graph-Sicht"})," = Fakten ",v.jsx("em",{children:"plus"})," ihre Beziehungen, nicht nur eine flache Liste"]})]})]})]}),v.jsxs(Vf,{children:["Dein Gedächtnis (Tab ",v.jsx("strong",{children:"Gedächtnis"}),") ist ",v.jsx("strong",{children:"Mem0"}),"-basiert: auto-lernend & semantisch, ",v.jsx("strong",{children:"graph-first"})," dargestellt, mit 4-Typen-Taxonomie (",v.jsx(pn,{children:"Identität"})," · ",v.jsx(pn,{children:"Wissen"})," · ",v.jsx(pn,{children:"Regeln"})," · ",v.jsx(pn,{children:"Ereignisse"}),"). Einstieg über ein kurzes ",v.jsx("strong",{children:"Hermes-Onboarding-Gespräch"})," im Terminal — der Agent lernt im Hintergrund nach jedem Turn.",v.jsx("br",{}),v.jsx("strong",{children:"Gotcha:"})," ein gelöschter Fakt kann wieder auftauchen, solange die Original-Nachricht noch im Verlauf steht (additive Extraktion)."]})]}),v.jsxs(mo,{id:"agents",icon:qc,color:"text-rose-400",title:"9. Autonome Agenten betreiben",kicker:"LLM in der Schleife",wide:!0,children:[v.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:["Ein ",v.jsx("strong",{children:"Agent"})," ist ein LLM in einer Schleife mit Tools:",v.jsx("em",{children:" denken → Tool aufrufen → Ergebnis beobachten → weiter"}),", bis das Ziel erreicht ist."]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Guardrails"})," (Hard-Stop, Tool-Limits) verhindern Endlos-Loops, wenn ein Tool fehlt oder hängt."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Kontext-Hygiene"})," ist die wichtigste Disziplin: frische Sessions starten — vollgemüllte Historien werden langsam, driften und halluzinieren."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Kanäle:"})," CLI/Terminal, Chat-UI, Messaging (z.B. Telegram), reine API."]})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:[v.jsx("strong",{children:"Least Privilege:"})," gib einem Agenten nur die Tools, die er wirklich braucht. Kritische Aktionen (Shell auf dem Host, Löschen, Geld/Deploys) hinter menschliche Freigabe."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Was sich vollautomatisch lohnt:"})," Modell-Routing, Hintergrund-Gedächtnis, Recherche. ",v.jsx("strong",{children:"Was Freigabe braucht:"})," Systembefehle, Updates/Reboots, permanentes Löschen."]})]})]}),v.jsxs(Vf,{children:[v.jsx("strong",{children:"Hermes"})," ist dein Box-Agent (Hirn = ",v.jsx(pn,{children:"fast"}),"). Reden tust du mit ihm im",v.jsx("strong",{children:" Terminal"}),"-Tab (Web-Terminal via ttyd) oder per ",v.jsx("strong",{children:"Telegram"}),". Er hat MCP-Server für Gedächtnis, Stack-Steuerung, Web-Fetch und ",v.jsx("strong",{children:"PC-Steuerung"})," (Executor auf deinem Windows-PC). Status & Verdrahtung im ",v.jsx("strong",{children:"Hermes"}),"-Tab."]})]}),v.jsxs(mo,{id:"ide",icon:iF,color:"text-cyan-400",title:"10. IDE / Editor anbinden",kicker:"Vibe-Coding lokal",children:[v.jsxs("p",{children:["Jede ",v.jsx("strong",{children:"OpenAI-kompatible"})," IDE oder Extension lässt sich auf einen lokalen Server umbiegen — Base-URL + Model eintragen, fertig:"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Cline"})," & ",v.jsx("strong",{children:"Roo Code"})," (VS-Code-Extensions, voller Agent + MCP)"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Cursor"})," (VS-Code-Fork mit Top-Autocomplete)"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Continue"}),", ",v.jsx("strong",{children:"aider"})," (CLI), ",v.jsx("strong",{children:"OpenCode"})," (Desktop)"]})]}),v.jsxs(Vf,{children:["Tipp den Kram nicht ab: der ",v.jsx("strong",{children:"Verbinden"}),"-Tab generiert die fertige Config (inkl. MCP-Gedächtnis) pro Tool zum Kopieren. Essenz: Base ",v.jsx(pn,{children:"…:9001/v1"}),", Model ",v.jsx(pn,{children:"auto"}),", Key beliebig."]})]}),v.jsx(mo,{id:"tricks",icon:j8,color:"text-amber-400",title:"11. Tricks & Kniffe",kicker:"Was im Alltag wirklich spart",wide:!0,children:v.jsx("div",{className:"grid md:grid-cols-3 gap-3",children:[["Kontext sauber halten","Neue Session statt Mega-Historie. Drift, Tempo und Halluzination hängen direkt am Kontext-Müll."],["Plan-then-Act","Erst Plan/Vorgehen bestätigen lassen, dann ausführen. Spart teure Holzwege."],["Gezielte Edits","Nie ganze Dateien überschreiben für eine Zeile — Such-/Ersetz-Tools nutzen. Weniger Tokens, weniger Fehler."],["Non-interaktive Befehle","Keine interaktiven Prompts im Agent-Terminal; lange Tasks als Background-Job. Sonst hängt der Loop."],["DevTools koppeln","Browser-/Konsolen-Zugriff geben — der Agent liest echte Fehler statt blind zu raten."],["Richtige Modellwahl","Schnelles Hirn für Alltag, großes für harte Logik, Coder fürs Coden. Nicht alles mit der Kanone."],["Akzeptanzkriterien","Sag konkret, woran „fertig“ erkennbar ist. Vage Prompts → vage Ergebnisse."],["Verifizieren statt vertrauen","Tests/Live-Check fordern. „Sollte funktionieren“ ist kein Beweis."],["Regeln ins Gedächtnis","Wiederkehrende Vorlieben/Konventionen einmal ablegen — der Agent zieht sie selbst."]].map(([n,r])=>v.jsxs("div",{className:"space-y-1 p-3 bg-background/10 rounded-xl border border-border/30",children:[v.jsxs("div",{className:"flex items-center gap-1.5 font-bold text-foreground text-[11px]",children:[v.jsx(xh,{className:"h-3 w-3 text-amber-400"})," ",n]}),v.jsx("p",{className:"text-[11px]",children:r})]},n))})}),v.jsx(mo,{id:"wartung",icon:sy,color:"text-emerald-400",title:"12. Sicherheit & Wartung",kicker:"Damit's auch morgen noch läuft",wide:!0,children:v.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{className:"flex items-center gap-1.5 font-bold text-foreground",children:[v.jsx(I8,{className:"h-3.5 w-3.5 text-emerald-400"})," Goldene Regeln"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Ein ungetesteter Restore ist kein Backup."})," Wiederherstellung mindestens einmal echt durchspielen."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Updates können Dinge still zerschießen"})," — gerade bei AI-Stacks (Embeddings, Provider-Interna). Versionen pinnen, Smoke-Test, Post-Check."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Least Privilege"})," für Agenten, MCP-Server und PC-Zugriff. Kritisches hinter Freigabe."]})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{className:"flex items-center gap-1.5 font-bold text-foreground",children:[v.jsx(ew,{className:"h-3.5 w-3.5 text-emerald-400"})," Bei dir im SystemDrawer"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Backup:"})," tägliches Voll-Zustands-Backup, getesteter ",v.jsx(pn,{children:"restore.sh"})," (Doku in ",v.jsx(pn,{children:"docs/BACKUP.md"}),")."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Updates:"})," git-basierter Update-Check; ",v.jsx("strong",{children:"Hermes-Update-Button"})," mit anschließendem ",v.jsx("strong",{children:"Gehirn-Check"})," (rot, falls das Update das Gedächtnis zerschießt) + Engine-Update."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Dienste & Gefahrenzone:"})," Restart/Logs pro Dienst, kritische Eingriffe getrennt."]})]}),v.jsx("p",{className:"text-[10px] italic",children:'Erreichbar über das System-Icon → Tab „Wartung".'})]})]})}),v.jsxs("section",{id:"ressourcen",className:"scroll-mt-20 md:col-span-2 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-4",children:[v.jsxs("div",{className:"flex items-center gap-2.5 border-b border-border/20 pb-3",children:[v.jsx(CT,{className:"h-5 w-5 text-primary"}),v.jsxs("div",{children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"13. Kuratierte Ressourcen & Links"}),v.jsx("span",{className:"text-[9px] font-mono text-primary",children:"Sauber geordnet — die guten Quellen"})]})]}),v.jsxs("div",{className:"grid md:grid-cols-2 gap-5 text-xs",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[v.jsx(TT,{className:"h-3.5 w-3.5 text-sky-400"})," Modelle & Engines"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[v.jsx(Or,{href:"https://huggingface.co/models",name:"Hugging Face",note:"das Repository für offene Modelle (GGUF, Embeddings, Datasets)."}),v.jsx(Or,{href:"https://github.com/ggml-org/llama.cpp",name:"llama.cpp",note:"die Referenz-Engine für lokale Inferenz."}),v.jsx(Or,{href:"https://github.com/mostlygeek/llama-swap",name:"llama-swap",note:"mehrere Modelle hinter einem Port, Auto-Swap."}),v.jsx(Or,{href:"https://ollama.com",name:"Ollama",note:"einfachster Einstieg, One-Command-Modelle."}),v.jsx(Or,{href:"https://lmstudio.ai",name:"LM Studio",note:"lokale GUI zum Stöbern, Laden & Chatten."}),v.jsx(Or,{href:"https://github.com/vllm-project/vllm",name:"vLLM",note:"Hochdurchsatz-Serving auf dicken GPUs."})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[v.jsx(RT,{className:"h-3.5 w-3.5 text-violet-400"})," MCP & Skills"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[v.jsx(Or,{href:"https://modelcontextprotocol.io",name:"MCP — offizielle Doku",note:"Spezifikation & Einstieg."}),v.jsx(Or,{href:"https://github.com/modelcontextprotocol/servers",name:"Offizielle MCP-Server",note:"filesystem, git, postgres, fetch & mehr."}),v.jsx(Or,{href:"https://smithery.ai",name:"Smithery",note:"Registry zum Suchen & Auto-Installieren von MCP-Servern."}),v.jsx(Or,{href:"https://glama.ai/mcp/servers",name:"Glama MCP Registry",note:"kuratierte Community-Datenbank."}),v.jsx(Or,{href:"https://skills.sh",name:"skills.sh",note:"Registry & CLI für Agent-Skills."})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[v.jsx(qc,{className:"h-3.5 w-3.5 text-rose-400"})," Agenten & Frameworks"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[v.jsx(Or,{href:"https://github.com/NousResearch/hermes-agent",name:"Hermes Agent (Nous)",note:"der Agent, der auf deiner Box läuft."}),v.jsx(Or,{href:"https://docs.claude.com",name:"Anthropic / Claude Docs",note:"API, Tool-Use, Agent SDK, MCP."}),v.jsx(Or,{href:"https://github.com/cline/cline",name:"Cline",note:"autonomer Coding-Agent für VS Code."}),v.jsx(Or,{href:"https://aider.chat",name:"aider",note:"AI-Pair-Programming im Terminal, git-nativ."}),v.jsx(Or,{href:"https://continue.dev",name:"Continue",note:"Open-Source-Autopilot für IDEs."})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[v.jsx(AT,{className:"h-3.5 w-3.5 text-amber-400"})," Lernen & Community"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[v.jsx(Or,{href:"https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/overview",name:"Prompt-Engineering (Anthropic)",note:"die beste praktische Anleitung."}),v.jsx(Or,{href:"https://github.com/anthropics/anthropic-cookbook",name:"Anthropic Cookbook",note:"lauffähige Rezepte für Tools, RAG, Agenten."}),v.jsx(Or,{href:"https://www.promptingguide.ai",name:"Prompt Engineering Guide",note:"herstellerneutrales Nachschlagewerk."}),v.jsx(Or,{href:"https://github.com/mem0ai/mem0",name:"Mem0",note:"die auto-lernende Memory-Schicht hinter deinem Gedächtnis."}),v.jsx(Or,{href:"https://www.reddit.com/r/LocalLLaMA/",name:"r/LocalLLaMA",note:"der Puls der lokalen-LLM-Szene."})]})]})]})]}),v.jsx(mo,{id:"troubleshooting",icon:U8,color:"text-rose-400",title:"14. Troubleshooting",kicker:"Wenn's hakt",wide:!0,children:v.jsxs("ul",{className:"space-y-2 list-disc pl-4",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Keine Verbindung?"})," Selbes LAN wie die Box? IP/Port stimmen (",v.jsx(pn,{children:":9001"}),")? Backend-Status in der ",v.jsx("strong",{children:"Zentrale"})," prüfen."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Modell antwortet nicht / langsam?"})," In der ",v.jsx("strong",{children:"Zentrale → Dienste"})," schauen, ob ",v.jsx(pn,{children:"llama-swap"})," grün ist; sonst Restart. Erstes Token nach Swap dauert (Modell lädt)."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Agent dreht durch / halluziniert?"})," Frische Session im ",v.jsx("strong",{children:"Terminal"})," starten — meist ist es vollgemüllter Kontext."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Gedächtnis findet nichts?"})," Embedding-Dienst online? Semantisch suchen (Sinn statt exaktem Wort). Leeres Gedächtnis → Hermes-Onboarding starten."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Update hat etwas zerschossen?"})," Genau dafür gibt es Backup & ",v.jsx(pn,{children:"restore.sh"})," — den getesteten Restore fahren, dann Ursache suchen."]})]})})]}),v.jsx("p",{className:"text-center text-[10px] text-muted-foreground/50 pt-2",children:"Mission Control 2 · AI-Bibel · Stand Juni 2026 — lebendes Dokument, wächst mit dem Stack."})]})}function dSe({title:t,hint:e}){return v.jsxs("div",{className:"space-y-4",children:[v.jsxs("div",{children:[v.jsx("h1",{className:"text-xl font-semibold",children:t}),v.jsx("p",{className:"text-sm text-muted-foreground",children:e})]}),v.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 rounded-xl border border-dashed border-border bg-card/50 py-20 text-center",children:[v.jsx(C8,{className:"h-8 w-8 text-muted-foreground"}),v.jsx("div",{className:"text-sm text-muted-foreground",children:"Kommt in einer späteren Phase."})]})]})}const Nj=[{id:"mission-control-2",label:"Mission Control",type:"user",reach:"gateway (integr"},{id:"hermes-gateway",label:"Hermes Gateway",type:"user",reach:"hermes-gateway"},{id:"mem0-service",label:"Mem0 (Gedächtnis)",type:"user",reach:"mem0"},{id:"hermes-terminal",label:"Hermes Terminal",type:"user",reach:"hermes-terminal"},{id:"llama-swap",label:"Llama Swap",type:"system",reach:"llama-swap"}];function L_({icon:t,iconClass:e,name:n,status:r,available:i,busy:s,actionLabel:o,onAction:a}){return v.jsxs("div",{className:nt("flex items-center gap-3 rounded-lg border px-3 py-2",i?"border-amber-500/30 bg-amber-500/5":"border-border/50 bg-background/20"),children:[v.jsx(t,{className:nt("h-4 w-4 shrink-0",e)}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsx("div",{className:"text-xs text-foreground truncate",children:n}),v.jsx("div",{className:nt("text-[10px] truncate",i?"text-amber-400/90":"text-muted-foreground"),children:r})]}),v.jsx("button",{onClick:a,disabled:!i||s,className:nt("text-[11px] font-semibold rounded-lg px-2.5 py-1 transition-colors shrink-0",i?"bg-primary text-primary-foreground hover:opacity-90 cursor-pointer":"border border-border/50 text-muted-foreground/40 cursor-default"),children:s?"…":o})]})}function fSe({label:t,ok:e,system:n,busy:r,onRestart:i,onLogs:s}){return v.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-border/50 bg-background/20 px-3 py-2",children:[v.jsx("span",{className:nt("w-1.5 h-1.5 rounded-full shrink-0",e===!0?"bg-emerald-500":e===!1?"bg-red-500":"bg-muted-foreground/40")}),v.jsxs("span",{className:"flex-1 text-xs text-foreground truncate",children:[t,n&&v.jsx("span",{className:"text-[9px] text-muted-foreground",children:" (root)"})]}),v.jsx("button",{onClick:i,disabled:r,title:"Neu starten",className:"text-muted-foreground hover:text-primary transition-colors disabled:opacity-50",children:v.jsx(B0,{className:nt("h-3.5 w-3.5",r&&"animate-spin")})}),v.jsx("button",{onClick:s,title:"Logs ansehen",className:"text-muted-foreground hover:text-primary transition-colors",children:v.jsx(R8,{className:"h-3.5 w-3.5"})})]})}function dT(t){return t==null?"":t>1024**3?`${(t/1024**3).toFixed(2)} GB`:`${(t/1024**2).toFixed(1)} MB`}function hSe({open:t,onClose:e,defaultTab:n="maintenance"}){var Be;const[r,i]=R.useState(null),[s,o]=R.useState([]),[a,l]=R.useState("llama-swap"),[c,d]=R.useState(""),[f,m]=R.useState(!1),[y,x]=R.useState(null),[S,_]=R.useState({}),[w,A]=R.useState("maintenance"),[T,C]=R.useState(!1),[O,N]=R.useState(""),[D,F]=R.useState(!1),[V,k]=R.useState(null),[j,H]=R.useState([]),[ne,te]=R.useState(!1),[pe,oe]=R.useState(null);function ce(le,Ce,lt){oe({type:"alert",title:le,message:Ce,onConfirm:()=>{oe(null),lt&<()}})}function B(le,Ce,lt){oe({type:"confirm",title:le,message:Ce,onConfirm:()=>{oe(null),lt()},onCancel:()=>oe(null)})}function K(le){return le?new Date(le*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"Nie"}const[q,$]=R.useState(""),[Z,ge]=R.useState(""),[ae,fe]=R.useState(!1),[_e,Se]=R.useState(!1);R.useEffect(()=>{t&&($(localStorage.getItem("mc_sudo_password")||""),ge(localStorage.getItem("mc_hf_token")||""))},[t]),R.useEffect(()=>{t&&n&&A(n)},[t,n]);const $e=R.useRef(null);function Me(){jt("/api/maintenance/updates").then(i).catch(le=>console.error("Error loading updates",le))}function He(){jt("/api/jobs").then(le=>o(le.jobs||[])).catch(le=>console.error("Error loading jobs",le))}function Xe(){jt("/api/system/services").then(k).catch(()=>{})}function ue(){jt("/api/system/backups").then(le=>H(le.backups||[])).catch(()=>{})}function Q(le){m(!0),x(null),jt(`/api/maintenance/logs?service=${le}&lines=150`).then(Ce=>{Ce.ok?d(Ce.text):(d(`Fehler beim Laden der Logs: ${Ce.err||"Unbekannter Fehler"}`),(Ce.status==="incorrect_password"||Ce.status==="password_required")&&x(Ce.status))}).catch(Ce=>d(`Fehler: ${Ce.message}`)).finally(()=>{m(!1),setTimeout(()=>{$e.current&&($e.current.scrollTop=$e.current.scrollHeight)},50)})}R.useEffect(()=>{if(!t)return;Me(),He(),Xe(),ue();const le=setInterval(()=>{He(),Me(),Xe()},3e3);return()=>clearInterval(le)},[t]),R.useEffect(()=>{!t||w!=="logs"||Q(a)},[t,w,a]);async function Ge(){try{await jt("/api/maintenance/os-update",{method:"POST"}),He(),A("maintenance")}catch(le){ce("Fehler",`Fehler beim Starten des OS-Updates: ${le.message}`)}}async function Ue(){try{await jt("/api/maintenance/engine-update",{method:"POST"}),He(),A("maintenance")}catch(le){ce("Fehler",`Fehler beim Engine-Update: ${le.message}`)}}function We(){B("Hermes-Agent aktualisieren","Zieht die neuesten Änderungen aus git, installiert Abhängigkeiten neu und startet den Hermes-Gateway neu (vorher automatisches Backup). Fortschritt unter Hintergrund-Aufgaben.",async()=>{te(!0);try{await jt("/api/maintenance/hermes-update",{method:"POST"}),He()}catch(le){ce("Fehler",`Hermes-Update fehlgeschlagen: ${le.message}`)}finally{te(!1)}})}async function Qe(){C(!0);try{await jt("/api/maintenance/check-updates",{method:"POST"}),He(),A("maintenance")}catch(le){ce("Fehler",`Fehler bei der Update-Suche: ${le.message}`)}finally{C(!1)}}async function xt(le,Ce){try{await jt("/api/models/install",{method:"POST",body:JSON.stringify({repo:le,role:Ce})}),ce("Gestartet",`Modell-Upgrade für '${Ce}' (${le}) gestartet.`),He(),A("maintenance")}catch(lt){ce("Fehler",`Fehler beim Starten des Modell-Upgrades: ${lt.message}`)}}async function at(){B("Reboot bestätigen","Bist du sicher, dass du das gesamte Host-System neu starten willst?",async()=>{try{await jt("/api/maintenance/reboot",{method:"POST"}),ce("Reboot","Reboot ausgelöst. System startet neu...",()=>{e()})}catch(le){ce("Fehler",`Fehler beim Reboot: ${le.message}`)}})}async function ee(){F(!0),N("Snapshot wird erzeugt...");try{const le=await jt("/api/system/backup",{method:"POST"});N(le.ok?`Snapshot erzeugt: ${le.snapshot} (${le.files.length} Komponenten)`:"Backup fehlgeschlagen."),ue()}catch(le){N(`Fehler: ${le.message}`)}finally{F(!1)}}async function W(le){_(Ce=>({...Ce,[le]:!0}));try{const Ce=await jt("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:le})});Ce.ok?ce("Dienst neu gestartet",`Dienst ${le} wurde erfolgreich neu gestartet.`,()=>{w==="logs"&&a===le&&Q(le)}):ce("Fehler",`Fehler beim Neustart: ${Ce.err||"Unbekannter Fehler"}`)}catch(Ce){ce("Fehler",`Fehler beim Neustart: ${Ce.message}`)}finally{_(Ce=>({...Ce,[le]:!1}))}}async function Ee(le){try{await jt(`/api/jobs/${le}/cancel`,{method:"POST"}),He()}catch(Ce){ce("Fehler",`Fehler beim Abbrechen: ${Ce.message}`)}}return v.jsxs(v.Fragment,{children:[v.jsx("div",{className:nt("fixed inset-0 bg-black/60 backdrop-blur-sm z-50 transition-opacity duration-300",t?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"),onClick:e}),v.jsxs("div",{className:nt("fixed inset-y-0 right-0 w-full sm:w-[640px] bg-card/85 backdrop-blur-xl border-l border-border/60 shadow-2xl z-50 flex flex-col transform transition-transform duration-300 ease-in-out font-sans text-foreground",t?"translate-x-0":"translate-x-full"),children:[v.jsxs("div",{className:"flex h-16 shrink-0 items-center justify-between border-b border-border/40 px-6",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(El,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase font-space",children:"OS-Zentrale & Pflege"})]}),v.jsx("button",{onClick:e,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-border/40 text-muted-foreground hover:bg-accent transition-colors",children:v.jsx(Bc,{className:"h-4 w-4"})})]}),v.jsxs("div",{className:"flex border-b border-border/40 px-6",children:[v.jsx("button",{onClick:()=>A("maintenance"),className:nt("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",w==="maintenance"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Wartung"}),v.jsx("button",{onClick:()=>A("logs"),className:nt("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",w==="logs"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Logs"}),v.jsx("button",{onClick:()=>A("settings"),className:nt("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",w==="settings"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Einstellungen"})]}),v.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[w==="maintenance"&&v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"space-y-2.5",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Updates"}),v.jsxs("button",{onClick:Qe,disabled:T,className:"flex items-center gap-1 text-[10px] font-semibold text-primary hover:text-primary/80 transition-colors disabled:opacity-50",children:[v.jsx(B0,{className:nt("h-3 w-3",T&&"animate-spin")})," Nach Updates suchen"]})]}),(r==null?void 0:r.last_check)&&v.jsxs("div",{className:"text-[9px] text-muted-foreground -mt-1",children:["Zuletzt gesucht: ",K(r.last_check)]}),v.jsxs("div",{className:"space-y-1.5",children:[v.jsx(L_,{icon:sy,iconClass:"text-cyan-400",name:"OS-Pakete (apt)",available:!!(r!=null&&r.os),status:r!=null&&r.os?`${r.os} verfügbar`:"aktuell",actionLabel:"Aktualisieren",onAction:Ge}),v.jsx(L_,{icon:xP,iconClass:"text-violet-400",name:"Engine (llama.cpp)",available:!!(r!=null&&r.engine),status:r!=null&&r.engine?"Update verfügbar":"aktuell",actionLabel:"Aktualisieren",onAction:Ue}),(()=>{var Ce;const le=(Ce=r==null?void 0:r.components)==null?void 0:Ce.find(lt=>lt.key==="hermes_agent");return v.jsx(L_,{icon:qc,iconClass:"text-amber-400",name:"Hermes-Agent",available:(le==null?void 0:le.update)===!0,busy:ne,status:(le==null?void 0:le.update)===!0?`Update: ${le.latest}`:(le==null?void 0:le.reachable)===!1?"offline":"aktuell",actionLabel:"Aktualisieren",onAction:We})})(),(Be=r==null?void 0:r.model_list)==null?void 0:Be.map(le=>v.jsx(L_,{icon:y8,iconClass:"text-emerald-400",name:`Modell · ${le.role}`,available:!0,status:le.title,actionLabel:"Upgrade",onAction:()=>xt(le.repo,le.role)},le.role))]})]}),v.jsxs("div",{className:"space-y-2.5",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Dienste"}),v.jsx("div",{className:"space-y-1.5",children:Nj.map(le=>{var Ce;return v.jsx(fSe,{label:le.label,system:le.type==="system",ok:(Ce=V==null?void 0:V.services.find(lt=>lt.name.toLowerCase().includes(le.reach)))==null?void 0:Ce.ok,busy:S[le.id],onRestart:()=>W(le.id),onLogs:()=>{l(le.id),A("logs")}},le.id)})})]}),v.jsxs("div",{className:"space-y-2.5",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Backup"}),v.jsxs("div",{className:"rounded-lg border border-border/50 bg-background/20 px-3 py-2.5 flex items-center gap-3",children:[v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsx("div",{className:"text-xs text-foreground truncate",children:j[0]?`Letztes: ${j[0].snapshot}`:"Noch kein Backup"}),v.jsxs("div",{className:"text-[10px] text-muted-foreground",children:[j.length," Snapshots · Restore per CLI (restore.sh)"]})]}),v.jsxs("button",{onClick:ee,disabled:D,className:"flex items-center gap-1.5 text-[11px] font-semibold rounded-lg px-2.5 py-1 bg-primary text-primary-foreground hover:opacity-90 transition-all cursor-pointer disabled:opacity-50 shrink-0",children:[v.jsx(x8,{className:nt("h-3.5 w-3.5",D&&"animate-pulse")})," Snapshot"]})]}),O&&v.jsx("div",{className:"text-[10px] font-mono text-primary bg-primary/5 p-2 rounded-lg border border-primary/20 break-all leading-normal",children:O})]}),v.jsxs("div",{className:"space-y-2.5",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-red-400/80",children:"Gefahrenzone"}),v.jsxs("button",{onClick:at,className:"flex w-full items-center gap-3 p-3 rounded-lg border border-red-500/20 bg-red-500/5 hover:bg-red-500/10 text-red-400 transition-all text-left text-xs font-semibold",children:[v.jsx($8,{className:"h-4.5 w-4.5"}),v.jsxs("div",{children:[v.jsx("div",{children:"Host-System neu starten"}),v.jsx("div",{className:"text-[10px] text-red-400/80 font-normal",children:"Startet die ganze Box neu"})]})]})]}),v.jsxs("div",{className:"space-y-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Hintergrund-Aufgaben"}),v.jsxs("span",{className:"text-[10px] font-mono bg-primary/10 text-primary px-1.5 py-0.5 rounded-full",children:[s.filter(le=>le.state==="running"||le.state==="queued").length," Aktiv"]})]}),v.jsx("div",{className:"space-y-3",children:s.length===0?v.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-xl p-6 text-center",children:"Aktuell keine aktiven Hintergrund-Jobs."}):s.map(le=>{const Ce=le.state==="running"||le.state==="queued";return v.jsxs("div",{className:nt("p-3 rounded-xl border transition-all duration-300",Ce?"border-primary/40 bg-primary/5 shadow-md shadow-primary/5":"border-border/40 bg-background/20 opacity-80"),children:[v.jsxs("div",{className:"flex items-start justify-between gap-3",children:[v.jsxs("div",{className:"space-y-1",children:[v.jsxs("div",{className:"text-xs font-semibold flex items-center gap-1.5",children:[Ce&&v.jsxs("span",{className:"flex h-2 w-2 relative",children:[v.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),v.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]}),le.label]}),v.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground uppercase flex items-center gap-2",children:[v.jsxs("span",{children:["ID: ",le.id]}),v.jsx("span",{children:"•"}),v.jsx("span",{className:nt(le.state==="done"&&"text-emerald-400",le.state==="failed"&&"text-red-400",le.state==="running"&&"text-primary",le.state==="queued"&&"text-amber-400",le.state==="canceled"&&"text-muted-foreground"),children:le.state})]})]}),Ce&&v.jsx("button",{onClick:()=>Ee(le.id),className:"text-[10px] font-semibold text-red-400 hover:text-red-300 border border-red-500/20 bg-red-500/5 hover:bg-red-500/10 px-2 py-0.5 rounded transition-colors",children:"Abbrechen"})]}),le.state==="running"&&v.jsxs("div",{className:"mt-3 space-y-1",children:[v.jsx("div",{className:"w-full h-1.5 bg-muted rounded-full overflow-hidden",children:v.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${le.progress??0}%`}})}),v.jsxs("div",{className:"flex justify-between items-center text-[9px] font-mono text-muted-foreground",children:[v.jsxs("span",{children:[le.progress??0,"%"]}),le.done_bytes!=null&&le.total_bytes!=null&&v.jsxs("span",{children:[dT(le.done_bytes)," / ",dT(le.total_bytes),le.rate_bps!=null&&` (${dT(le.rate_bps)}/s)`]}),le.eta_s!=null&&v.jsxs("span",{children:["ETA: ",le.eta_s,"s"]})]})]})]},le.id)})})]})]}),w==="logs"&&v.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("select",{value:a,onChange:le=>l(le.target.value),className:"flex-1 h-9 px-3 text-xs bg-background/40 border border-border/60 rounded-lg outline-none text-foreground font-semibold",children:Nj.map(le=>v.jsxs("option",{value:le.id,children:[le.label," (",le.type==="system"?"systemd-root":"user",")"]},le.id))}),v.jsxs("button",{onClick:()=>W(a),disabled:S[a],className:"flex h-9 px-3 items-center gap-1.5 text-xs font-semibold rounded-lg border border-border/60 bg-background/20 hover:border-primary/50 transition-colors disabled:opacity-50",title:"Dienst neu starten",children:[v.jsx(B0,{className:nt("h-3.5 w-3.5",S[a]&&"animate-spin")}),"Restart"]})]}),v.jsxs("div",{className:"flex-1 flex flex-col min-h-[300px] border border-border/60 bg-black/50 rounded-xl overflow-hidden shadow-inner",children:[v.jsxs("div",{className:"flex h-9 items-center justify-between px-4 border-b border-border/40 bg-black/30 shrink-0",children:[v.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground",children:[v.jsx(aF,{className:"h-3 w-3 text-primary"}),v.jsxs("span",{children:["stdout/stderr - ",a]})]}),v.jsx("button",{onClick:()=>Q(a),disabled:f,className:"text-muted-foreground hover:text-foreground transition-colors",children:v.jsx(B0,{className:nt("h-3 w-3",f&&"animate-spin")})})]}),v.jsx("pre",{ref:$e,className:"flex-1 p-4 overflow-y-auto text-[10px] font-mono text-cyan-300/90 whitespace-pre-wrap select-text leading-relaxed scrollbar-thin",children:y==="password_required"||y==="incorrect_password"?v.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center h-full space-y-3",children:[v.jsx(yg,{className:"h-8 w-8 text-amber-400 animate-pulse animate-duration-1000"}),v.jsx("div",{className:"text-xs font-semibold text-amber-300",children:y==="incorrect_password"?"Falsches Sudo-Passwort hinterlegt.":"Sudo-Passwort für systemd-Dienste erforderlich."}),v.jsxs("p",{className:"text-[10px] text-muted-foreground max-w-xs leading-normal",children:["Für das Auslesen der systemd-Logs von ",a," werden Root-Rechte benötigt. Hinterlege dein Passwort in den Einstellungen."]}),v.jsx("button",{onClick:()=>A("settings"),className:"px-3 py-1.5 text-[10px] font-semibold text-primary-foreground bg-primary hover:bg-primary/95 rounded-md transition-colors mt-2",children:"Sudo-Passwort eintragen"})]}):f&&!c?v.jsx("span",{className:"text-muted-foreground",children:"Lade Logs..."}):c||v.jsx("span",{className:"text-muted-foreground",children:"Keine Logeinträge vorhanden."})})]})]}),w==="settings"&&v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Zugangsdaten & Schlüssel"}),v.jsx("p",{className:"text-[10px] text-muted-foreground leading-normal",children:"Diese Daten werden ausschließlich lokal in deinem Browser (localStorage) gespeichert und bei Bedarf an das Backend übertragen."})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[v.jsx(sy,{className:"h-4 w-4 text-amber-400"}),"Host Sudo-Passwort"]}),v.jsxs("div",{className:"relative",children:[v.jsx("input",{type:ae?"text":"password",value:q,onChange:le=>$(le.target.value),placeholder:"Sudo-Passwort für System-Operationen",className:"w-full h-10 pl-3 pr-10 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground"}),v.jsx("button",{type:"button",onClick:()=>fe(!ae),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:ae?v.jsx(iI,{className:"h-4 w-4"}):v.jsx(PT,{className:"h-4 w-4"})})]}),v.jsx("p",{className:"text-[9px] text-muted-foreground leading-normal",children:"Wird benötigt für systemd-Dienste (Llama Swap logs/restart), OS-Update (apt) und Reboot."})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[v.jsx(O8,{className:"h-4 w-4 text-violet-400"}),"HuggingFace API Token"]}),v.jsxs("div",{className:"relative",children:[v.jsx("input",{type:_e?"text":"password",value:Z,onChange:le=>ge(le.target.value),placeholder:"hf_...",className:"w-full h-10 pl-3 pr-10 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground"}),v.jsx("button",{type:"button",onClick:()=>Se(!_e),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:_e?v.jsx(iI,{className:"h-4 w-4"}):v.jsx(PT,{className:"h-4 w-4"})})]}),v.jsx("p",{className:"text-[9px] text-muted-foreground leading-normal",children:"Erlaubt das Herunterladen von geschützten oder Gate-restricted Modellen direkt über Mission Control."})]}),v.jsxs("div",{className:"flex gap-3 pt-2",children:[v.jsx("button",{onClick:()=>{localStorage.setItem("mc_sudo_password",q),localStorage.setItem("mc_hf_token",Z),ce("Erfolgreich","Einstellungen erfolgreich lokal gespeichert.")},className:"flex-1 h-9 flex items-center justify-center text-xs font-semibold text-primary-foreground bg-primary hover:bg-primary/90 rounded-lg transition-colors shadow shadow-primary/10 cursor-pointer",children:"Speichern"}),v.jsx("button",{onClick:()=>{$(""),ge(""),localStorage.removeItem("mc_sudo_password"),localStorage.removeItem("mc_hf_token"),ce("Gelöscht","Zugangsdaten gelöscht.")},className:"h-9 px-4 flex items-center justify-center text-xs font-semibold text-muted-foreground border border-border/60 bg-background/20 hover:bg-accent rounded-lg transition-colors cursor-pointer",children:"Zurücksetzen"})]})]})]})]}),pe&&v.jsx(uV,{type:pe.type,title:pe.title,message:pe.message,onConfirm:pe.onConfirm,onCancel:pe.onCancel})]})}function pSe(){var f,m,y,x,S;iX();const[t,e]=R.useState("dashboard"),[n,r]=R.useState(()=>localStorage.getItem("mc_sidebar_collapsed")==="true"),[i,s]=R.useState(!1),[o,a]=R.useState("maintenance"),{data:l}=u7(),{data:c}=K1(2e4);R.useEffect(()=>{document.documentElement.classList.add("dark")},[]),R.useEffect(()=>{const _=w=>{var T;a(((T=w.detail)==null?void 0:T.tab)||"maintenance"),s(!0)};return window.addEventListener("open-system-drawer",_),()=>window.removeEventListener("open-system-drawer",_)},[]),R.useEffect(()=>{const _=w=>{var T;const A=(T=w.detail)==null?void 0:T.view;A&&e(A)};return window.addEventListener("mc-navigate",_),()=>window.removeEventListener("mc-navigate",_)},[]);const d=kT.find(_=>_.id===t);return v.jsxs("div",{className:"flex h-full relative",children:[v.jsxs("div",{className:"fixed inset-0 -z-50 pointer-events-none overflow-hidden bg-[hsl(224,30%,6%)]",children:[v.jsx("div",{className:"absolute inset-0 opacity-35 animate-aurora bg-gradient-to-tr from-teal-500/20 via-indigo-500/15 to-purple-500/20 blur-[130px]"}),v.jsx("div",{className:"absolute top-[-10%] left-[-10%] h-[50%] w-[50%] rounded-full bg-teal-500/15 blur-[160px]"}),v.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] h-[50%] w-[50%] rounded-full bg-purple-500/15 blur-[160px]"}),v.jsx("div",{className:"absolute top-[30%] right-[20%] h-[40%] w-[40%] rounded-full bg-indigo-500/10 blur-[140px]"})]}),v.jsx(l7,{onNavigate:e}),v.jsx(hSe,{open:i,onClose:()=>s(!1),defaultTab:o}),v.jsxs("aside",{className:nt("flex shrink-0 flex-col border-r border-border/40 bg-card/45 backdrop-blur-md transition-all duration-300 ease-in-out",n?"w-16":"w-60"),children:[v.jsxs("div",{className:nt("flex items-center py-4 border-b border-border/40 shrink-0",n?"flex-col gap-3 px-2":"justify-between px-5"),children:[v.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[v.jsx("div",{className:"h-7 w-7 rounded-lg bg-primary shadow-md shadow-primary/20 shrink-0"}),!n&&v.jsxs("div",{className:"leading-tight",children:[v.jsx("div",{className:"text-sm font-semibold tracking-wide font-space",children:"Mission Control"}),v.jsx("div",{className:"text-xs text-muted-foreground",children:"2.0"})]})]}),v.jsx("button",{onClick:()=>{r(_=>{const w=!_;return localStorage.setItem("mc_sidebar_collapsed",w.toString()),w})},className:"p-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer",title:n?"Maximieren":"Minimieren",children:n?v.jsx(rF,{className:"h-4 w-4"}):v.jsx(_8,{className:"h-4 w-4"})})]}),v.jsx("nav",{className:"flex-1 space-y-1 px-3 py-4 overflow-y-auto",children:kT.map(_=>v.jsxs("button",{onClick:()=>e(_.id),className:nt("flex w-full items-center rounded-md text-sm transition-all cursor-pointer",n?"justify-center p-2.5":"gap-3 px-3 py-2",t===_.id?"bg-primary/15 text-primary shadow-sm shadow-primary/5":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),title:n?_.label:void 0,children:[v.jsx(_.icon,{className:"h-4.5 w-4.5 shrink-0"}),!n&&v.jsx("span",{className:"truncate",children:_.label})]},_.id))}),v.jsx("div",{className:nt("py-3 text-xs text-muted-foreground border-t border-border/40 shrink-0",n?"px-2 text-center":"px-5"),children:n?v.jsx("div",{className:"flex justify-center",children:v.jsx("span",{className:nt("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",l?l.engine_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500":"bg-red-500"),title:l?`Engine ${l.engine_reachable?"online":"offline"}`:"Backend offline"})}):v.jsxs("div",{className:"space-y-2 text-left",children:[l?v.jsxs("span",{className:"flex items-center gap-2",children:[v.jsx("span",{className:nt("h-2 w-2 rounded-full animate-pulse",l.engine_reachable?"bg-emerald-500":"bg-amber-500")}),v.jsxs("span",{className:"truncate",children:["Engine ",l.engine_reachable?"online":"offline"]})]}):v.jsxs("span",{className:"flex items-center gap-2",children:[v.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"})," ",v.jsx("span",{className:"truncate",children:"Backend offline"})]}),(c==null?void 0:c.versions)&&v.jsxs("div",{className:"space-y-1 text-[9px] text-muted-foreground/60 mt-2 pt-2 border-t border-border/30",children:[v.jsxs("div",{className:"truncate",title:c.versions.mc2?`${c.versions.mc2.branch}-${c.versions.mc2.hash}${c.versions.mc2.dirty?"*":""} (${c.versions.mc2.date})`:"nicht gefunden",children:[v.jsx("strong",{children:"MC2:"})," ",c.versions.mc2?`${c.versions.mc2.hash}${c.versions.mc2.dirty?"*":""}`:"—"]}),v.jsxs("div",{className:"truncate",title:((f=c.versions.engine)==null?void 0:f.type)==="git"?`${c.versions.engine.branch}-${c.versions.engine.hash}${c.versions.engine.dirty?"*":""} (${c.versions.engine.date})`:((m=c.versions.engine)==null?void 0:m.version_text)||"unbekannt",children:[v.jsx("strong",{children:"Engine:"})," ",((y=c.versions.engine)==null?void 0:y.type)==="git"?`${c.versions.engine.hash}${c.versions.engine.dirty?"*":""}`:((S=(x=c.versions.engine)==null?void 0:x.version_text)==null?void 0:S.split(" ").pop())||"—"]}),v.jsxs("div",{className:"truncate",title:c.versions.hermes_ui?`${c.versions.hermes_ui.branch}-${c.versions.hermes_ui.hash}${c.versions.hermes_ui.dirty?"*":""} (${c.versions.hermes_ui.date})`:"nicht gefunden",children:[v.jsx("strong",{children:"Hermes UI:"})," ",c.versions.hermes_ui?`${c.versions.hermes_ui.hash}${c.versions.hermes_ui.dirty?"*":""}`:"—"]}),v.jsxs("div",{className:"truncate",title:c.versions.hermes_agent?`${c.versions.hermes_agent.branch}-${c.versions.hermes_agent.hash}${c.versions.hermes_agent.dirty?"*":""} (${c.versions.hermes_agent.date})`:"nicht gefunden",children:[v.jsx("strong",{children:"Hermes Agent:"})," ",c.versions.hermes_agent?`${c.versions.hermes_agent.hash}${c.versions.hermes_agent.dirty?"*":""}`:"—"]})]})]})})]}),v.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[v.jsxs("header",{className:"flex h-14 shrink-0 items-center justify-between border-b border-border/40 px-6 bg-card/20 backdrop-blur-sm",children:[v.jsx("div",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase font-sans",children:d.hint}),v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("a",{href:"https://git.tobisniceshomelab.ddnsfree.com/Hitonabi/mission-control-v2/src/branch/main/docs/BEDIENUNG.md",target:"_blank",rel:"noopener",className:"flex h-8 items-center rounded-md border border-border/40 bg-background/40 px-2.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all cursor-pointer font-semibold",title:"Bedien-Anleitung",children:"Hilfe"}),v.jsxs("button",{onClick:()=>{const _=new KeyboardEvent("keydown",{key:"k",metaKey:!0});document.dispatchEvent(_)},className:"flex items-center gap-2 rounded-md border border-border/40 bg-background/40 px-2.5 py-1.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all cursor-pointer",children:[v.jsx(T8,{className:"h-3.5 w-3.5"}),v.jsx("span",{children:"Suchen"}),v.jsx("kbd",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[9px]",children:"⌘K"})]})]})]}),v.jsxs("main",{className:"flex-1 overflow-y-auto p-6 scrollbar-thin",children:[t==="dashboard"&&v.jsx(Tfe,{}),t==="models"&&v.jsx(Ofe,{}),t==="connect"&&v.jsx(Dfe,{}),t==="memory"&&v.jsx(Vfe,{}),t==="agent"&&v.jsx(Gfe,{}),t==="terminal"&&v.jsx(Wfe,{}),t==="voice"&&v.jsx(lSe,{}),t==="guide"&&v.jsx(uSe,{}),!["dashboard","models","connect","memory","agent","terminal","voice","guide"].includes(t)&&v.jsx(dSe,{title:d.label,hint:d.hint})]})]})]})}const mSe=new t8({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5e3}}});PW.createRoot(document.getElementById("root")).render(v.jsx(Hj.StrictMode,{children:v.jsx(n8,{client:mSe,children:v.jsx(pSe,{})})}));export{Zt as B,dx as F,Hj as R,Vm as S,IT as T,X as V,rP as _,Qt as a,R as b,Km as c,nbe as d,SG as e,CW as f,z1 as g,v as h,Z8 as i,Ebe as j,mz as l,Wh as r,jbe as u};
|