diff --git a/frontend/dist/assets/GraphView-C79Yg7_9.js b/frontend/dist/assets/GraphView-C6IMczS5.js similarity index 99% rename from frontend/dist/assets/GraphView-C79Yg7_9.js rename to frontend/dist/assets/GraphView-C6IMczS5.js index d61e357..a2af270 100644 --- a/frontend/dist/assets/GraphView-C79Yg7_9.js +++ b/frontend/dist/assets/GraphView-C6IMczS5.js @@ -1,4 +1,4 @@ -import{R as Fh,B as Ww,a as Xw,V as _n,F as qw,r as Iy,g as ki,b as q,c as go,d as Yw,e as jw,_ as Tc,u as $w,j as Zw,f as Kw,h as Se,l as Jw,S as Qw,i as Cg,T as eS}from"./index-CS3v-0XV.js";const tS=r=>typeof r=="object"&&typeof r.then=="function",Zc=[];function nS(r,e,t=(n,i)=>n===i){if(r===e)return!0;if(!r||!e)return!1;const n=r.length;if(e.length!==n)return!1;for(let i=0;i0&&(s.timeout&&clearTimeout(s.timeout),s.timeout=setTimeout(s.remove,n.lifespan)),s.response;if(!t)throw s.promise}const i={keys:e,equal:n.equal,remove:()=>{const s=Zc.indexOf(i);s!==-1&&Zc.splice(s,1)},promise:(tS(r)?r:r(...e)).then(s=>{i.response=s,n.lifespan&&n.lifespan>0&&(i.timeout=setTimeout(i.remove,n.lifespan))}).catch(s=>i.error=s)};if(Zc.push(i),!t)throw i.promise}const rS=(r,e,t)=>iS(r,e,!1,t);function sS(r,e,t){return Math.max(e,Math.min(r,t))}const Tt={toVector(r,e){return r===void 0&&(r=e),Array.isArray(r)?r:[r,r]},add(r,e){return[r[0]+e[0],r[1]+e[1]]},sub(r,e){return[r[0]-e[0],r[1]-e[1]]},addTo(r,e){r[0]+=e[0],r[1]+=e[1]},subTo(r,e){r[0]-=e[0],r[1]-=e[1]}};function Rg(r,e,t){return e===0||Math.abs(e)===1/0?Math.pow(r,t*5):r*e*t/(e+t*r)}function Pg(r,e,t,n=.15){return n===0?sS(r,e,t):rt?+Rg(r-t,t-e,n)+t:r}function oS(r,[e,t],[n,i]){const[[s,o],[a,c]]=r;return[Pg(e,s,o,n),Pg(t,a,c,i)]}function aS(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function cS(r){var e=aS(r,"string");return typeof e=="symbol"?e:String(e)}function $t(r,e,t){return e=cS(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Lg(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ut(r){for(var e=1;e{var t,n;return e.target===r.currentTarget||((t=r.currentTarget)===null||t===void 0||(n=t.contains)===null||n===void 0?void 0:n.call(t,e.target))})}function gS(r){return r.type==="touchend"||r.type==="touchcancel"?r.changedTouches:r.targetTouches}function Ny(r){return Du(r)?gS(r)[0]:r}function Pd(r,e){try{const t=e.clientX-r.clientX,n=e.clientY-r.clientY,i=(e.clientX+r.clientX)/2,s=(e.clientY+r.clientY)/2,o=Math.hypot(t,n);return{angle:-(Math.atan2(t,n)*180)/Math.PI,distance:o,origin:[i,s]}}catch{}return null}function vS(r){return mS(r).map(e=>e.identifier)}function Ig(r,e){const[t,n]=Array.from(r.touches).filter(i=>e.includes(i.identifier));return Pd(t,n)}function kh(r){const e=Ny(r);return Du(r)?e.identifier:e.pointerId}function To(r){const e=Ny(r);return[e.clientX,e.clientY]}const Ug=40,Og=800;function Fy(r){let{deltaX:e,deltaY:t,deltaMode:n}=r;return n===1?(e*=Ug,t*=Ug):n===2&&(e*=Og,t*=Og),[e,t]}function _S(r){var e,t;const{scrollX:n,scrollY:i,scrollLeft:s,scrollTop:o}=r.currentTarget;return[(e=n??s)!==null&&e!==void 0?e:0,(t=i??o)!==null&&t!==void 0?t:0]}function yS(r){const e={};if("buttons"in r&&(e.buttons=r.buttons),"shiftKey"in r){const{shiftKey:t,altKey:n,metaKey:i,ctrlKey:s}=r;Object.assign(e,{shiftKey:t,altKey:n,metaKey:i,ctrlKey:s})}return e}function gu(r,...e){return typeof r=="function"?r(...e):r}function xS(){}function bS(...r){return r.length===0?xS:r.length===1?r[0]:function(){let e;for(const t of r)e=t.apply(this,arguments)||e;return e}}function Ng(r,e){return Object.assign({},e,r||{})}const wS=32;class ky{constructor(e,t,n){this.ctrl=e,this.args=t,this.key=n,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:e,shared:t,ingKey:n,args:i}=this;t[n]=e._active=e.active=e._blocked=e._force=!1,e._step=[!1,!1],e.intentional=!1,e._movement=[0,0],e._distance=[0,0],e._direction=[0,0],e._delta=[0,0],e._bounds=[[-1/0,1/0],[-1/0,1/0]],e.args=i,e.axis=void 0,e.memo=void 0,e.elapsedTime=e.timeDelta=0,e.direction=[0,0],e.distance=[0,0],e.overflow=[0,0],e._movementBound=[!1,!1],e.velocity=[0,0],e.movement=[0,0],e.delta=[0,0],e.timeStamp=0}start(e){const t=this.state,n=this.config;t._active||(this.reset(),this.computeInitial(),t._active=!0,t.target=e.target,t.currentTarget=e.currentTarget,t.lastOffset=n.from?gu(n.from,t):t.offset,t.offset=t.lastOffset,t.startTime=t.timeStamp=e.timeStamp)}computeValues(e){const t=this.state;t._values=e,t.values=this.config.transform(e)}computeInitial(){const e=this.state;e._initial=e._values,e.initial=e.values}compute(e){const{state:t,config:n,shared:i}=this;t.args=this.args;let s=0;if(e&&(t.event=e,n.preventDefault&&e.cancelable&&t.event.preventDefault(),t.type=e.type,i.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,i.locked=!!document.pointerLockElement,Object.assign(i,yS(e)),i.down=i.pressed=i.buttons%2===1||i.touches>0,s=e.timeStamp-t.timeStamp,t.timeStamp=e.timeStamp,t.elapsedTime=t.timeStamp-t.startTime),t._active){const w=t._delta.map(Math.abs);Tt.addTo(t._distance,w)}this.axisIntent&&this.axisIntent(e);const[o,a]=t._movement,[c,l]=n.threshold,{_step:u,values:h}=t;if(n.hasCustomTransform?(u[0]===!1&&(u[0]=Math.abs(o)>=c&&h[0]),u[1]===!1&&(u[1]=Math.abs(a)>=l&&h[1])):(u[0]===!1&&(u[0]=Math.abs(o)>=c&&Math.sign(o)*c),u[1]===!1&&(u[1]=Math.abs(a)>=l&&Math.sign(a)*l)),t.intentional=u[0]!==!1||u[1]!==!1,!t.intentional)return;const f=[0,0];if(n.hasCustomTransform){const[w,S]=h;f[0]=u[0]!==!1?w-u[0]:0,f[1]=u[1]!==!1?S-u[1]:0}else f[0]=u[0]!==!1?o-u[0]:0,f[1]=u[1]!==!1?a-u[1]:0;this.restrictToAxis&&!t._blocked&&this.restrictToAxis(f);const d=t.offset,m=t._active&&!t._blocked||t.active;m&&(t.first=t._active&&!t.active,t.last=!t._active&&t.active,t.active=i[this.ingKey]=t._active,e&&(t.first&&("bounds"in n&&(t._bounds=gu(n.bounds,t)),this.setup&&this.setup()),t.movement=f,this.computeOffset()));const[v,g]=t.offset,[[p,_],[y,x]]=t._bounds;t.overflow=[v_?1:0,gx?1:0],t._movementBound[0]=t.overflow[0]?t._movementBound[0]===!1?t._movement[0]:t._movementBound[0]:!1,t._movementBound[1]=t.overflow[1]?t._movementBound[1]===!1?t._movement[1]:t._movementBound[1]:!1;const b=t._active?n.rubberband||[0,0]:[0,0];if(t.offset=oS(t._bounds,t.offset,b),t.delta=Tt.sub(t.offset,d),this.computeMovement(),m&&(!t.last||s>wS)){t.delta=Tt.sub(t.offset,d);const w=t.delta.map(Math.abs);Tt.addTo(t.distance,w),t.direction=t.delta.map(Math.sign),t._direction=t._delta.map(Math.sign),!t.first&&s>0&&(t.velocity=[w[0]/s,w[1]/s],t.timeDelta=s)}}emit(){const e=this.state,t=this.shared,n=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!n.triggerAllEvents)return;const i=this.handler(Ut(Ut(Ut({},t),e),{},{[this.aliasKey]:e.values}));i!==void 0&&(e.memo=i)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function SS([r,e],t){const n=Math.abs(r),i=Math.abs(e);if(n>i&&n>t)return"x";if(i>n&&i>t)return"y"}class Ac extends ky{constructor(...e){super(...e),$t(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=Tt.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=Tt.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){const t=this.state,n=this.config;if(!t.axis&&e){const i=typeof n.axisThreshold=="object"?n.axisThreshold[Oy(e)]:n.axisThreshold;t.axis=SS(t._movement,i)}t._blocked=(n.lockDirection||!!n.axis)&&!t.axis||!!n.axis&&n.axis!==t.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":e[1]=0;break;case"y":e[0]=0;break}}}const ES=r=>r,Fg=.15,zy={enabled(r=!0){return r},eventOptions(r,e,t){return Ut(Ut({},t.shared.eventOptions),r)},preventDefault(r=!1){return r},triggerAllEvents(r=!1){return r},rubberband(r=0){switch(r){case!0:return[Fg,Fg];case!1:return[0,0];default:return Tt.toVector(r)}},from(r){if(typeof r=="function")return r;if(r!=null)return Tt.toVector(r)},transform(r,e,t){const n=r||t.shared.transform;return this.hasCustomTransform=!!n,n||ES},threshold(r){return Tt.toVector(r,0)}},MS=0,Es=Ut(Ut({},zy),{},{axis(r,e,{axis:t}){if(this.lockDirection=t==="lock",!this.lockDirection)return t},axisThreshold(r=MS){return r},bounds(r={}){if(typeof r=="function")return s=>Es.bounds(r(s));if("current"in r)return()=>r.current;if(typeof HTMLElement=="function"&&r instanceof HTMLElement)return r;const{left:e=-1/0,right:t=1/0,top:n=-1/0,bottom:i=1/0}=r;return[[e,t],[n,i]]}}),kg={ArrowRight:(r,e=1)=>[r*e,0],ArrowLeft:(r,e=1)=>[-1*r*e,0],ArrowUp:(r,e=1)=>[0,-1*r*e],ArrowDown:(r,e=1)=>[0,r*e]};class TS extends Ac{constructor(...e){super(...e),$t(this,"ingKey","dragging")}reset(){super.reset();const e=this.state;e._pointerId=void 0,e._pointerActive=!1,e._keyboardActive=!1,e._preventScroll=!1,e._delayed=!1,e.swipe=[0,0],e.tap=!1,e.canceled=!1,e.cancel=this.cancel.bind(this)}setup(){const e=this.state;if(e._bounds instanceof HTMLElement){const t=e._bounds.getBoundingClientRect(),n=e.currentTarget.getBoundingClientRect(),i={left:t.left-n.left+e.offset[0],right:t.right-n.right+e.offset[0],top:t.top-n.top+e.offset[1],bottom:t.bottom-n.bottom+e.offset[1]};e._bounds=Es.bounds(i)}}cancel(){const e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){const t=this.config,n=this.state;if(e.buttons!=null&&(Array.isArray(t.pointerButtons)?!t.pointerButtons.includes(e.buttons):t.pointerButtons!==-1&&t.pointerButtons!==e.buttons))return;const i=this.ctrl.setEventIds(e);t.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(i&&i.size>1&&n._pointerActive)&&(this.start(e),this.setupPointer(e),n._pointerId=kh(e),n._pointerActive=!0,this.computeValues(To(e)),this.computeInitial(),t.preventScrollAxis&&Oy(e)!=="mouse"?(n._active=!1,this.setupScrollPrevention(e)):t.delay>0?(this.setupDelayTrigger(e),t.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){const t=this.state;t._active=!0,t._preventScroll=!0,t._delayed=!1,this.compute(e),this.emit()}pointerMove(e){const t=this.state,n=this.config;if(!t._pointerActive)return;const i=kh(e);if(t._pointerId!==void 0&&i!==t._pointerId)return;const s=To(e);if(document.pointerLockElement===e.target?t._delta=[e.movementX,e.movementY]:(t._delta=Tt.sub(s,t._values),this.computeValues(s)),Tt.addTo(t._movement,t._delta),this.compute(e),t._delayed&&t.intentional){this.timeoutStore.remove("dragDelay"),t.active=!1,this.startPointerDrag(e);return}if(n.preventScrollAxis&&!t._preventScroll)if(t.axis)if(t.axis===n.preventScrollAxis||n.preventScrollAxis==="xy"){t._active=!1,this.clean();return}else{this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(e);return}else return;this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch{}const t=this.state,n=this.config;if(!t._active||!t._pointerActive)return;const i=kh(e);if(t._pointerId!==void 0&&i!==t._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);const[s,o]=t._distance;if(t.tap=s<=n.tapsThreshold&&o<=n.tapsThreshold,t.tap&&n.filterTaps)t._force=!0;else{const[a,c]=t._delta,[l,u]=t._movement,[h,f]=n.swipe.velocity,[d,m]=n.swipe.distance,v=n.swipe.duration;if(t.elapsedTimeh&&Math.abs(l)>d&&(t.swipe[0]=Math.sign(a)),p>f&&Math.abs(u)>m&&(t.swipe[1]=Math.sign(c))}}this.emit()}pointerClick(e){!this.state.tap&&e.detail>0&&(e.preventDefault(),e.stopPropagation())}setupPointer(e){const t=this.config,n=t.device;t.pointerLock&&e.currentTarget.requestPointerLock(),t.pointerCapture||(this.eventStore.add(this.sharedConfig.window,n,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,n,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,n,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,AS(e);const t=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",t),this.eventStore.add(this.sharedConfig.window,"touch","cancel",t),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,e)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){const t=kg[e.key];if(t){const n=this.state,i=e.shiftKey?10:e.altKey?.1:1;this.start(e),n._delta=t(this.config.keyboardDisplacement,i),n._keyboardActive=!0,Tt.addTo(n._movement,n._delta),this.compute(e),this.emit()}}keyUp(e){e.key in kg&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){const t=this.config.device;e(t,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(e(t,"change",this.pointerMove.bind(this)),e(t,"end",this.pointerUp.bind(this)),e(t,"cancel",this.pointerUp.bind(this)),e("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(e("key","down",this.keyDown.bind(this)),e("key","up",this.keyUp.bind(this))),this.config.filterTaps&&e("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}}function AS(r){"persist"in r&&typeof r.persist=="function"&&r.persist()}const Cc=typeof window<"u"&&window.document&&window.document.createElement;function By(){return Cc&&"ontouchstart"in window}function CS(){return By()||Cc&&window.navigator.maxTouchPoints>1}function RS(){return Cc&&"onpointerdown"in window}function PS(){return Cc&&"exitPointerLock"in window.document}function LS(){try{return"constructor"in GestureEvent}catch{return!1}}const Qn={isBrowser:Cc,gesture:LS(),touch:By(),touchscreen:CS(),pointer:RS(),pointerLock:PS()},DS=250,IS=180,US=.5,OS=50,NS=250,FS=10,zg={mouse:0,touch:0,pen:8},kS=Ut(Ut({},Es),{},{device(r,e,{pointer:{touch:t=!1,lock:n=!1,mouse:i=!1}={}}){return this.pointerLock=n&&Qn.pointerLock,Qn.touch&&t?"touch":this.pointerLock?"mouse":Qn.pointer&&!i?"pointer":Qn.touch?"touch":"mouse"},preventScrollAxis(r,e,{preventScroll:t}){if(this.preventScrollDelay=typeof t=="number"?t:t||t===void 0&&r?DS:void 0,!(!Qn.touchscreen||t===!1))return r||(t!==void 0?"y":void 0)},pointerCapture(r,e,{pointer:{capture:t=!0,buttons:n=1,keys:i=!0}={}}){return this.pointerButtons=n,this.keys=i,!this.pointerLock&&this.device==="pointer"&&t},threshold(r,e,{filterTaps:t=!1,tapsThreshold:n=3,axis:i=void 0}){const s=Tt.toVector(r,t?n:i?1:0);return this.filterTaps=t,this.tapsThreshold=n,s},swipe({velocity:r=US,distance:e=OS,duration:t=NS}={}){return{velocity:this.transform(Tt.toVector(r)),distance:this.transform(Tt.toVector(e)),duration:t}},delay(r=0){switch(r){case!0:return IS;case!1:return 0;default:return r}},axisThreshold(r){return r?Ut(Ut({},zg),r):zg},keyboardDisplacement(r=FS){return r}});function Gy(r){const[e,t]=r.overflow,[n,i]=r._delta,[s,o]=r._direction;(e<0&&n>0&&s<0||e>0&&n<0&&s>0)&&(r._movement[0]=r._movementBound[0]),(t<0&&i>0&&o<0||t>0&&i<0&&o>0)&&(r._movement[1]=r._movementBound[1])}const zS=30,BS=100;class GS extends ky{constructor(...e){super(...e),$t(this,"ingKey","pinching"),$t(this,"aliasKey","da")}init(){this.state.offset=[1,0],this.state.lastOffset=[1,0],this.state._pointerEvents=new Map}reset(){super.reset();const e=this.state;e._touchIds=[],e.canceled=!1,e.cancel=this.cancel.bind(this),e.turns=0}computeOffset(){const{type:e,movement:t,lastOffset:n}=this.state;e==="wheel"?this.state.offset=Tt.add(t,n):this.state.offset=[(1+t[0])*n[0],t[1]+n[1]]}computeMovement(){const{offset:e,lastOffset:t}=this.state;this.state.movement=[e[0]/t[0],e[1]-t[1]]}axisIntent(){const e=this.state,[t,n]=e._movement;if(!e.axis){const i=Math.abs(t)*zS-Math.abs(n);i<0?e.axis="angle":i>0&&(e.axis="scale")}}restrictToAxis(e){this.config.lockDirection&&(this.state.axis==="scale"?e[1]=0:this.state.axis==="angle"&&(e[0]=0))}cancel(){const e=this.state;e.canceled||setTimeout(()=>{e.canceled=!0,e._active=!1,this.compute(),this.emit()},0)}touchStart(e){this.ctrl.setEventIds(e);const t=this.state,n=this.ctrl.touchIds;if(t._active&&t._touchIds.every(s=>n.has(s))||n.size<2)return;this.start(e),t._touchIds=Array.from(n).slice(0,2);const i=Ig(e,t._touchIds);i&&this.pinchStart(e,i)}pointerStart(e){if(e.buttons!=null&&e.buttons%2!==1)return;this.ctrl.setEventIds(e),e.target.setPointerCapture(e.pointerId);const t=this.state,n=t._pointerEvents,i=this.ctrl.pointerIds;if(t._active&&Array.from(n.keys()).every(o=>i.has(o))||(n.size<2&&n.set(e.pointerId,e),t._pointerEvents.size<2))return;this.start(e);const s=Pd(...Array.from(n.values()));s&&this.pinchStart(e,s)}pinchStart(e,t){const n=this.state;n.origin=t.origin,this.computeValues([t.distance,t.angle]),this.computeInitial(),this.compute(e),this.emit()}touchMove(e){if(!this.state._active)return;const t=Ig(e,this.state._touchIds);t&&this.pinchMove(e,t)}pointerMove(e){const t=this.state._pointerEvents;if(t.has(e.pointerId)&&t.set(e.pointerId,e),!this.state._active)return;const n=Pd(...Array.from(t.values()));n&&this.pinchMove(e,n)}pinchMove(e,t){const n=this.state,i=n._values[1],s=t.angle-i;let o=0;Math.abs(s)>270&&(o+=Math.sign(s)),this.computeValues([t.distance,t.angle-360*o]),n.origin=t.origin,n.turns=o,n._movement=[n._values[0]/n._initial[0]-1,n._values[1]-n._initial[1]],this.compute(e),this.emit()}touchEnd(e){this.ctrl.setEventIds(e),this.state._active&&this.state._touchIds.some(t=>!this.ctrl.touchIds.has(t))&&(this.state._active=!1,this.compute(e),this.emit())}pointerEnd(e){const t=this.state;this.ctrl.setEventIds(e);try{e.target.releasePointerCapture(e.pointerId)}catch{}t._pointerEvents.has(e.pointerId)&&t._pointerEvents.delete(e.pointerId),t._active&&t._pointerEvents.size<2&&(t._active=!1,this.compute(e),this.emit())}gestureStart(e){e.cancelable&&e.preventDefault();const t=this.state;t._active||(this.start(e),this.computeValues([e.scale,e.rotation]),t.origin=[e.clientX,e.clientY],this.compute(e),this.emit())}gestureMove(e){if(e.cancelable&&e.preventDefault(),!this.state._active)return;const t=this.state;this.computeValues([e.scale,e.rotation]),t.origin=[e.clientX,e.clientY];const n=t._movement;t._movement=[e.scale-1,e.rotation],t._delta=Tt.sub(t._movement,n),this.compute(e),this.emit()}gestureEnd(e){this.state._active&&(this.state._active=!1,this.compute(e),this.emit())}wheel(e){const t=this.config.modifierKey;t&&(Array.isArray(t)?!t.find(n=>e[n]):!e[t])||(this.state._active?this.wheelChange(e):this.wheelStart(e),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this)))}wheelStart(e){this.start(e),this.wheelChange(e)}wheelChange(e){"uv"in e||e.cancelable&&e.preventDefault();const n=this.state;n._delta=[-Fy(e)[1]/BS*n.offset[0],0],Tt.addTo(n._movement,n._delta),Gy(n),this.state.origin=[e.clientX,e.clientY],this.compute(e),this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){const t=this.config.device;t&&(e(t,"start",this[t+"Start"].bind(this)),e(t,"change",this[t+"Move"].bind(this)),e(t,"end",this[t+"End"].bind(this)),e(t,"cancel",this[t+"End"].bind(this)),e("lostPointerCapture","",this[t+"End"].bind(this))),this.config.pinchOnWheel&&e("wheel","",this.wheel.bind(this),{passive:!1})}}const VS=Ut(Ut({},zy),{},{device(r,e,{shared:t,pointer:{touch:n=!1}={}}){if(t.target&&!Qn.touch&&Qn.gesture)return"gesture";if(Qn.touch&&n)return"touch";if(Qn.touchscreen){if(Qn.pointer)return"pointer";if(Qn.touch)return"touch"}},bounds(r,e,{scaleBounds:t={},angleBounds:n={}}){const i=o=>{const a=Ng(gu(t,o),{min:-1/0,max:1/0});return[a.min,a.max]},s=o=>{const a=Ng(gu(n,o),{min:-1/0,max:1/0});return[a.min,a.max]};return typeof t!="function"&&typeof n!="function"?[i(),s()]:o=>[i(o),s(o)]},threshold(r,e,t){return this.lockDirection=t.axis==="lock",Tt.toVector(r,this.lockDirection?[.1,3]:0)},modifierKey(r){return r===void 0?"ctrlKey":r},pinchOnWheel(r=!0){return r}});class HS extends Ac{constructor(...e){super(...e),$t(this,"ingKey","moving")}move(e){this.config.mouseOnly&&e.pointerType!=="mouse"||(this.state._active?this.moveChange(e):this.moveStart(e),this.timeoutStore.add("moveEnd",this.moveEnd.bind(this)))}moveStart(e){this.start(e),this.computeValues(To(e)),this.compute(e),this.computeInitial(),this.emit()}moveChange(e){if(!this.state._active)return;const t=To(e),n=this.state;n._delta=Tt.sub(t,n._values),Tt.addTo(n._movement,n._delta),this.computeValues(t),this.compute(e),this.emit()}moveEnd(e){this.state._active&&(this.state._active=!1,this.compute(e),this.emit())}bind(e){e("pointer","change",this.move.bind(this)),e("pointer","leave",this.moveEnd.bind(this))}}const WS=Ut(Ut({},Es),{},{mouseOnly:(r=!0)=>r});class XS extends Ac{constructor(...e){super(...e),$t(this,"ingKey","scrolling")}scroll(e){this.state._active||this.start(e),this.scrollChange(e),this.timeoutStore.add("scrollEnd",this.scrollEnd.bind(this))}scrollChange(e){e.cancelable&&e.preventDefault();const t=this.state,n=_S(e);t._delta=Tt.sub(n,t._values),Tt.addTo(t._movement,t._delta),this.computeValues(n),this.compute(e),this.emit()}scrollEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){e("scroll","",this.scroll.bind(this))}}const qS=Es;class YS extends Ac{constructor(...e){super(...e),$t(this,"ingKey","wheeling")}wheel(e){this.state._active||this.start(e),this.wheelChange(e),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this))}wheelChange(e){const t=this.state;t._delta=Fy(e),Tt.addTo(t._movement,t._delta),Gy(t),this.compute(e),this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){e("wheel","",this.wheel.bind(this))}}const jS=Es;class $S extends Ac{constructor(...e){super(...e),$t(this,"ingKey","hovering")}enter(e){this.config.mouseOnly&&e.pointerType!=="mouse"||(this.start(e),this.computeValues(To(e)),this.compute(e),this.emit())}leave(e){if(this.config.mouseOnly&&e.pointerType!=="mouse")return;const t=this.state;if(!t._active)return;t._active=!1;const n=To(e);t._movement=t._delta=Tt.sub(n,t._values),this.computeValues(n),this.compute(e),t.delta=t.movement,this.emit()}bind(e){e("pointer","enter",this.enter.bind(this)),e("pointer","leave",this.leave.bind(this))}}const ZS=Ut(Ut({},Es),{},{mouseOnly:(r=!0)=>r}),Gp=new Map,Ld=new Map;function KS(r){Gp.set(r.key,r.engine),Ld.set(r.key,r.resolver)}const JS={key:"drag",engine:TS,resolver:kS},QS={key:"hover",engine:$S,resolver:ZS},eE={key:"move",engine:HS,resolver:WS},tE={key:"pinch",engine:GS,resolver:VS},nE={key:"scroll",engine:XS,resolver:qS},iE={key:"wheel",engine:YS,resolver:jS};function rE(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,s;for(s=0;s=0)&&(t[i]=r[i]);return t}function sE(r,e){if(r==null)return{};var t=rE(r,e),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(r);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}const oE={target(r){if(r)return()=>"current"in r?r.current:r},enabled(r=!0){return r},window(r=Qn.isBrowser?window:void 0){return r},eventOptions({passive:r=!0,capture:e=!1}={}){return{passive:r,capture:e}},transform(r){return r}},aE=["target","eventOptions","window","enabled","transform"];function nu(r={},e){const t={};for(const[n,i]of Object.entries(e))switch(typeof i){case"function":t[n]=i.call(t,r[n],n,r);break;case"object":t[n]=nu(r[n],i);break;case"boolean":i&&(t[n]=r[n]);break}return t}function cE(r,e,t={}){const n=r,{target:i,eventOptions:s,window:o,enabled:a,transform:c}=n,l=sE(n,aE);if(t.shared=nu({target:i,eventOptions:s,window:o,enabled:a,transform:c},oE),e){const u=Ld.get(e);t[e]=nu(Ut({shared:t.shared},l),u)}else for(const u in l){const h=Ld.get(u);h&&(t[u]=nu(Ut({shared:t.shared},l[u]),h))}return t}class Vy{constructor(e,t){$t(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=t}add(e,t,n,i,s){const o=this._listeners,a=pS(t,n),c=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},l=Ut(Ut({},c),s);e.addEventListener(a,i,l);const u=()=>{e.removeEventListener(a,i,l),o.delete(u)};return o.add(u),u}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class lE{constructor(){$t(this,"_timeouts",new Map)}add(e,t,n=140,...i){this.remove(e),this._timeouts.set(e,window.setTimeout(t,n,...i))}remove(e){const t=this._timeouts.get(e);t&&window.clearTimeout(t)}clean(){this._timeouts.forEach(e=>void window.clearTimeout(e)),this._timeouts.clear()}}let uE=class{constructor(e){$t(this,"gestures",new Set),$t(this,"_targetEventStore",new Vy(this)),$t(this,"gestureEventStores",{}),$t(this,"gestureTimeoutStores",{}),$t(this,"handlers",{}),$t(this,"config",{}),$t(this,"pointerIds",new Set),$t(this,"touchIds",new Set),$t(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),hE(this,e)}setEventIds(e){if(Du(e))return this.touchIds=new Set(vS(e)),this.touchIds;if("pointerId"in e)return e.type==="pointerup"||e.type==="pointercancel"?this.pointerIds.delete(e.pointerId):e.type==="pointerdown"&&this.pointerIds.add(e.pointerId),this.pointerIds}applyHandlers(e,t){this.handlers=e,this.nativeHandlers=t}applyConfig(e,t){this.config=cE(e,t,this.config)}clean(){this._targetEventStore.clean();for(const e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){const t=this.config.shared,n={};let i;if(!(t.target&&(i=t.target(),!i))){if(t.enabled){for(const o of this.gestures){const a=this.config[o],c=Bg(n,a.eventOptions,!!i);if(a.enabled){const l=Gp.get(o);new l(this,e,o).bind(c)}}const s=Bg(n,t.eventOptions,!!i);for(const o in this.nativeHandlers)s(o,"",a=>this.nativeHandlers[o](Ut(Ut({},this.state.shared),{},{event:a,args:e})),void 0,!0)}for(const s in n)n[s]=bS(...n[s]);if(!i)return n;for(const s in n){const{device:o,capture:a,passive:c}=dS(s);this._targetEventStore.add(i,o,"",n[s],{capture:a,passive:c})}}}};function Ds(r,e){r.gestures.add(e),r.gestureEventStores[e]=new Vy(r,e),r.gestureTimeoutStores[e]=new lE}function hE(r,e){e.drag&&Ds(r,"drag"),e.wheel&&Ds(r,"wheel"),e.scroll&&Ds(r,"scroll"),e.move&&Ds(r,"move"),e.pinch&&Ds(r,"pinch"),e.hover&&Ds(r,"hover")}const Bg=(r,e,t)=>(n,i,s,o={},a=!1)=>{var c,l;const u=(c=o.capture)!==null&&c!==void 0?c:e.capture,h=(l=o.passive)!==null&&l!==void 0?l:e.passive;let f=a?n:hS(n,i,u);t&&h&&(f+="Passive"),r[f]=r[f]||[],r[f].push(s)},fE=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function dE(r){const e={},t={},n=new Set;for(let i in r)fE.test(i)?(n.add(RegExp.lastMatch),t[i]=r[i]):e[i]=r[i];return[t,e,n]}function Is(r,e,t,n,i,s){if(!r.has(t)||!Gp.has(n))return;const o=t+"Start",a=t+"End",c=l=>{let u;return l.first&&o in e&&e[o](l),t in e&&(u=e[t](l)),l.last&&a in e&&e[a](l),u};i[n]=c,s[n]=s[n]||{}}function pE(r,e){const[t,n,i]=dE(r),s={};return Is(i,t,"onDrag","drag",s,e),Is(i,t,"onWheel","wheel",s,e),Is(i,t,"onScroll","scroll",s,e),Is(i,t,"onPinch","pinch",s,e),Is(i,t,"onMove","move",s,e),Is(i,t,"onHover","hover",s,e),{handlers:s,config:e,nativeHandlers:n}}function mE(r,e={},t,n){const i=Fh.useMemo(()=>new uE(r),[]);if(i.applyHandlers(r,n),i.applyConfig(e,t),Fh.useEffect(i.effect.bind(i)),Fh.useEffect(()=>i.clean.bind(i),[]),e.target===void 0)return i.bind.bind(i)}function gE(r){return r.forEach(KS),function(t,n){const{handlers:i,nativeHandlers:s,config:o}=pE(t,n||{});return mE(i,o,void 0,s)}}function vE(r,e){return gE([JS,tE,nE,iE,eE,QS])(r,e||{})}const Kc=(r,e)=>{const t=r[0].index!==null,n=new Set(Object.keys(r[0].attributes)),i=new Set(Object.keys(r[0].morphAttributes)),s={},o={},a=r[0].morphTargetsRelative,c=new Ww;let l=0;if(r.forEach((u,h)=>{let f=0;if(t!==(u.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let d in u.attributes){if(!n.has(d))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+'. All geometries must have compatible attributes; make sure "'+d+'" attribute exists among all geometries, or in none of them.'),null;s[d]===void 0&&(s[d]=[]),s[d].push(u.attributes[d]),f++}if(f!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". Make sure all geometries have the same number of attributes."),null;if(a!==u.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let d in u.morphAttributes){if(!i.has(d))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;o[d]===void 0&&(o[d]=[]),o[d].push(u.morphAttributes[d])}if(c.userData.mergedUserData=c.userData.mergedUserData||[],c.userData.mergedUserData.push(u.userData),e){let d;if(u.index)d=u.index.count;else if(u.attributes.position!==void 0)d=u.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;c.addGroup(l,d,h),l+=d}}),t){let u=0;const h=[];r.forEach(f=>{const d=f.index;for(let m=0;m{let e,t,n,i=0;if(r.forEach(s=>{if(e===void 0&&(e=s.array.constructor),e!==s.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=s.itemSize),t!==s.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=s.normalized),n!==s.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;i+=s.array.length}),e&&t){const s=new e(i);let o=0;return r.forEach(a=>{s.set(a.array,o),o+=a.array.length}),new Xw(s,t,n)}},zh=new qw,Bh=new _n,Us=new _n,ci=new _n,Gi=new _n,Ti=new _n,Vi=new _n,Hi=new _n,Jo=new _n,Qo=new _n,ea=new _n,Jc=new _n,ta=new _n,na=new _n,ia=new _n;class Vg{constructor(e,t,n){this.camera=e,this.scene=t,this.startPoint=new _n,this.endPoint=new _n,this.collection=[],this.deep=n||Number.MAX_VALUE}select(e,t){return this.startPoint=e||this.startPoint,this.endPoint=t||this.endPoint,this.collection=[],this.updateFrustum(this.startPoint,this.endPoint),this.searchChildInFrustum(zh,this.scene),this.collection}updateFrustum(e,t){if(e=e||this.startPoint,t=t||this.endPoint,e.x===t.x&&(t.x+=Number.EPSILON),e.y===t.y&&(t.y+=Number.EPSILON),this.camera.updateProjectionMatrix(),this.camera.updateMatrixWorld(),this.camera.isPerspectiveCamera){Us.copy(e),Us.x=Math.min(e.x,t.x),Us.y=Math.max(e.y,t.y),t.x=Math.max(e.x,t.x),t.y=Math.min(e.y,t.y),ci.setFromMatrixPosition(this.camera.matrixWorld),Gi.copy(Us),Ti.set(t.x,Us.y,0),Vi.copy(t),Hi.set(Us.x,t.y,0),Gi.unproject(this.camera),Ti.unproject(this.camera),Vi.unproject(this.camera),Hi.unproject(this.camera),ta.copy(Gi).sub(ci),na.copy(Ti).sub(ci),ia.copy(Vi).sub(ci),ta.normalize(),na.normalize(),ia.normalize(),ta.multiplyScalar(this.deep),na.multiplyScalar(this.deep),ia.multiplyScalar(this.deep),ta.add(ci),na.add(ci),ia.add(ci);var n=zh.planes;n[0].setFromCoplanarPoints(ci,Gi,Ti),n[1].setFromCoplanarPoints(ci,Ti,Vi),n[2].setFromCoplanarPoints(Vi,Hi,ci),n[3].setFromCoplanarPoints(Hi,Gi,ci),n[4].setFromCoplanarPoints(Ti,Vi,Hi),n[5].setFromCoplanarPoints(ia,na,ta),n[5].normal.multiplyScalar(-1)}else if(this.camera.isOrthographicCamera){const i=Math.min(e.x,t.x),s=Math.max(e.y,t.y),o=Math.max(e.x,t.x),a=Math.min(e.y,t.y);Gi.set(i,s,-1),Ti.set(o,s,-1),Vi.set(o,a,-1),Hi.set(i,a,-1),Jo.set(i,s,1),Qo.set(o,s,1),ea.set(o,a,1),Jc.set(i,a,1),Gi.unproject(this.camera),Ti.unproject(this.camera),Vi.unproject(this.camera),Hi.unproject(this.camera),Jo.unproject(this.camera),Qo.unproject(this.camera),ea.unproject(this.camera),Jc.unproject(this.camera);var n=zh.planes;n[0].setFromCoplanarPoints(Gi,Jo,Qo),n[1].setFromCoplanarPoints(Ti,Qo,ea),n[2].setFromCoplanarPoints(ea,Jc,Hi),n[3].setFromCoplanarPoints(Jc,Jo,Gi),n[4].setFromCoplanarPoints(Ti,Vi,Hi),n[5].setFromCoplanarPoints(ea,Qo,Jo),n[5].normal.multiplyScalar(-1)}else console.error("THREE.SelectionBox: Unsupported camera type.")}searchChildInFrustum(e,t){if((t.isMesh||t.isLine||t.isPoints)&&t.material!==void 0&&(t.geometry.boundingSphere===null&&t.geometry.computeBoundingSphere(),Bh.copy(t.geometry.boundingSphere.center),Bh.applyMatrix4(t.matrixWorld),e.containsPoint(Bh)&&this.collection.push(t)),t.children.length>0)for(let n=0;n0;)de[pe]=arguments[pe+2];var Me=xe[he]||(xe[he]=R.getUniformLocation(ce,he));R["uniform"+$].apply(R,[Me].concat(de))},setAttribute:function($,he,de,pe,Me){var we=fe[$];we||(we=fe[$]={buf:R.createBuffer(),loc:R.getAttribLocation(ce,$),data:null}),R.bindBuffer(R.ARRAY_BUFFER,we.buf),R.vertexAttribPointer(we.loc,he,R.FLOAT,!1,0,0),R.enableVertexAttribArray(we.loc),H?R.vertexAttribDivisor(we.loc,pe):ge("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(we.loc,pe),Me!==we.data&&(R.bufferData(R.ARRAY_BUFFER,Me,de),we.data=Me)}})}}}J[K].transaction(re)},D=function(K,W){ne++;try{R.activeTexture(R.TEXTURE0+ne);var ye=ie[K];ye||(ye=ie[K]=R.createTexture(),R.bindTexture(R.TEXTURE_2D,ye),R.texParameteri(R.TEXTURE_2D,R.TEXTURE_MIN_FILTER,R.NEAREST),R.texParameteri(R.TEXTURE_2D,R.TEXTURE_MAG_FILTER,R.NEAREST)),R.bindTexture(R.TEXTURE_2D,ye),W(ye,ne)}finally{ne--}},Q=function(K,W,ye){var re=R.createFramebuffer();ee.push(re),R.bindFramebuffer(R.FRAMEBUFFER,re),R.activeTexture(R.TEXTURE0+W),R.bindTexture(R.TEXTURE_2D,K),R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_2D,K,0);try{ye(re)}finally{R.deleteFramebuffer(re),R.bindFramebuffer(R.FRAMEBUFFER,ee[--ee.length-1]||null)}},j=function(){Y={},J={},ie={},ne=-1,ee.length=0};var H=typeof WebGL2RenderingContext<"u"&&R instanceof WebGL2RenderingContext,Y={},J={},ie={},ne=-1,ee=[];R.canvas.addEventListener("webglcontextlost",function(K){j(),K.preventDefault()},!1),c.set(R,F={gl:R,isWebGL2:H,getExtension:ge,withProgram:te,withTexture:D,withTextureFramebuffer:Q,handleContextLoss:j})}U(F)}function h(k,U,R,F,H,Y,J,ie){J===void 0&&(J=15),ie===void 0&&(ie=null),u(k,function(ne){var ee=ne.gl,ge=ne.withProgram,me=ne.withTexture;me("copy",function(te,D){ee.texImage2D(ee.TEXTURE_2D,0,ee.RGBA,H,Y,0,ee.RGBA,ee.UNSIGNED_BYTE,U),ge("copy",o,a,function(Q){var j=Q.setUniform,K=Q.setAttribute;K("aUV",2,ee.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),j("1i","image",D),ee.bindFramebuffer(ee.FRAMEBUFFER,ie||null),ee.disable(ee.BLEND),ee.colorMask(J&8,J&4,J&2,J&1),ee.viewport(R,F,H,Y),ee.scissor(R,F,H,Y),ee.drawArrays(ee.TRIANGLES,0,3)})})})}function f(k,U,R){var F=k.width,H=k.height;u(k,function(Y){var J=Y.gl,ie=new Uint8Array(F*H*4);J.readPixels(0,0,F,H,J.RGBA,J.UNSIGNED_BYTE,ie),k.width=U,k.height=R,h(J,ie,0,0,F,H)})}var d=Object.freeze({__proto__:null,withWebGLContext:u,renderImageData:h,resizeWebGLCanvasWithoutClearing:f});function m(k,U,R,F,H,Y){Y===void 0&&(Y=1);var J=new Uint8Array(k*U),ie=F[2]-F[0],ne=F[3]-F[1],ee=[];s(R,function(K,W,ye,re){ee.push({x1:K,y1:W,x2:ye,y2:re,minX:Math.min(K,ye),minY:Math.min(W,re),maxX:Math.max(K,ye),maxY:Math.max(W,re)})}),ee.sort(function(K,W){return K.maxX-W.maxX});for(var ge=0;gexe.minX&&W-rexe.minY){var ce=p(K,W,xe.x1,xe.y1,xe.x2,xe.y2);ceW!=fe.y2>W&&K<(fe.x2-fe.x1)*(W-fe.y1)/(fe.y2-fe.y1)+fe.x1;xe&&(ye+=fe.y1p.y!=seg.w>p.y)&&(p.x<(seg.z-seg.x)*(p.y-seg.y)/(seg.w-seg.y)+seg.x);bool crossingUp=crossing&&vLineSegment.y1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",canonical:"6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye"};function v(re,fe){var xe=36,ce=0,Pe=new Map,B=fe&&new Map,I;return re.split(",").forEach(function $(he){if(he.indexOf("+")!==-1)for(var de=+he;de--;)$(I);else{I=he;var pe=he.split(">"),Me=pe[0],we=pe[1];Me=String.fromCodePoint(ce+=parseInt(Me,xe)),we=String.fromCodePoint(ce+=parseInt(we,xe)),Pe.set(Me,we),fe&&B.set(we,Me)}}),{map:Pe,reverseMap:B}}var g,p,_;function y(){if(!g){var re=v(m.pairs,!0),fe=re.map,xe=re.reverseMap;g=fe,p=xe,_=v(m.canonical,!1).map}}function x(re){return y(),g.get(re)||null}function b(re){return y(),p.get(re)||null}function w(re){return y(),_.get(re)||null}var S=n.L,M=n.R,E=n.EN,T=n.ES,L=n.ET,P=n.AN,A=n.CS,z=n.B,V=n.S,N=n.ON,C=n.BN,O=n.NSM,k=n.AL,U=n.LRO,R=n.RLO,F=n.LRE,H=n.RLE,Y=n.PDF,J=n.LRI,ie=n.RLI,ne=n.FSI,ee=n.PDI;function ge(re,fe){for(var xe=125,ce=new Uint32Array(re.length),Pe=0;Pe0)De--;else if(je>0){for(Ve=0;!Le[Le.length-1]._isolate;)Le.pop();var tt=Le[Le.length-1]._isolInitIndex;tt!=null&&(he.set(tt,Z),he.set(Z,tt)),Le.pop(),je--}Ee=Le[Le.length-1],$[Z]=Ee._level,Ee._override&&I(Z,Ee._override)}else Ae&Y?(De===0&&(Ve>0?Ve--:!Ee._isolate&&Le.length>1&&(Le.pop(),Ee=Le[Le.length-1])),$[Z]=Ee._level):Ae&z&&($[Z]=pe.level);else $[Z]=Ee._level,Ee._override&&Ae!==C&&I(Z,Ee._override)}for(var lt=[],ft=null,ut=pe.start;ut<=pe.end;ut++){var xt=ce[ut];if(!(xt&c)){var dt=$[ut],ct=xt&s,Mn=xt===ee;ft&&dt===ft._level?(ft._end=ut,ft._endsWithIsolInit=ct):lt.push(ft={_start:ut,_end:ut,_level:dt,_startsWithPDI:Mn,_endsWithIsolInit:ct})}}for(var fn=[],yt=0;yt=0;se--)if(!(ce[se]&c)){ve=$[se];break}var _e=sn[sn.length-1],Ge=$[_e],We=pe.level;if(!(ce[_e]&s)){for(var qe=_e+1;qe<=pe.end;qe++)if(!(ce[qe]&c)){We=$[qe];break}}fn.push({_seqIndices:sn,_sosType:Math.max(ve,ae)%2?M:S,_eosType:Math.max(We,Ge)%2?M:S})}}for(var Ye=0;Ye=0;at--)if(!(ce[Te[at]]&c)){Ct=ce[Te[at]];break}I(Xn,Ct&(s|ee)?N:Ct)}}if(B.get(E))for(var fr=0;fr=-1;qn--){var Vo=qn===-1?Ze:ce[Te[qn]];if(Vo&o){Vo===k&&I(Wt,P);break}}}if(B.get(k))for(var Bi=0;Bi=0&&(Mi=ce[Te[zr]],!!(Mi&c));zr--);for(var Ho=Xt+1;Ho=0&&ce[Te[Hc]]&(L|c);Hc--)I(Te[Hc],E);for(On++;On=0&&ce[Te[Wc]]&c;Wc--)I(Te[Wc],N);for(var Xc=Wo+1;Xc=0;Yo--){var Rh=Ps[Yo].char;if(Rh===vg||Rh===b(w(qo))||x(w(Rh))===qo){qc.push([Ps[Yo].seqIndex,Ls]),Ps.length=Yo;break}}}qc.sort(function(Tn,ai){return Tn[0]-ai[0]})}for(var Ph=0;Ph=0;Ih--){var wg=Te[Ih];if(ce[wg]&gg){var Sg=ce[wg]&Xo?M:S;Sg!==bt?oi=Sg:oi=bt;break}}}if(oi){if(ce[Te[Yc]]=ce[Te[Lh]]=oi,oi!==bt){for(var jo=Yc+1;jo=0;Zo--)if(ce[Te[Zo]]&c)Eg=Zo;else{Oh=ce[Te[Zo]]&Xo?M:S;break}for(var Mg=At,Ko=dr+1;Ko=0&&f(re[$c])&l;$c--)$[$c]=pe.level}}return{levels:$,paragraphs:de};function Tg(Tn,ai){for(var An=Tn;An=$&&f(re[pe])&l;pe--)de[pe]=I.level;for(var Me=I.level,we=1/0,ue=0;ueMe&&(Me=Ce),Ce=we;ze--)for(var Le=0;Le=ze){for(var Ee=Le;Le+1=ze;)Le++;Le>Ee&&B.push([Ee+$,Le+$])}}}),B}function W(re,fe,xe,ce){var Pe=ye(re,fe,xe,ce),B=[].concat(re);return Pe.forEach(function(I,$){B[$]=(fe.levels[I]&1?Q(re[I]):null)||re[I]}),B.join("")}function ye(re,fe,xe,ce){for(var Pe=K(re,fe,xe,ce),B=[],I=0;Itypeof r=="object"&&typeof r.then=="function",Zc=[];function nS(r,e,t=(n,i)=>n===i){if(r===e)return!0;if(!r||!e)return!1;const n=r.length;if(e.length!==n)return!1;for(let i=0;i0&&(s.timeout&&clearTimeout(s.timeout),s.timeout=setTimeout(s.remove,n.lifespan)),s.response;if(!t)throw s.promise}const i={keys:e,equal:n.equal,remove:()=>{const s=Zc.indexOf(i);s!==-1&&Zc.splice(s,1)},promise:(tS(r)?r:r(...e)).then(s=>{i.response=s,n.lifespan&&n.lifespan>0&&(i.timeout=setTimeout(i.remove,n.lifespan))}).catch(s=>i.error=s)};if(Zc.push(i),!t)throw i.promise}const rS=(r,e,t)=>iS(r,e,!1,t);function sS(r,e,t){return Math.max(e,Math.min(r,t))}const Tt={toVector(r,e){return r===void 0&&(r=e),Array.isArray(r)?r:[r,r]},add(r,e){return[r[0]+e[0],r[1]+e[1]]},sub(r,e){return[r[0]-e[0],r[1]-e[1]]},addTo(r,e){r[0]+=e[0],r[1]+=e[1]},subTo(r,e){r[0]-=e[0],r[1]-=e[1]}};function Rg(r,e,t){return e===0||Math.abs(e)===1/0?Math.pow(r,t*5):r*e*t/(e+t*r)}function Pg(r,e,t,n=.15){return n===0?sS(r,e,t):rt?+Rg(r-t,t-e,n)+t:r}function oS(r,[e,t],[n,i]){const[[s,o],[a,c]]=r;return[Pg(e,s,o,n),Pg(t,a,c,i)]}function aS(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function cS(r){var e=aS(r,"string");return typeof e=="symbol"?e:String(e)}function $t(r,e,t){return e=cS(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Lg(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ut(r){for(var e=1;e{var t,n;return e.target===r.currentTarget||((t=r.currentTarget)===null||t===void 0||(n=t.contains)===null||n===void 0?void 0:n.call(t,e.target))})}function gS(r){return r.type==="touchend"||r.type==="touchcancel"?r.changedTouches:r.targetTouches}function Ny(r){return Du(r)?gS(r)[0]:r}function Pd(r,e){try{const t=e.clientX-r.clientX,n=e.clientY-r.clientY,i=(e.clientX+r.clientX)/2,s=(e.clientY+r.clientY)/2,o=Math.hypot(t,n);return{angle:-(Math.atan2(t,n)*180)/Math.PI,distance:o,origin:[i,s]}}catch{}return null}function vS(r){return mS(r).map(e=>e.identifier)}function Ig(r,e){const[t,n]=Array.from(r.touches).filter(i=>e.includes(i.identifier));return Pd(t,n)}function kh(r){const e=Ny(r);return Du(r)?e.identifier:e.pointerId}function To(r){const e=Ny(r);return[e.clientX,e.clientY]}const Ug=40,Og=800;function Fy(r){let{deltaX:e,deltaY:t,deltaMode:n}=r;return n===1?(e*=Ug,t*=Ug):n===2&&(e*=Og,t*=Og),[e,t]}function _S(r){var e,t;const{scrollX:n,scrollY:i,scrollLeft:s,scrollTop:o}=r.currentTarget;return[(e=n??s)!==null&&e!==void 0?e:0,(t=i??o)!==null&&t!==void 0?t:0]}function yS(r){const e={};if("buttons"in r&&(e.buttons=r.buttons),"shiftKey"in r){const{shiftKey:t,altKey:n,metaKey:i,ctrlKey:s}=r;Object.assign(e,{shiftKey:t,altKey:n,metaKey:i,ctrlKey:s})}return e}function gu(r,...e){return typeof r=="function"?r(...e):r}function xS(){}function bS(...r){return r.length===0?xS:r.length===1?r[0]:function(){let e;for(const t of r)e=t.apply(this,arguments)||e;return e}}function Ng(r,e){return Object.assign({},e,r||{})}const wS=32;class ky{constructor(e,t,n){this.ctrl=e,this.args=t,this.key=n,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:e,shared:t,ingKey:n,args:i}=this;t[n]=e._active=e.active=e._blocked=e._force=!1,e._step=[!1,!1],e.intentional=!1,e._movement=[0,0],e._distance=[0,0],e._direction=[0,0],e._delta=[0,0],e._bounds=[[-1/0,1/0],[-1/0,1/0]],e.args=i,e.axis=void 0,e.memo=void 0,e.elapsedTime=e.timeDelta=0,e.direction=[0,0],e.distance=[0,0],e.overflow=[0,0],e._movementBound=[!1,!1],e.velocity=[0,0],e.movement=[0,0],e.delta=[0,0],e.timeStamp=0}start(e){const t=this.state,n=this.config;t._active||(this.reset(),this.computeInitial(),t._active=!0,t.target=e.target,t.currentTarget=e.currentTarget,t.lastOffset=n.from?gu(n.from,t):t.offset,t.offset=t.lastOffset,t.startTime=t.timeStamp=e.timeStamp)}computeValues(e){const t=this.state;t._values=e,t.values=this.config.transform(e)}computeInitial(){const e=this.state;e._initial=e._values,e.initial=e.values}compute(e){const{state:t,config:n,shared:i}=this;t.args=this.args;let s=0;if(e&&(t.event=e,n.preventDefault&&e.cancelable&&t.event.preventDefault(),t.type=e.type,i.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,i.locked=!!document.pointerLockElement,Object.assign(i,yS(e)),i.down=i.pressed=i.buttons%2===1||i.touches>0,s=e.timeStamp-t.timeStamp,t.timeStamp=e.timeStamp,t.elapsedTime=t.timeStamp-t.startTime),t._active){const w=t._delta.map(Math.abs);Tt.addTo(t._distance,w)}this.axisIntent&&this.axisIntent(e);const[o,a]=t._movement,[c,l]=n.threshold,{_step:u,values:h}=t;if(n.hasCustomTransform?(u[0]===!1&&(u[0]=Math.abs(o)>=c&&h[0]),u[1]===!1&&(u[1]=Math.abs(a)>=l&&h[1])):(u[0]===!1&&(u[0]=Math.abs(o)>=c&&Math.sign(o)*c),u[1]===!1&&(u[1]=Math.abs(a)>=l&&Math.sign(a)*l)),t.intentional=u[0]!==!1||u[1]!==!1,!t.intentional)return;const f=[0,0];if(n.hasCustomTransform){const[w,S]=h;f[0]=u[0]!==!1?w-u[0]:0,f[1]=u[1]!==!1?S-u[1]:0}else f[0]=u[0]!==!1?o-u[0]:0,f[1]=u[1]!==!1?a-u[1]:0;this.restrictToAxis&&!t._blocked&&this.restrictToAxis(f);const d=t.offset,m=t._active&&!t._blocked||t.active;m&&(t.first=t._active&&!t.active,t.last=!t._active&&t.active,t.active=i[this.ingKey]=t._active,e&&(t.first&&("bounds"in n&&(t._bounds=gu(n.bounds,t)),this.setup&&this.setup()),t.movement=f,this.computeOffset()));const[v,g]=t.offset,[[p,_],[y,x]]=t._bounds;t.overflow=[v_?1:0,gx?1:0],t._movementBound[0]=t.overflow[0]?t._movementBound[0]===!1?t._movement[0]:t._movementBound[0]:!1,t._movementBound[1]=t.overflow[1]?t._movementBound[1]===!1?t._movement[1]:t._movementBound[1]:!1;const b=t._active?n.rubberband||[0,0]:[0,0];if(t.offset=oS(t._bounds,t.offset,b),t.delta=Tt.sub(t.offset,d),this.computeMovement(),m&&(!t.last||s>wS)){t.delta=Tt.sub(t.offset,d);const w=t.delta.map(Math.abs);Tt.addTo(t.distance,w),t.direction=t.delta.map(Math.sign),t._direction=t._delta.map(Math.sign),!t.first&&s>0&&(t.velocity=[w[0]/s,w[1]/s],t.timeDelta=s)}}emit(){const e=this.state,t=this.shared,n=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!n.triggerAllEvents)return;const i=this.handler(Ut(Ut(Ut({},t),e),{},{[this.aliasKey]:e.values}));i!==void 0&&(e.memo=i)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function SS([r,e],t){const n=Math.abs(r),i=Math.abs(e);if(n>i&&n>t)return"x";if(i>n&&i>t)return"y"}class Ac extends ky{constructor(...e){super(...e),$t(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=Tt.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=Tt.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){const t=this.state,n=this.config;if(!t.axis&&e){const i=typeof n.axisThreshold=="object"?n.axisThreshold[Oy(e)]:n.axisThreshold;t.axis=SS(t._movement,i)}t._blocked=(n.lockDirection||!!n.axis)&&!t.axis||!!n.axis&&n.axis!==t.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":e[1]=0;break;case"y":e[0]=0;break}}}const ES=r=>r,Fg=.15,zy={enabled(r=!0){return r},eventOptions(r,e,t){return Ut(Ut({},t.shared.eventOptions),r)},preventDefault(r=!1){return r},triggerAllEvents(r=!1){return r},rubberband(r=0){switch(r){case!0:return[Fg,Fg];case!1:return[0,0];default:return Tt.toVector(r)}},from(r){if(typeof r=="function")return r;if(r!=null)return Tt.toVector(r)},transform(r,e,t){const n=r||t.shared.transform;return this.hasCustomTransform=!!n,n||ES},threshold(r){return Tt.toVector(r,0)}},MS=0,Es=Ut(Ut({},zy),{},{axis(r,e,{axis:t}){if(this.lockDirection=t==="lock",!this.lockDirection)return t},axisThreshold(r=MS){return r},bounds(r={}){if(typeof r=="function")return s=>Es.bounds(r(s));if("current"in r)return()=>r.current;if(typeof HTMLElement=="function"&&r instanceof HTMLElement)return r;const{left:e=-1/0,right:t=1/0,top:n=-1/0,bottom:i=1/0}=r;return[[e,t],[n,i]]}}),kg={ArrowRight:(r,e=1)=>[r*e,0],ArrowLeft:(r,e=1)=>[-1*r*e,0],ArrowUp:(r,e=1)=>[0,-1*r*e],ArrowDown:(r,e=1)=>[0,r*e]};class TS extends Ac{constructor(...e){super(...e),$t(this,"ingKey","dragging")}reset(){super.reset();const e=this.state;e._pointerId=void 0,e._pointerActive=!1,e._keyboardActive=!1,e._preventScroll=!1,e._delayed=!1,e.swipe=[0,0],e.tap=!1,e.canceled=!1,e.cancel=this.cancel.bind(this)}setup(){const e=this.state;if(e._bounds instanceof HTMLElement){const t=e._bounds.getBoundingClientRect(),n=e.currentTarget.getBoundingClientRect(),i={left:t.left-n.left+e.offset[0],right:t.right-n.right+e.offset[0],top:t.top-n.top+e.offset[1],bottom:t.bottom-n.bottom+e.offset[1]};e._bounds=Es.bounds(i)}}cancel(){const e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){const t=this.config,n=this.state;if(e.buttons!=null&&(Array.isArray(t.pointerButtons)?!t.pointerButtons.includes(e.buttons):t.pointerButtons!==-1&&t.pointerButtons!==e.buttons))return;const i=this.ctrl.setEventIds(e);t.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(i&&i.size>1&&n._pointerActive)&&(this.start(e),this.setupPointer(e),n._pointerId=kh(e),n._pointerActive=!0,this.computeValues(To(e)),this.computeInitial(),t.preventScrollAxis&&Oy(e)!=="mouse"?(n._active=!1,this.setupScrollPrevention(e)):t.delay>0?(this.setupDelayTrigger(e),t.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){const t=this.state;t._active=!0,t._preventScroll=!0,t._delayed=!1,this.compute(e),this.emit()}pointerMove(e){const t=this.state,n=this.config;if(!t._pointerActive)return;const i=kh(e);if(t._pointerId!==void 0&&i!==t._pointerId)return;const s=To(e);if(document.pointerLockElement===e.target?t._delta=[e.movementX,e.movementY]:(t._delta=Tt.sub(s,t._values),this.computeValues(s)),Tt.addTo(t._movement,t._delta),this.compute(e),t._delayed&&t.intentional){this.timeoutStore.remove("dragDelay"),t.active=!1,this.startPointerDrag(e);return}if(n.preventScrollAxis&&!t._preventScroll)if(t.axis)if(t.axis===n.preventScrollAxis||n.preventScrollAxis==="xy"){t._active=!1,this.clean();return}else{this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(e);return}else return;this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch{}const t=this.state,n=this.config;if(!t._active||!t._pointerActive)return;const i=kh(e);if(t._pointerId!==void 0&&i!==t._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);const[s,o]=t._distance;if(t.tap=s<=n.tapsThreshold&&o<=n.tapsThreshold,t.tap&&n.filterTaps)t._force=!0;else{const[a,c]=t._delta,[l,u]=t._movement,[h,f]=n.swipe.velocity,[d,m]=n.swipe.distance,v=n.swipe.duration;if(t.elapsedTimeh&&Math.abs(l)>d&&(t.swipe[0]=Math.sign(a)),p>f&&Math.abs(u)>m&&(t.swipe[1]=Math.sign(c))}}this.emit()}pointerClick(e){!this.state.tap&&e.detail>0&&(e.preventDefault(),e.stopPropagation())}setupPointer(e){const t=this.config,n=t.device;t.pointerLock&&e.currentTarget.requestPointerLock(),t.pointerCapture||(this.eventStore.add(this.sharedConfig.window,n,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,n,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,n,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,AS(e);const t=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",t),this.eventStore.add(this.sharedConfig.window,"touch","cancel",t),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,e)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){const t=kg[e.key];if(t){const n=this.state,i=e.shiftKey?10:e.altKey?.1:1;this.start(e),n._delta=t(this.config.keyboardDisplacement,i),n._keyboardActive=!0,Tt.addTo(n._movement,n._delta),this.compute(e),this.emit()}}keyUp(e){e.key in kg&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){const t=this.config.device;e(t,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(e(t,"change",this.pointerMove.bind(this)),e(t,"end",this.pointerUp.bind(this)),e(t,"cancel",this.pointerUp.bind(this)),e("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(e("key","down",this.keyDown.bind(this)),e("key","up",this.keyUp.bind(this))),this.config.filterTaps&&e("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}}function AS(r){"persist"in r&&typeof r.persist=="function"&&r.persist()}const Cc=typeof window<"u"&&window.document&&window.document.createElement;function By(){return Cc&&"ontouchstart"in window}function CS(){return By()||Cc&&window.navigator.maxTouchPoints>1}function RS(){return Cc&&"onpointerdown"in window}function PS(){return Cc&&"exitPointerLock"in window.document}function LS(){try{return"constructor"in GestureEvent}catch{return!1}}const Qn={isBrowser:Cc,gesture:LS(),touch:By(),touchscreen:CS(),pointer:RS(),pointerLock:PS()},DS=250,IS=180,US=.5,OS=50,NS=250,FS=10,zg={mouse:0,touch:0,pen:8},kS=Ut(Ut({},Es),{},{device(r,e,{pointer:{touch:t=!1,lock:n=!1,mouse:i=!1}={}}){return this.pointerLock=n&&Qn.pointerLock,Qn.touch&&t?"touch":this.pointerLock?"mouse":Qn.pointer&&!i?"pointer":Qn.touch?"touch":"mouse"},preventScrollAxis(r,e,{preventScroll:t}){if(this.preventScrollDelay=typeof t=="number"?t:t||t===void 0&&r?DS:void 0,!(!Qn.touchscreen||t===!1))return r||(t!==void 0?"y":void 0)},pointerCapture(r,e,{pointer:{capture:t=!0,buttons:n=1,keys:i=!0}={}}){return this.pointerButtons=n,this.keys=i,!this.pointerLock&&this.device==="pointer"&&t},threshold(r,e,{filterTaps:t=!1,tapsThreshold:n=3,axis:i=void 0}){const s=Tt.toVector(r,t?n:i?1:0);return this.filterTaps=t,this.tapsThreshold=n,s},swipe({velocity:r=US,distance:e=OS,duration:t=NS}={}){return{velocity:this.transform(Tt.toVector(r)),distance:this.transform(Tt.toVector(e)),duration:t}},delay(r=0){switch(r){case!0:return IS;case!1:return 0;default:return r}},axisThreshold(r){return r?Ut(Ut({},zg),r):zg},keyboardDisplacement(r=FS){return r}});function Gy(r){const[e,t]=r.overflow,[n,i]=r._delta,[s,o]=r._direction;(e<0&&n>0&&s<0||e>0&&n<0&&s>0)&&(r._movement[0]=r._movementBound[0]),(t<0&&i>0&&o<0||t>0&&i<0&&o>0)&&(r._movement[1]=r._movementBound[1])}const zS=30,BS=100;class GS extends ky{constructor(...e){super(...e),$t(this,"ingKey","pinching"),$t(this,"aliasKey","da")}init(){this.state.offset=[1,0],this.state.lastOffset=[1,0],this.state._pointerEvents=new Map}reset(){super.reset();const e=this.state;e._touchIds=[],e.canceled=!1,e.cancel=this.cancel.bind(this),e.turns=0}computeOffset(){const{type:e,movement:t,lastOffset:n}=this.state;e==="wheel"?this.state.offset=Tt.add(t,n):this.state.offset=[(1+t[0])*n[0],t[1]+n[1]]}computeMovement(){const{offset:e,lastOffset:t}=this.state;this.state.movement=[e[0]/t[0],e[1]-t[1]]}axisIntent(){const e=this.state,[t,n]=e._movement;if(!e.axis){const i=Math.abs(t)*zS-Math.abs(n);i<0?e.axis="angle":i>0&&(e.axis="scale")}}restrictToAxis(e){this.config.lockDirection&&(this.state.axis==="scale"?e[1]=0:this.state.axis==="angle"&&(e[0]=0))}cancel(){const e=this.state;e.canceled||setTimeout(()=>{e.canceled=!0,e._active=!1,this.compute(),this.emit()},0)}touchStart(e){this.ctrl.setEventIds(e);const t=this.state,n=this.ctrl.touchIds;if(t._active&&t._touchIds.every(s=>n.has(s))||n.size<2)return;this.start(e),t._touchIds=Array.from(n).slice(0,2);const i=Ig(e,t._touchIds);i&&this.pinchStart(e,i)}pointerStart(e){if(e.buttons!=null&&e.buttons%2!==1)return;this.ctrl.setEventIds(e),e.target.setPointerCapture(e.pointerId);const t=this.state,n=t._pointerEvents,i=this.ctrl.pointerIds;if(t._active&&Array.from(n.keys()).every(o=>i.has(o))||(n.size<2&&n.set(e.pointerId,e),t._pointerEvents.size<2))return;this.start(e);const s=Pd(...Array.from(n.values()));s&&this.pinchStart(e,s)}pinchStart(e,t){const n=this.state;n.origin=t.origin,this.computeValues([t.distance,t.angle]),this.computeInitial(),this.compute(e),this.emit()}touchMove(e){if(!this.state._active)return;const t=Ig(e,this.state._touchIds);t&&this.pinchMove(e,t)}pointerMove(e){const t=this.state._pointerEvents;if(t.has(e.pointerId)&&t.set(e.pointerId,e),!this.state._active)return;const n=Pd(...Array.from(t.values()));n&&this.pinchMove(e,n)}pinchMove(e,t){const n=this.state,i=n._values[1],s=t.angle-i;let o=0;Math.abs(s)>270&&(o+=Math.sign(s)),this.computeValues([t.distance,t.angle-360*o]),n.origin=t.origin,n.turns=o,n._movement=[n._values[0]/n._initial[0]-1,n._values[1]-n._initial[1]],this.compute(e),this.emit()}touchEnd(e){this.ctrl.setEventIds(e),this.state._active&&this.state._touchIds.some(t=>!this.ctrl.touchIds.has(t))&&(this.state._active=!1,this.compute(e),this.emit())}pointerEnd(e){const t=this.state;this.ctrl.setEventIds(e);try{e.target.releasePointerCapture(e.pointerId)}catch{}t._pointerEvents.has(e.pointerId)&&t._pointerEvents.delete(e.pointerId),t._active&&t._pointerEvents.size<2&&(t._active=!1,this.compute(e),this.emit())}gestureStart(e){e.cancelable&&e.preventDefault();const t=this.state;t._active||(this.start(e),this.computeValues([e.scale,e.rotation]),t.origin=[e.clientX,e.clientY],this.compute(e),this.emit())}gestureMove(e){if(e.cancelable&&e.preventDefault(),!this.state._active)return;const t=this.state;this.computeValues([e.scale,e.rotation]),t.origin=[e.clientX,e.clientY];const n=t._movement;t._movement=[e.scale-1,e.rotation],t._delta=Tt.sub(t._movement,n),this.compute(e),this.emit()}gestureEnd(e){this.state._active&&(this.state._active=!1,this.compute(e),this.emit())}wheel(e){const t=this.config.modifierKey;t&&(Array.isArray(t)?!t.find(n=>e[n]):!e[t])||(this.state._active?this.wheelChange(e):this.wheelStart(e),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this)))}wheelStart(e){this.start(e),this.wheelChange(e)}wheelChange(e){"uv"in e||e.cancelable&&e.preventDefault();const n=this.state;n._delta=[-Fy(e)[1]/BS*n.offset[0],0],Tt.addTo(n._movement,n._delta),Gy(n),this.state.origin=[e.clientX,e.clientY],this.compute(e),this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){const t=this.config.device;t&&(e(t,"start",this[t+"Start"].bind(this)),e(t,"change",this[t+"Move"].bind(this)),e(t,"end",this[t+"End"].bind(this)),e(t,"cancel",this[t+"End"].bind(this)),e("lostPointerCapture","",this[t+"End"].bind(this))),this.config.pinchOnWheel&&e("wheel","",this.wheel.bind(this),{passive:!1})}}const VS=Ut(Ut({},zy),{},{device(r,e,{shared:t,pointer:{touch:n=!1}={}}){if(t.target&&!Qn.touch&&Qn.gesture)return"gesture";if(Qn.touch&&n)return"touch";if(Qn.touchscreen){if(Qn.pointer)return"pointer";if(Qn.touch)return"touch"}},bounds(r,e,{scaleBounds:t={},angleBounds:n={}}){const i=o=>{const a=Ng(gu(t,o),{min:-1/0,max:1/0});return[a.min,a.max]},s=o=>{const a=Ng(gu(n,o),{min:-1/0,max:1/0});return[a.min,a.max]};return typeof t!="function"&&typeof n!="function"?[i(),s()]:o=>[i(o),s(o)]},threshold(r,e,t){return this.lockDirection=t.axis==="lock",Tt.toVector(r,this.lockDirection?[.1,3]:0)},modifierKey(r){return r===void 0?"ctrlKey":r},pinchOnWheel(r=!0){return r}});class HS extends Ac{constructor(...e){super(...e),$t(this,"ingKey","moving")}move(e){this.config.mouseOnly&&e.pointerType!=="mouse"||(this.state._active?this.moveChange(e):this.moveStart(e),this.timeoutStore.add("moveEnd",this.moveEnd.bind(this)))}moveStart(e){this.start(e),this.computeValues(To(e)),this.compute(e),this.computeInitial(),this.emit()}moveChange(e){if(!this.state._active)return;const t=To(e),n=this.state;n._delta=Tt.sub(t,n._values),Tt.addTo(n._movement,n._delta),this.computeValues(t),this.compute(e),this.emit()}moveEnd(e){this.state._active&&(this.state._active=!1,this.compute(e),this.emit())}bind(e){e("pointer","change",this.move.bind(this)),e("pointer","leave",this.moveEnd.bind(this))}}const WS=Ut(Ut({},Es),{},{mouseOnly:(r=!0)=>r});class XS extends Ac{constructor(...e){super(...e),$t(this,"ingKey","scrolling")}scroll(e){this.state._active||this.start(e),this.scrollChange(e),this.timeoutStore.add("scrollEnd",this.scrollEnd.bind(this))}scrollChange(e){e.cancelable&&e.preventDefault();const t=this.state,n=_S(e);t._delta=Tt.sub(n,t._values),Tt.addTo(t._movement,t._delta),this.computeValues(n),this.compute(e),this.emit()}scrollEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){e("scroll","",this.scroll.bind(this))}}const qS=Es;class YS extends Ac{constructor(...e){super(...e),$t(this,"ingKey","wheeling")}wheel(e){this.state._active||this.start(e),this.wheelChange(e),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this))}wheelChange(e){const t=this.state;t._delta=Fy(e),Tt.addTo(t._movement,t._delta),Gy(t),this.compute(e),this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){e("wheel","",this.wheel.bind(this))}}const jS=Es;class $S extends Ac{constructor(...e){super(...e),$t(this,"ingKey","hovering")}enter(e){this.config.mouseOnly&&e.pointerType!=="mouse"||(this.start(e),this.computeValues(To(e)),this.compute(e),this.emit())}leave(e){if(this.config.mouseOnly&&e.pointerType!=="mouse")return;const t=this.state;if(!t._active)return;t._active=!1;const n=To(e);t._movement=t._delta=Tt.sub(n,t._values),this.computeValues(n),this.compute(e),t.delta=t.movement,this.emit()}bind(e){e("pointer","enter",this.enter.bind(this)),e("pointer","leave",this.leave.bind(this))}}const ZS=Ut(Ut({},Es),{},{mouseOnly:(r=!0)=>r}),Gp=new Map,Ld=new Map;function KS(r){Gp.set(r.key,r.engine),Ld.set(r.key,r.resolver)}const JS={key:"drag",engine:TS,resolver:kS},QS={key:"hover",engine:$S,resolver:ZS},eE={key:"move",engine:HS,resolver:WS},tE={key:"pinch",engine:GS,resolver:VS},nE={key:"scroll",engine:XS,resolver:qS},iE={key:"wheel",engine:YS,resolver:jS};function rE(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,s;for(s=0;s=0)&&(t[i]=r[i]);return t}function sE(r,e){if(r==null)return{};var t=rE(r,e),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(r);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}const oE={target(r){if(r)return()=>"current"in r?r.current:r},enabled(r=!0){return r},window(r=Qn.isBrowser?window:void 0){return r},eventOptions({passive:r=!0,capture:e=!1}={}){return{passive:r,capture:e}},transform(r){return r}},aE=["target","eventOptions","window","enabled","transform"];function nu(r={},e){const t={};for(const[n,i]of Object.entries(e))switch(typeof i){case"function":t[n]=i.call(t,r[n],n,r);break;case"object":t[n]=nu(r[n],i);break;case"boolean":i&&(t[n]=r[n]);break}return t}function cE(r,e,t={}){const n=r,{target:i,eventOptions:s,window:o,enabled:a,transform:c}=n,l=sE(n,aE);if(t.shared=nu({target:i,eventOptions:s,window:o,enabled:a,transform:c},oE),e){const u=Ld.get(e);t[e]=nu(Ut({shared:t.shared},l),u)}else for(const u in l){const h=Ld.get(u);h&&(t[u]=nu(Ut({shared:t.shared},l[u]),h))}return t}class Vy{constructor(e,t){$t(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=t}add(e,t,n,i,s){const o=this._listeners,a=pS(t,n),c=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},l=Ut(Ut({},c),s);e.addEventListener(a,i,l);const u=()=>{e.removeEventListener(a,i,l),o.delete(u)};return o.add(u),u}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class lE{constructor(){$t(this,"_timeouts",new Map)}add(e,t,n=140,...i){this.remove(e),this._timeouts.set(e,window.setTimeout(t,n,...i))}remove(e){const t=this._timeouts.get(e);t&&window.clearTimeout(t)}clean(){this._timeouts.forEach(e=>void window.clearTimeout(e)),this._timeouts.clear()}}let uE=class{constructor(e){$t(this,"gestures",new Set),$t(this,"_targetEventStore",new Vy(this)),$t(this,"gestureEventStores",{}),$t(this,"gestureTimeoutStores",{}),$t(this,"handlers",{}),$t(this,"config",{}),$t(this,"pointerIds",new Set),$t(this,"touchIds",new Set),$t(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),hE(this,e)}setEventIds(e){if(Du(e))return this.touchIds=new Set(vS(e)),this.touchIds;if("pointerId"in e)return e.type==="pointerup"||e.type==="pointercancel"?this.pointerIds.delete(e.pointerId):e.type==="pointerdown"&&this.pointerIds.add(e.pointerId),this.pointerIds}applyHandlers(e,t){this.handlers=e,this.nativeHandlers=t}applyConfig(e,t){this.config=cE(e,t,this.config)}clean(){this._targetEventStore.clean();for(const e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){const t=this.config.shared,n={};let i;if(!(t.target&&(i=t.target(),!i))){if(t.enabled){for(const o of this.gestures){const a=this.config[o],c=Bg(n,a.eventOptions,!!i);if(a.enabled){const l=Gp.get(o);new l(this,e,o).bind(c)}}const s=Bg(n,t.eventOptions,!!i);for(const o in this.nativeHandlers)s(o,"",a=>this.nativeHandlers[o](Ut(Ut({},this.state.shared),{},{event:a,args:e})),void 0,!0)}for(const s in n)n[s]=bS(...n[s]);if(!i)return n;for(const s in n){const{device:o,capture:a,passive:c}=dS(s);this._targetEventStore.add(i,o,"",n[s],{capture:a,passive:c})}}}};function Ds(r,e){r.gestures.add(e),r.gestureEventStores[e]=new Vy(r,e),r.gestureTimeoutStores[e]=new lE}function hE(r,e){e.drag&&Ds(r,"drag"),e.wheel&&Ds(r,"wheel"),e.scroll&&Ds(r,"scroll"),e.move&&Ds(r,"move"),e.pinch&&Ds(r,"pinch"),e.hover&&Ds(r,"hover")}const Bg=(r,e,t)=>(n,i,s,o={},a=!1)=>{var c,l;const u=(c=o.capture)!==null&&c!==void 0?c:e.capture,h=(l=o.passive)!==null&&l!==void 0?l:e.passive;let f=a?n:hS(n,i,u);t&&h&&(f+="Passive"),r[f]=r[f]||[],r[f].push(s)},fE=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function dE(r){const e={},t={},n=new Set;for(let i in r)fE.test(i)?(n.add(RegExp.lastMatch),t[i]=r[i]):e[i]=r[i];return[t,e,n]}function Is(r,e,t,n,i,s){if(!r.has(t)||!Gp.has(n))return;const o=t+"Start",a=t+"End",c=l=>{let u;return l.first&&o in e&&e[o](l),t in e&&(u=e[t](l)),l.last&&a in e&&e[a](l),u};i[n]=c,s[n]=s[n]||{}}function pE(r,e){const[t,n,i]=dE(r),s={};return Is(i,t,"onDrag","drag",s,e),Is(i,t,"onWheel","wheel",s,e),Is(i,t,"onScroll","scroll",s,e),Is(i,t,"onPinch","pinch",s,e),Is(i,t,"onMove","move",s,e),Is(i,t,"onHover","hover",s,e),{handlers:s,config:e,nativeHandlers:n}}function mE(r,e={},t,n){const i=Fh.useMemo(()=>new uE(r),[]);if(i.applyHandlers(r,n),i.applyConfig(e,t),Fh.useEffect(i.effect.bind(i)),Fh.useEffect(()=>i.clean.bind(i),[]),e.target===void 0)return i.bind.bind(i)}function gE(r){return r.forEach(KS),function(t,n){const{handlers:i,nativeHandlers:s,config:o}=pE(t,n||{});return mE(i,o,void 0,s)}}function vE(r,e){return gE([JS,tE,nE,iE,eE,QS])(r,e||{})}const Kc=(r,e)=>{const t=r[0].index!==null,n=new Set(Object.keys(r[0].attributes)),i=new Set(Object.keys(r[0].morphAttributes)),s={},o={},a=r[0].morphTargetsRelative,c=new Ww;let l=0;if(r.forEach((u,h)=>{let f=0;if(t!==(u.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let d in u.attributes){if(!n.has(d))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+'. All geometries must have compatible attributes; make sure "'+d+'" attribute exists among all geometries, or in none of them.'),null;s[d]===void 0&&(s[d]=[]),s[d].push(u.attributes[d]),f++}if(f!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". Make sure all geometries have the same number of attributes."),null;if(a!==u.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let d in u.morphAttributes){if(!i.has(d))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;o[d]===void 0&&(o[d]=[]),o[d].push(u.morphAttributes[d])}if(c.userData.mergedUserData=c.userData.mergedUserData||[],c.userData.mergedUserData.push(u.userData),e){let d;if(u.index)d=u.index.count;else if(u.attributes.position!==void 0)d=u.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;c.addGroup(l,d,h),l+=d}}),t){let u=0;const h=[];r.forEach(f=>{const d=f.index;for(let m=0;m{let e,t,n,i=0;if(r.forEach(s=>{if(e===void 0&&(e=s.array.constructor),e!==s.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=s.itemSize),t!==s.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=s.normalized),n!==s.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;i+=s.array.length}),e&&t){const s=new e(i);let o=0;return r.forEach(a=>{s.set(a.array,o),o+=a.array.length}),new Xw(s,t,n)}},zh=new qw,Bh=new _n,Us=new _n,ci=new _n,Gi=new _n,Ti=new _n,Vi=new _n,Hi=new _n,Jo=new _n,Qo=new _n,ea=new _n,Jc=new _n,ta=new _n,na=new _n,ia=new _n;class Vg{constructor(e,t,n){this.camera=e,this.scene=t,this.startPoint=new _n,this.endPoint=new _n,this.collection=[],this.deep=n||Number.MAX_VALUE}select(e,t){return this.startPoint=e||this.startPoint,this.endPoint=t||this.endPoint,this.collection=[],this.updateFrustum(this.startPoint,this.endPoint),this.searchChildInFrustum(zh,this.scene),this.collection}updateFrustum(e,t){if(e=e||this.startPoint,t=t||this.endPoint,e.x===t.x&&(t.x+=Number.EPSILON),e.y===t.y&&(t.y+=Number.EPSILON),this.camera.updateProjectionMatrix(),this.camera.updateMatrixWorld(),this.camera.isPerspectiveCamera){Us.copy(e),Us.x=Math.min(e.x,t.x),Us.y=Math.max(e.y,t.y),t.x=Math.max(e.x,t.x),t.y=Math.min(e.y,t.y),ci.setFromMatrixPosition(this.camera.matrixWorld),Gi.copy(Us),Ti.set(t.x,Us.y,0),Vi.copy(t),Hi.set(Us.x,t.y,0),Gi.unproject(this.camera),Ti.unproject(this.camera),Vi.unproject(this.camera),Hi.unproject(this.camera),ta.copy(Gi).sub(ci),na.copy(Ti).sub(ci),ia.copy(Vi).sub(ci),ta.normalize(),na.normalize(),ia.normalize(),ta.multiplyScalar(this.deep),na.multiplyScalar(this.deep),ia.multiplyScalar(this.deep),ta.add(ci),na.add(ci),ia.add(ci);var n=zh.planes;n[0].setFromCoplanarPoints(ci,Gi,Ti),n[1].setFromCoplanarPoints(ci,Ti,Vi),n[2].setFromCoplanarPoints(Vi,Hi,ci),n[3].setFromCoplanarPoints(Hi,Gi,ci),n[4].setFromCoplanarPoints(Ti,Vi,Hi),n[5].setFromCoplanarPoints(ia,na,ta),n[5].normal.multiplyScalar(-1)}else if(this.camera.isOrthographicCamera){const i=Math.min(e.x,t.x),s=Math.max(e.y,t.y),o=Math.max(e.x,t.x),a=Math.min(e.y,t.y);Gi.set(i,s,-1),Ti.set(o,s,-1),Vi.set(o,a,-1),Hi.set(i,a,-1),Jo.set(i,s,1),Qo.set(o,s,1),ea.set(o,a,1),Jc.set(i,a,1),Gi.unproject(this.camera),Ti.unproject(this.camera),Vi.unproject(this.camera),Hi.unproject(this.camera),Jo.unproject(this.camera),Qo.unproject(this.camera),ea.unproject(this.camera),Jc.unproject(this.camera);var n=zh.planes;n[0].setFromCoplanarPoints(Gi,Jo,Qo),n[1].setFromCoplanarPoints(Ti,Qo,ea),n[2].setFromCoplanarPoints(ea,Jc,Hi),n[3].setFromCoplanarPoints(Jc,Jo,Gi),n[4].setFromCoplanarPoints(Ti,Vi,Hi),n[5].setFromCoplanarPoints(ea,Qo,Jo),n[5].normal.multiplyScalar(-1)}else console.error("THREE.SelectionBox: Unsupported camera type.")}searchChildInFrustum(e,t){if((t.isMesh||t.isLine||t.isPoints)&&t.material!==void 0&&(t.geometry.boundingSphere===null&&t.geometry.computeBoundingSphere(),Bh.copy(t.geometry.boundingSphere.center),Bh.applyMatrix4(t.matrixWorld),e.containsPoint(Bh)&&this.collection.push(t)),t.children.length>0)for(let n=0;n0;)de[pe]=arguments[pe+2];var Me=xe[he]||(xe[he]=R.getUniformLocation(ce,he));R["uniform"+$].apply(R,[Me].concat(de))},setAttribute:function($,he,de,pe,Me){var we=fe[$];we||(we=fe[$]={buf:R.createBuffer(),loc:R.getAttribLocation(ce,$),data:null}),R.bindBuffer(R.ARRAY_BUFFER,we.buf),R.vertexAttribPointer(we.loc,he,R.FLOAT,!1,0,0),R.enableVertexAttribArray(we.loc),H?R.vertexAttribDivisor(we.loc,pe):ge("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(we.loc,pe),Me!==we.data&&(R.bufferData(R.ARRAY_BUFFER,Me,de),we.data=Me)}})}}}J[K].transaction(re)},D=function(K,W){ne++;try{R.activeTexture(R.TEXTURE0+ne);var ye=ie[K];ye||(ye=ie[K]=R.createTexture(),R.bindTexture(R.TEXTURE_2D,ye),R.texParameteri(R.TEXTURE_2D,R.TEXTURE_MIN_FILTER,R.NEAREST),R.texParameteri(R.TEXTURE_2D,R.TEXTURE_MAG_FILTER,R.NEAREST)),R.bindTexture(R.TEXTURE_2D,ye),W(ye,ne)}finally{ne--}},Q=function(K,W,ye){var re=R.createFramebuffer();ee.push(re),R.bindFramebuffer(R.FRAMEBUFFER,re),R.activeTexture(R.TEXTURE0+W),R.bindTexture(R.TEXTURE_2D,K),R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_2D,K,0);try{ye(re)}finally{R.deleteFramebuffer(re),R.bindFramebuffer(R.FRAMEBUFFER,ee[--ee.length-1]||null)}},j=function(){Y={},J={},ie={},ne=-1,ee.length=0};var H=typeof WebGL2RenderingContext<"u"&&R instanceof WebGL2RenderingContext,Y={},J={},ie={},ne=-1,ee=[];R.canvas.addEventListener("webglcontextlost",function(K){j(),K.preventDefault()},!1),c.set(R,F={gl:R,isWebGL2:H,getExtension:ge,withProgram:te,withTexture:D,withTextureFramebuffer:Q,handleContextLoss:j})}U(F)}function h(k,U,R,F,H,Y,J,ie){J===void 0&&(J=15),ie===void 0&&(ie=null),u(k,function(ne){var ee=ne.gl,ge=ne.withProgram,me=ne.withTexture;me("copy",function(te,D){ee.texImage2D(ee.TEXTURE_2D,0,ee.RGBA,H,Y,0,ee.RGBA,ee.UNSIGNED_BYTE,U),ge("copy",o,a,function(Q){var j=Q.setUniform,K=Q.setAttribute;K("aUV",2,ee.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),j("1i","image",D),ee.bindFramebuffer(ee.FRAMEBUFFER,ie||null),ee.disable(ee.BLEND),ee.colorMask(J&8,J&4,J&2,J&1),ee.viewport(R,F,H,Y),ee.scissor(R,F,H,Y),ee.drawArrays(ee.TRIANGLES,0,3)})})})}function f(k,U,R){var F=k.width,H=k.height;u(k,function(Y){var J=Y.gl,ie=new Uint8Array(F*H*4);J.readPixels(0,0,F,H,J.RGBA,J.UNSIGNED_BYTE,ie),k.width=U,k.height=R,h(J,ie,0,0,F,H)})}var d=Object.freeze({__proto__:null,withWebGLContext:u,renderImageData:h,resizeWebGLCanvasWithoutClearing:f});function m(k,U,R,F,H,Y){Y===void 0&&(Y=1);var J=new Uint8Array(k*U),ie=F[2]-F[0],ne=F[3]-F[1],ee=[];s(R,function(K,W,ye,re){ee.push({x1:K,y1:W,x2:ye,y2:re,minX:Math.min(K,ye),minY:Math.min(W,re),maxX:Math.max(K,ye),maxY:Math.max(W,re)})}),ee.sort(function(K,W){return K.maxX-W.maxX});for(var ge=0;gexe.minX&&W-rexe.minY){var ce=p(K,W,xe.x1,xe.y1,xe.x2,xe.y2);ceW!=fe.y2>W&&K<(fe.x2-fe.x1)*(W-fe.y1)/(fe.y2-fe.y1)+fe.x1;xe&&(ye+=fe.y1p.y!=seg.w>p.y)&&(p.x<(seg.z-seg.x)*(p.y-seg.y)/(seg.w-seg.y)+seg.x);bool crossingUp=crossing&&vLineSegment.y1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",canonical:"6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye"};function v(re,fe){var xe=36,ce=0,Pe=new Map,B=fe&&new Map,I;return re.split(",").forEach(function $(he){if(he.indexOf("+")!==-1)for(var de=+he;de--;)$(I);else{I=he;var pe=he.split(">"),Me=pe[0],we=pe[1];Me=String.fromCodePoint(ce+=parseInt(Me,xe)),we=String.fromCodePoint(ce+=parseInt(we,xe)),Pe.set(Me,we),fe&&B.set(we,Me)}}),{map:Pe,reverseMap:B}}var g,p,_;function y(){if(!g){var re=v(m.pairs,!0),fe=re.map,xe=re.reverseMap;g=fe,p=xe,_=v(m.canonical,!1).map}}function x(re){return y(),g.get(re)||null}function b(re){return y(),p.get(re)||null}function w(re){return y(),_.get(re)||null}var S=n.L,M=n.R,E=n.EN,T=n.ES,L=n.ET,P=n.AN,A=n.CS,z=n.B,V=n.S,N=n.ON,C=n.BN,O=n.NSM,k=n.AL,U=n.LRO,R=n.RLO,F=n.LRE,H=n.RLE,Y=n.PDF,J=n.LRI,ie=n.RLI,ne=n.FSI,ee=n.PDI;function ge(re,fe){for(var xe=125,ce=new Uint32Array(re.length),Pe=0;Pe0)De--;else if(je>0){for(Ve=0;!Le[Le.length-1]._isolate;)Le.pop();var tt=Le[Le.length-1]._isolInitIndex;tt!=null&&(he.set(tt,Z),he.set(Z,tt)),Le.pop(),je--}Ee=Le[Le.length-1],$[Z]=Ee._level,Ee._override&&I(Z,Ee._override)}else Ae&Y?(De===0&&(Ve>0?Ve--:!Ee._isolate&&Le.length>1&&(Le.pop(),Ee=Le[Le.length-1])),$[Z]=Ee._level):Ae&z&&($[Z]=pe.level);else $[Z]=Ee._level,Ee._override&&Ae!==C&&I(Z,Ee._override)}for(var lt=[],ft=null,ut=pe.start;ut<=pe.end;ut++){var xt=ce[ut];if(!(xt&c)){var dt=$[ut],ct=xt&s,Mn=xt===ee;ft&&dt===ft._level?(ft._end=ut,ft._endsWithIsolInit=ct):lt.push(ft={_start:ut,_end:ut,_level:dt,_startsWithPDI:Mn,_endsWithIsolInit:ct})}}for(var fn=[],yt=0;yt=0;se--)if(!(ce[se]&c)){ve=$[se];break}var _e=sn[sn.length-1],Ge=$[_e],We=pe.level;if(!(ce[_e]&s)){for(var qe=_e+1;qe<=pe.end;qe++)if(!(ce[qe]&c)){We=$[qe];break}}fn.push({_seqIndices:sn,_sosType:Math.max(ve,ae)%2?M:S,_eosType:Math.max(We,Ge)%2?M:S})}}for(var Ye=0;Ye=0;at--)if(!(ce[Te[at]]&c)){Ct=ce[Te[at]];break}I(Xn,Ct&(s|ee)?N:Ct)}}if(B.get(E))for(var fr=0;fr=-1;qn--){var Vo=qn===-1?Ze:ce[Te[qn]];if(Vo&o){Vo===k&&I(Wt,P);break}}}if(B.get(k))for(var Bi=0;Bi=0&&(Mi=ce[Te[zr]],!!(Mi&c));zr--);for(var Ho=Xt+1;Ho=0&&ce[Te[Hc]]&(L|c);Hc--)I(Te[Hc],E);for(On++;On=0&&ce[Te[Wc]]&c;Wc--)I(Te[Wc],N);for(var Xc=Wo+1;Xc=0;Yo--){var Rh=Ps[Yo].char;if(Rh===vg||Rh===b(w(qo))||x(w(Rh))===qo){qc.push([Ps[Yo].seqIndex,Ls]),Ps.length=Yo;break}}}qc.sort(function(Tn,ai){return Tn[0]-ai[0]})}for(var Ph=0;Ph=0;Ih--){var wg=Te[Ih];if(ce[wg]&gg){var Sg=ce[wg]&Xo?M:S;Sg!==bt?oi=Sg:oi=bt;break}}}if(oi){if(ce[Te[Yc]]=ce[Te[Lh]]=oi,oi!==bt){for(var jo=Yc+1;jo=0;Zo--)if(ce[Te[Zo]]&c)Eg=Zo;else{Oh=ce[Te[Zo]]&Xo?M:S;break}for(var Mg=At,Ko=dr+1;Ko=0&&f(re[$c])&l;$c--)$[$c]=pe.level}}return{levels:$,paragraphs:de};function Tg(Tn,ai){for(var An=Tn;An=$&&f(re[pe])&l;pe--)de[pe]=I.level;for(var Me=I.level,we=1/0,ue=0;ueMe&&(Me=Ce),Ce=we;ze--)for(var Le=0;Le=ze){for(var Ee=Le;Le+1=ze;)Le++;Le>Ee&&B.push([Ee+$,Le+$])}}}),B}function W(re,fe,xe,ce){var Pe=ye(re,fe,xe,ce),B=[].concat(re);return Pe.forEach(function(I,$){B[$]=(fe.levels[I]&1?Q(re[I]):null)||re[I]}),B.join("")}function ye(re,fe,xe,ce){for(var Pe=K(re,fe,xe,ce),B=[],I=0;I{throw TypeError(t)};var SW=(t,e,n)=>e in `+$+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 A=De}Reflect.construct(u,[],h)}else{try{h.call()}catch(De){A=De}u.call(h.prototype)}else{try{throw Error()}catch(De){A=De}u()}}catch(De){if(De&&A&&typeof De.stack=="string"){for(var I=De.stack.split(` `),j=A.stack.split(` `),G=I.length-1,se=j.length-1;1<=G&&0<=se&&I[G]!==j[se];)se--;for(;1<=G&&0<=se;G--,se--)if(I[G]!==j[se]){if(G!==1||se!==1)do if(G--,se--,0>se||I[G]!==j[se]){var he=` -`+I[G].replace(" at new "," at ");return u.displayName&&he.includes("")&&(he=he.replace("",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 L: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 U: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),A=""+u[h];if(!u.hasOwnProperty(h)&&typeof b<"u"&&typeof b.get=="function"&&typeof b.set=="function"){var I=b.get,j=b.set;return Object.defineProperty(u,h,{configurable:!0,get:function(){return I.call(this)},set:function(G){A=""+G,j.call(this,G)}}),Object.defineProperty(u,h,{enumerable:b.enumerable}),{getValue:function(){return A},setValue:function(G){A=""+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(),A="";return u&&(A=Me(u)?u.checked?"true":"false":u.value),u=A,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 je(u,h){var b=h.defaultValue==null?"":h.defaultValue,A=h.checked!=null?h.checked:h.defaultChecked;b=$e(h.value!=null?h.value:b),u._wrapperState={initialChecked:A,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),A=h.type;if(b!=null)A==="number"?(b===0&&u.value===""||u.value!=b)&&(u.value=""+b):u.value!==""+b&&(u.value=""+b);else if(A==="submit"||A==="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 A=h.type;if(!(A!=="submit"&&A!=="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,A){if(u=u.options,h){h={};for(var I=0;I"+h.valueOf().toString()+"",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 jt(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 A=b.indexOf("--")===0,I=jt(b,h[b],A);b==="float"&&(b="cssFloat"),A?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>>=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 A=0,I=u.suspendedLanes,j=u.pingedLanes,G=b&268435455;if(G!==0){var se=G&~I;se!==0?A=Is(se):(j&=G,j!==0&&(A=Is(j)))}else G=b&~I,G!==0?A=Is(G):j!==0&&(A=Is(j));if(A===0)return 0;if(h!==0&&h!==A&&(h&I)===0&&(I=A&-A,j=h&-h,I>=j||I===16&&(j&4194240)!==0))return h;if((A&4)!==0&&(A|=b&16),h=u.entangledLanes,h!==0)for(u=u.entanglements,h&=A;0b;b++)h.push(u);return h}function Ya(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 bM(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 A=u.eventTimes;for(u=u.expirationTimes;0=qr),Us=" ",mv=!1;function gv(u,h){switch(u){case"keyup":return pv.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 el=!1;function Ex(u,h){switch(u){case"compositionend":return xp(h);case"keypress":return h.which!==32?null:(mv=!0,Us);case"textInput":return u=h.data,u===Us&&mv?null:u;default:return null}}function Hd(u,h){if(el)return u==="compositionend"||!Ci&&gv(u,h)?(u=zd(),Wi=lv=to=null,el=!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)return{node:b,offset:h-u};u=A}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 jr(u){var h=nr(),b=u.focusedElem,A=u.selectionRange;if(h!==b&&b&&b.ownerDocument&&ec(b.ownerDocument.documentElement,b)){if(A!==null&&Dr(b)){if(h=A.start,u=A.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,j=Math.min(A.start,I);A=A.end===void 0?j:Math.min(A.end,I),!u.extend&&j>A&&(I=A,A=j,j=I),I=fs(b,j);var G=fs(b,A);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(),j>A?(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=document.documentMode,No=null,tc=null,Gd=null,Ur=!1;function Mp(u,h,b){var A=b.window===b?b.document:b.nodeType===9?b:b.ownerDocument;Ur||No==null||No!==Q(A)||(A=No,"selectionStart"in A&&Dr(A)?A={start:A.selectionStart,end:A.selectionEnd}:(A=(A.ownerDocument&&A.ownerDocument.defaultView||window).getSelection(),A={anchorNode:A.anchorNode,anchorOffset:A.anchorOffset,focusNode:A.focusNode,focusOffset:A.focusOffset}),Gd&&Jl(Gd,A)||(Gd=A,A=Np(tc,"onSelect"),0Fr||(u.current=Cv[Fr],Cv[Fr]=null,Fr--)}function Gn(u,h){Fr++,Cv[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 A=u.stateNode;if(A&&A.__reactInternalMemoizedUnmaskedChildContext===h)return A.__reactInternalMemoizedMaskedChildContext;var I={},j;for(j in b)I[j]=h[j];return A&&(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 Pv(u,h,b){if(Kr.current!==ma)throw Error(n(168));Gn(Kr,h),Gn(Pi,b)}function Jd(u,h,b){var A=u.stateNode;if(h=h.childContextTypes,typeof A.getChildContext!="function")return b;A=A.getChildContext();for(var I in A)if(!(I in h))throw Error(n(108,Se(u)||"Unknown",I));return q({},b,A)}function oc(u){return u=(u=u.stateNode)&&u.__reactInternalMemoizedMergedChildContext||ma,ga=Kr.current,Gn(Kr,u),Gn(Pi,Pi.current),!0}function Rv(u,h,b){var A=u.stateNode;if(!A)throw Error(n(169));b?(u=Jd(u,h,ga),A.__reactInternalMemoizedMergedChildContext=u,$n(Pi),$n(Kr),Gn(Kr,u)):$n(Pi),Gn(Pi,b)}var so=null,ef=!1,jp=!1;function tf(u){so===null?so=[u]:so.push(u)}function kx(u){ef=!0,tf(u)}function ko(){if(!jp&&so!==null){jp=!0;var u=0,h=Pn;try{var b=so;for(Pn=1;u>=G,I-=G,ct=1<<32-mt(h)+I|b<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=j(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(;tntn?(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=j(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=j(Dn,ve,tn),Vt===null?Ot=Dn:Vt.sibling=Dn,Vt=Dn);return qn&&va(Pe,tn),Ot}for(Gt=A(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=j(Dn,ve,tn),Vt===null?Ot=Dn:Vt.sibling=Dn,Vt=Dn);return u&&Gt.forEach(function(_W){return h(Pe,_W)}),qn&&va(Pe,tn),Ot}function Ir(Pe,ve,Ne,it){if(typeof Ne=="object"&&Ne!==null&&Ne.type===L&&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===L){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&&Dv(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===L?(ve=_f(Ne.props.children,Pe.mode,it,Ne.key),ve.return=Pe,Pe=ve):(it=nb(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=WM(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=GM(Ne,Pe.mode,it),ve.return=Pe,Pe=ve),G(Pe)):b(Pe,ve)}return Ir}var cc=jv(!0),sf=jv(!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 A=u.alternate;if((u.childLanes&h)!==h?(u.childLanes|=h,A!==null&&(A.childLanes|=h)):A!==null&&(A.childLanes&h)!==h&&(A.childLanes|=h),u===b)break;u=u.return}}function ol(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,A){var I=h.interleaved;return I===null?(b.next=b,Uv(h)):(b.next=I.next,I.next=b),h.interleaved=b,oo(u,A)}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 A=u.updateQueue;if(A===null)return null;if(A=A.shared,(On&2)!==0){var I=A.pending;return I===null?h.next=h:(h.next=I.next,I.next=h),A.pending=h,oo(u,b)}return I=A.interleaved,I===null?(h.next=h,Uv(A)):(h.next=I.next,I.next=h),A.interleaved=h,oo(u,b)}function di(u,h,b){if(h=h.updateQueue,h!==null&&(h=h.shared,(b&4194240)!==0)){var A=h.lanes;A&=u.pendingLanes,b|=A,h.lanes=b,fu(u,b)}}function hc(u,h){var b=u.updateQueue,A=u.alternate;if(A!==null&&(A=A.updateQueue,b===A)){var I=null,j=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};j===null?I=j=G:j=j.next=G,b=b.next}while(b!==null);j===null?I=j=h:j=j.next=h}else I=j=h;b={baseState:A.baseState,firstBaseUpdate:I,lastBaseUpdate:j,shared:A.shared,effects:A.effects},u.updateQueue=b;return}u=b.lastBaseUpdate,u===null?b.firstBaseUpdate=h:u.next=h,b.lastBaseUpdate=h}function lr(u,h,b,A){var I=u.updateQueue;Fn=!1;var j=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?j=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(j!==null){var Je=I.baseState;G=0,Ze=De=he=null,se=j;do{var Ye=se.lane,_t=se.eventTime;if((A&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 j===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;hb?b:4,u(!0);var A=vc.transition;vc.transition={};try{u(!1),h()}finally{Pn=b,vc.transition=A}}function Ma(){return gs().memoizedState}function $p(u,h,b){var A=zu(u);if(b={lane:A,action:b,hasEagerState:!1,eagerState:null,next:null},mf(u))Xp(h,b);else if(b=lf(u,h,b,A),b!==null){var I=xs();Ca(b,u,A,I),qp(b,h,A)}}function yc(u,h,b){var A=zu(u),I={lane:A,action:b,hasEagerState:!1,eagerState:null,next:null};if(mf(u))Xp(h,I);else{var j=u.alternate;if(u.lanes===0&&(j===null||j.lanes===0)&&(j=h.lastRenderedReducer,j!==null))try{var G=h.lastRenderedState,se=j(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,A),b!==null&&(I=xs(),Ca(b,u,A,I),qp(b,h,A))}}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 A=h.lanes;A&=u.pendingLanes,b|=A,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},zx={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,Do(4194308,4,Ux.bind(null,h,u),b)},useLayoutEffect:function(u,h){return Do(4194308,4,u,h)},useInsertionEffect:function(u,h){return Do(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 A=Qr();return h=b!==void 0?b(h):h,A.memoizedState=A.baseState=h,u={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:h},A.queue=u,u=u.dispatch=$p.bind(null,Xn,u),[A.memoizedState,u]},useRef:function(u){var h=Qr();return u={current:u},h.memoizedState=u},useState:Vv,useDebugValue:Gp,useDeferredValue:function(u){return Qr().memoizedState=u},useTransition:function(){var u=Vv(!1),h=u[0];return u=AM.bind(null,u[1]),Qr().memoizedState=u,[h,u]},useMutableSource:function(){},useSyncExternalStore:function(u,h,b){var A=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(A,h,b)}I.memoizedState=b;var j={value:b,getSnapshot:h};return I.queue=j,Ii(Ox.bind(null,A,j,u),[u]),A.flags|=2048,co(9,hf.bind(null,A,j,b,h),void 0,null),b},useId:function(){var u=Qr(),h=hi.identifierPrefix;if(qn){var b=Fs,A=ct;b=(A&~(1<<32-mt(A)-1)).toString(32)+b,h=":"+h+"R"+b,b=ll++,0")&&(he=he.replace("",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 L: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 U: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),A=""+u[h];if(!u.hasOwnProperty(h)&&typeof b<"u"&&typeof b.get=="function"&&typeof b.set=="function"){var I=b.get,j=b.set;return Object.defineProperty(u,h,{configurable:!0,get:function(){return I.call(this)},set:function(G){A=""+G,j.call(this,G)}}),Object.defineProperty(u,h,{enumerable:b.enumerable}),{getValue:function(){return A},setValue:function(G){A=""+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(),A="";return u&&(A=Me(u)?u.checked?"true":"false":u.value),u=A,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 je(u,h){var b=h.defaultValue==null?"":h.defaultValue,A=h.checked!=null?h.checked:h.defaultChecked;b=$e(h.value!=null?h.value:b),u._wrapperState={initialChecked:A,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),A=h.type;if(b!=null)A==="number"?(b===0&&u.value===""||u.value!=b)&&(u.value=""+b):u.value!==""+b&&(u.value=""+b);else if(A==="submit"||A==="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 A=h.type;if(!(A!=="submit"&&A!=="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,A){if(u=u.options,h){h={};for(var I=0;I"+h.valueOf().toString()+"",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 jt(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 A=b.indexOf("--")===0,I=jt(b,h[b],A);b==="float"&&(b="cssFloat"),A?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>>=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 A=0,I=u.suspendedLanes,j=u.pingedLanes,G=b&268435455;if(G!==0){var se=G&~I;se!==0?A=Is(se):(j&=G,j!==0&&(A=Is(j)))}else G=b&~I,G!==0?A=Is(G):j!==0&&(A=Is(j));if(A===0)return 0;if(h!==0&&h!==A&&(h&I)===0&&(I=A&-A,j=h&-h,I>=j||I===16&&(j&4194240)!==0))return h;if((A&4)!==0&&(A|=b&16),h=u.entangledLanes,h!==0)for(u=u.entanglements,h&=A;0b;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 bM(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 A=u.eventTimes;for(u=u.expirationTimes;0=qr),Us=" ",mv=!1;function gv(u,h){switch(u){case"keyup":return pv.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 Ex(u,h){switch(u){case"compositionend":return xp(h);case"keypress":return h.which!==32?null:(mv=!0,Us);case"textInput":return u=h.data,u===Us&&mv?null:u;default:return null}}function Hd(u,h){if(tl)return u==="compositionend"||!Ci&&gv(u,h)?(u=zd(),Wi=lv=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)return{node:b,offset:h-u};u=A}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 jr(u){var h=nr(),b=u.focusedElem,A=u.selectionRange;if(h!==b&&b&&b.ownerDocument&&ec(b.ownerDocument.documentElement,b)){if(A!==null&&Dr(b)){if(h=A.start,u=A.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,j=Math.min(A.start,I);A=A.end===void 0?j:Math.min(A.end,I),!u.extend&&j>A&&(I=A,A=j,j=I),I=fs(b,j);var G=fs(b,A);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(),j>A?(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=document.documentMode,No=null,tc=null,Gd=null,Ur=!1;function Mp(u,h,b){var A=b.window===b?b.document:b.nodeType===9?b:b.ownerDocument;Ur||No==null||No!==Q(A)||(A=No,"selectionStart"in A&&Dr(A)?A={start:A.selectionStart,end:A.selectionEnd}:(A=(A.ownerDocument&&A.ownerDocument.defaultView||window).getSelection(),A={anchorNode:A.anchorNode,anchorOffset:A.anchorOffset,focusNode:A.focusNode,focusOffset:A.focusOffset}),Gd&&Jl(Gd,A)||(Gd=A,A=Np(tc,"onSelect"),0Fr||(u.current=Cv[Fr],Cv[Fr]=null,Fr--)}function Gn(u,h){Fr++,Cv[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 A=u.stateNode;if(A&&A.__reactInternalMemoizedUnmaskedChildContext===h)return A.__reactInternalMemoizedMaskedChildContext;var I={},j;for(j in b)I[j]=h[j];return A&&(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 Pv(u,h,b){if(Kr.current!==ma)throw Error(n(168));Gn(Kr,h),Gn(Pi,b)}function Jd(u,h,b){var A=u.stateNode;if(h=h.childContextTypes,typeof A.getChildContext!="function")return b;A=A.getChildContext();for(var I in A)if(!(I in h))throw Error(n(108,Se(u)||"Unknown",I));return q({},b,A)}function oc(u){return u=(u=u.stateNode)&&u.__reactInternalMemoizedMergedChildContext||ma,ga=Kr.current,Gn(Kr,u),Gn(Pi,Pi.current),!0}function Rv(u,h,b){var A=u.stateNode;if(!A)throw Error(n(169));b?(u=Jd(u,h,ga),A.__reactInternalMemoizedMergedChildContext=u,$n(Pi),$n(Kr),Gn(Kr,u)):$n(Pi),Gn(Pi,b)}var so=null,ef=!1,jp=!1;function tf(u){so===null?so=[u]:so.push(u)}function kx(u){ef=!0,tf(u)}function ko(){if(!jp&&so!==null){jp=!0;var u=0,h=Pn;try{var b=so;for(Pn=1;u>=G,I-=G,ct=1<<32-mt(h)+I|b<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=j(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(;tntn?(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=j(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=j(Dn,ve,tn),Vt===null?Ot=Dn:Vt.sibling=Dn,Vt=Dn);return qn&&va(Pe,tn),Ot}for(Gt=A(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=j(Dn,ve,tn),Vt===null?Ot=Dn:Vt.sibling=Dn,Vt=Dn);return u&&Gt.forEach(function(_W){return h(Pe,_W)}),qn&&va(Pe,tn),Ot}function Ir(Pe,ve,Ne,it){if(typeof Ne=="object"&&Ne!==null&&Ne.type===L&&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===L){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&&Dv(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===L?(ve=_f(Ne.props.children,Pe.mode,it,Ne.key),ve.return=Pe,Pe=ve):(it=nb(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=WM(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=GM(Ne,Pe.mode,it),ve.return=Pe,Pe=ve),G(Pe)):b(Pe,ve)}return Ir}var cc=jv(!0),sf=jv(!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 A=u.alternate;if((u.childLanes&h)!==h?(u.childLanes|=h,A!==null&&(A.childLanes|=h)):A!==null&&(A.childLanes&h)!==h&&(A.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,A){var I=h.interleaved;return I===null?(b.next=b,Uv(h)):(b.next=I.next,I.next=b),h.interleaved=b,oo(u,A)}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 A=u.updateQueue;if(A===null)return null;if(A=A.shared,(On&2)!==0){var I=A.pending;return I===null?h.next=h:(h.next=I.next,I.next=h),A.pending=h,oo(u,b)}return I=A.interleaved,I===null?(h.next=h,Uv(A)):(h.next=I.next,I.next=h),A.interleaved=h,oo(u,b)}function di(u,h,b){if(h=h.updateQueue,h!==null&&(h=h.shared,(b&4194240)!==0)){var A=h.lanes;A&=u.pendingLanes,b|=A,h.lanes=b,fu(u,b)}}function hc(u,h){var b=u.updateQueue,A=u.alternate;if(A!==null&&(A=A.updateQueue,b===A)){var I=null,j=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};j===null?I=j=G:j=j.next=G,b=b.next}while(b!==null);j===null?I=j=h:j=j.next=h}else I=j=h;b={baseState:A.baseState,firstBaseUpdate:I,lastBaseUpdate:j,shared:A.shared,effects:A.effects},u.updateQueue=b;return}u=b.lastBaseUpdate,u===null?b.firstBaseUpdate=h:u.next=h,b.lastBaseUpdate=h}function lr(u,h,b,A){var I=u.updateQueue;Fn=!1;var j=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?j=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(j!==null){var Je=I.baseState;G=0,Ze=De=he=null,se=j;do{var Ye=se.lane,_t=se.eventTime;if((A&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 j===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;hb?b:4,u(!0);var A=vc.transition;vc.transition={};try{u(!1),h()}finally{Pn=b,vc.transition=A}}function Ma(){return gs().memoizedState}function $p(u,h,b){var A=zu(u);if(b={lane:A,action:b,hasEagerState:!1,eagerState:null,next:null},mf(u))Xp(h,b);else if(b=lf(u,h,b,A),b!==null){var I=xs();Ca(b,u,A,I),qp(b,h,A)}}function yc(u,h,b){var A=zu(u),I={lane:A,action:b,hasEagerState:!1,eagerState:null,next:null};if(mf(u))Xp(h,I);else{var j=u.alternate;if(u.lanes===0&&(j===null||j.lanes===0)&&(j=h.lastRenderedReducer,j!==null))try{var G=h.lastRenderedState,se=j(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,A),b!==null&&(I=xs(),Ca(b,u,A,I),qp(b,h,A))}}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 A=h.lanes;A&=u.pendingLanes,b|=A,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},zx={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,Do(4194308,4,Ux.bind(null,h,u),b)},useLayoutEffect:function(u,h){return Do(4194308,4,u,h)},useInsertionEffect:function(u,h){return Do(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 A=Qr();return h=b!==void 0?b(h):h,A.memoizedState=A.baseState=h,u={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:h},A.queue=u,u=u.dispatch=$p.bind(null,Xn,u),[A.memoizedState,u]},useRef:function(u){var h=Qr();return u={current:u},h.memoizedState=u},useState:Vv,useDebugValue:Gp,useDeferredValue:function(u){return Qr().memoizedState=u},useTransition:function(){var u=Vv(!1),h=u[0];return u=AM.bind(null,u[1]),Qr().memoizedState=u,[h,u]},useMutableSource:function(){},useSyncExternalStore:function(u,h,b){var A=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(A,h,b)}I.memoizedState=b;var j={value:b,getSnapshot:h};return I.queue=j,Ii(Ox.bind(null,A,j,u),[u]),A.flags|=2048,co(9,hf.bind(null,A,j,b,h),void 0,null),b},useId:function(){var u=Qr(),h=hi.identifierPrefix;if(qn){var b=Fs,A=ct;b=(A&~(1<<32-mt(A)-1)).toString(32)+b,h=":"+h+"R"+b,b=cl++,0<\/script>",u=u.removeChild(u.firstChild)):typeof A.is=="string"?u=G.createElement(b,{is:A.is}):(u=G.createElement(b),b==="select"&&(G=u,A.multiple?G.multiple=!0:A.size&&(G.size=A.size))):u=G.createElementNS(u,b),u[Nr]=h,u[Pu]=A,cN(u,h,!1,!1),h.stateNode=u;e:{switch(G=Ae(b,A),b){case"dialog":Wn("cancel",u),Wn("close",u),I=A;break;case"iframe":case"object":case"embed":Wn("load",u),I=A;break;case"video":case"audio":for(I=0;IJp&&(h.flags|=128,A=!0,qv(j,!1),h.lanes=4194304)}else{if(!A)if(u=ao(G),u!==null){if(h.flags|=128,A=!0,b=u.updateQueue,b!==null&&(h.updateQueue=b,h.flags|=4),qv(j,!0),j.tail===null&&j.tailMode==="hidden"&&!G.alternate&&!qn)return Yi(h),null}else 2*st()-j.renderingStartTime>Jp&&b!==1073741824&&(h.flags|=128,A=!0,qv(j,!1),h.lanes=4194304);j.isBackwards?(G.sibling=h.child,h.child=G):(b=j.last,b!==null?b.sibling=G:h.child=G,j.last=G)}return j.tail!==null?(h=j.tail,j.rendering=h,j.tail=h.sibling,j.renderingStartTime=st(),h.sibling=null,b=Kn.current,Gn(Kn,A?b&1|2:b&1),h):(Yi(h),null);case 22:case 23:return BM(),A=h.memoizedState!==null,u!==null&&u.memoizedState!==null!==A&&(h.flags|=8192),A&&(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 tW(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 al(),$n(Pi),$n(Kr),Lo(),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));sl()}return u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 19:return $n(Kn),null;case 4:return al(),null;case 10:return of(h.type._context),null;case 22:case 23:return BM(),null;case 24:return null;default:return null}}var $x=!1,Zi=!1,nW=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(A){_r(u,h,A)}else b.current=null}function PM(u,h,b){try{b()}catch(A){_r(u,h,A)}}var fN=!1;function rW(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 A=b.getSelection&&b.getSelection();if(A&&A.rangeCount!==0){b=A.anchorNode;var I=A.anchorOffset,j=A.focusNode;A=A.focusOffset;try{b.nodeType,j.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!==j||A!==0&&Je.nodeType!==3||(he=G+A),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===j&&++Ze===A&&(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(Sv={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=fN,fN=!1,Tt}function Kv(u,h,b){var A=h.updateQueue;if(A=A!==null?A.lastEffect:null,A!==null){var I=A=A.next;do{if((I.tag&u)===u){var j=I.destroy;I.destroy=void 0,j!==void 0&&PM(h,b,j)}I=I.next}while(I!==A)}}function Xx(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 A=b.create;b.destroy=A()}b=b.next}while(b!==h)}}function RM(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 hN(u){var h=u.alternate;h!==null&&(u.alternate=null,hN(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 pN(u){return u.tag===5||u.tag===3||u.tag===4}function mN(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||pN(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 NM(u,h,b){var A=u.tag;if(A===5||A===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(A!==4&&(u=u.child,u!==null))for(NM(u,h,b),u=u.sibling;u!==null;)NM(u,h,b),u=u.sibling}function IM(u,h,b){var A=u.tag;if(A===5||A===6)u=u.stateNode,h?b.insertBefore(u,h):b.appendChild(u);else if(A!==4&&(u=u.child,u!==null))for(IM(u,h,b),u=u.sibling;u!==null;)IM(u,h,b),u=u.sibling}var ki=null,Aa=!1;function ju(u,h,b){for(b=b.child;b!==null;)gN(u,h,b),b=b.sibling}function gN(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 A=ki,I=Aa;ki=null,ju(u,h,b),ki=A,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:A=ki,I=Aa,ki=b.stateNode.containerInfo,Aa=!0,ju(u,h,b),ki=A,Aa=I;break;case 0:case 11:case 14:case 15:if(!Zi&&(A=b.updateQueue,A!==null&&(A=A.lastEffect,A!==null))){I=A=A.next;do{var j=I,G=j.destroy;j=j.tag,G!==void 0&&((j&2)!==0||(j&4)!==0)&&PM(b,h,G),I=I.next}while(I!==A)}ju(u,h,b);break;case 1:if(!Zi&&(Zp(b,h),A=b.stateNode,typeof A.componentWillUnmount=="function"))try{A.props=b.memoizedProps,A.state=b.memoizedState,A.componentWillUnmount()}catch(se){_r(b,h,se)}ju(u,h,b);break;case 21:ju(u,h,b);break;case 22:b.mode&1?(Zi=(A=Zi)||b.memoizedState!==null,ju(u,h,b),Zi=A):ju(u,h,b);break;default:ju(u,h,b)}}function vN(u){var h=u.updateQueue;if(h!==null){u.updateQueue=null;var b=u.stateNode;b===null&&(b=u.stateNode=new nW),h.forEach(function(A){var I=fW.bind(null,u,A);b.has(A)||(b.add(A),A.then(I,I))})}}function Ta(u,h){var b=h.deletions;if(b!==null)for(var A=0;AI&&(I=G),A&=~j}if(A=I,A=st()-A,A=(120>A?120:480>A?480:1080>A?1080:1920>A?1920:3e3>A?3e3:4320>A?4320:1960*sW(A/1960))-A,10u?16:u,Fu===null)var A=!1;else{if(u=Fu,Fu=null,Qx=0,(On&6)!==0)throw Error(n(331));var I=On;for(On|=4,Et=u.current;Et!==null;){var j=Et,G=j.child;if((Et.flags&16)!==0){var se=j.deletions;if(se!==null){for(var he=0;hest()-LM?xf(u,0):OM|=b),Vs(u,h)}function RN(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&&(Ya(u,h,b),Vs(u,b))}function dW(u){var h=u.memoizedState,b=0;h!==null&&(b=h.retryLane),RN(u,b)}function fW(u,h){var b=0;switch(u.tag){case 13:var A=u.stateNode,I=u.memoizedState;I!==null&&(b=I.retryLane);break;case 19:A=u.stateNode;break;default:throw Error(n(314))}A!==null&&A.delete(h),RN(u,b)}var NN;NN=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,JG(u,h,b);ln=(u.flags&131072)!==0}else ln=!1,qn&&(h.flags&1048576)!==0&&Nv(h,Fp,h.index);switch(h.lanes=0,h.tag){case 2:var A=h.type;Wx(u,h),u=h.pendingProps;var I=sc(h,Kr.current);ol(h,b),I=df(null,h,A,u,I,b);var j=Fv();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(A)?(j=!0,oc(h)):j=!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,A,u,b),h=on(null,h,A,!0,j,b)):(h.tag=0,qn&&j&&Iv(h),bt(null,h,I,b),h=h.child),h;case 16:A=h.elementType;e:{switch(Wx(u,h),u=h.pendingProps,I=A._init,A=I(A._payload),h.type=A,I=h.tag=pW(A),u=Bs(A,u),I){case 0:h=gt(null,h,A,u,b);break e;case 1:h=It(null,h,A,u,b);break e;case 11:h=Jr(null,h,A,u,b);break e;case 14:h=ys(null,h,A,Bs(A.type,u),b);break e}throw Error(n(306,A,""))}return h;case 0:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Bs(A,I),gt(u,h,A,I,b);case 1:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Bs(A,I),It(u,h,A,I,b);case 3:e:{if(sn(h),u===null)throw Error(n(387));A=h.pendingProps,j=h.memoizedState,I=j.element,mr(u,h),lr(h,A,null,b);var G=h.memoizedState;if(A=G.element,j.isDehydrated)if(j={element:A,isDehydrated:!1,cache:G.cache,pendingSuspenseBoundaries:G.pendingSuspenseBoundaries,transitions:G.transitions},h.updateQueue.baseState=j,h.memoizedState=j,h.flags&256){I=P(Error(n(423)),h),h=En(u,h,A,b,I);break e}else if(A!==I){I=P(Error(n(424)),h),h=En(u,h,A,b,I);break e}else for(Ni=ha(h.stateNode.containerInfo.firstChild),Yr=h,qn=!0,zs=null,b=sf(h,null,A,b),h.child=b;b;)b.flags=b.flags&-3|4096,b=b.sibling;else{if(sl(),A===I){h=xc(u,h,b);break e}bt(u,h,A,b)}h=h.child}return h;case 5:return mc(h),u===null&&Bp(h),A=h.type,I=h.pendingProps,j=u!==null?u.memoizedProps:null,G=I.children,Mv(A,I)?G=null:j!==null&&Mv(A,j)&&(h.flags|=32),Ue(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),A=h.pendingProps,u===null?h.child=cc(h,null,A,b):bt(u,h,A,b),h.child;case 11:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Bs(A,I),Jr(u,h,A,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(A=h.type._context,I=h.pendingProps,j=h.memoizedProps,G=I.value,Gn(uc,A._currentValue),A._currentValue=G,j!==null)if(ds(j.value,G)){if(j.children===I.children&&!Pi.current){h=xc(u,h,b);break e}}else for(j=h.child,j!==null&&(j.return=h);j!==null;){var se=j.dependencies;if(se!==null){G=j.child;for(var he=se.firstContext;he!==null;){if(he.context===A){if(j.tag===1){he=zn(-1,b&-b),he.tag=2;var De=j.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}}j.lanes|=b,he=j.alternate,he!==null&&(he.lanes|=b),af(j.return,b,h),se.lanes|=b;break}he=he.next}}else if(j.tag===10)G=j.type===h.type?null:j.child;else if(j.tag===18){if(G=j.return,G===null)throw Error(n(341));G.lanes|=b,se=G.alternate,se!==null&&(se.lanes|=b),af(G,b,h),G=j.sibling}else G=j.child;if(G!==null)G.return=j;else for(G=j;G!==null;){if(G===h){G=null;break}if(j=G.sibling,j!==null){j.return=G.return,G=j;break}G=G.return}j=G}bt(u,h,I.children,b),h=h.child}return h;case 9:return I=h.type,A=h.pendingProps.children,ol(h,b),I=ps(I),A=A(I),h.flags|=1,bt(u,h,A,b),h.child;case 14:return A=h.type,I=Bs(A,h.pendingProps),I=Bs(A.type,I),ys(u,h,A,I,b);case 15:return Ie(u,h,h.type,h.pendingProps,b);case 17:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Bs(A,I),Wx(u,h),h.tag=1,ui(A)?(u=!0,oc(h)):u=!1,ol(h,b),p(h,A,I),M(h,A,I,b),on(null,h,A,!0,u,b);case 19:return lN(u,h,b);case 22:return be(u,h,b)}throw Error(n(156,h.tag))};function IN(u,h){return ke(u,h)}function hW(u,h,b,A){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=A,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Uo(u,h,b,A){return new hW(u,h,b,A)}function VM(u){return u=u.prototype,!(!u||!u.isReactComponent)}function pW(u){if(typeof u=="function")return VM(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 nb(u,h,b,A,I,j){var G=2;if(A=u,typeof u=="function")VM(u)&&(G=1);else if(typeof u=="string")G=5;else e:switch(u){case L:return _f(b.children,I,j,h);case F:G=8,I|=8;break;case V:return u=Uo(12,b,h,I|2),u.elementType=V,u.lanes=j,u;case ne:return u=Uo(13,b,h,I),u.elementType=ne,u.lanes=j,u;case te:return u=Uo(19,b,h,I),u.elementType=te,u.lanes=j,u;case ce:return rb(b,I,j,h);default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case k:G=10;break e;case U:G=9;break e;case H:G=11;break e;case pe:G=14;break e;case oe:G=16,A=null;break e}throw Error(n(130,u==null?u:typeof u,""))}return h=Uo(G,b,h,I),h.elementType=u,h.type=A,h.lanes=j,h}function _f(u,h,b,A){return u=Uo(7,u,A,h),u.lanes=b,u}function rb(u,h,b,A){return u=Uo(22,u,A,h),u.elementType=ce,u.lanes=b,u.stateNode={isHidden:!1},u}function GM(u,h,b){return u=Uo(6,u,null,h),u.lanes=b,u}function WM(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 mW(u,h,b,A,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=A,this.onRecoverableError=I,this.mutableSourceEagerHydrationData=null}function $M(u,h,b,A,I,j,G,se,he){return u=new mW(u,h,b,se,he),h===1?(h=1,j===!0&&(h|=8)):h=0,j=Uo(3,null,null,h),u.current=j,j.stateNode=u,j.memoizedState={element:A,isDehydrated:b,cache:null,transitions:null,pendingSuspenseBoundaries:null},an(j),u}function gW(u,h,b){var A=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),JM.exports=RW(),JM.exports}var XN;function NW(){if(XN)return db;XN=1;var t=GU();return db.createRoot=t.createRoot,db.hydrateRoot=t.hydrateRoot,db}var IW=NW();const kW=B1(IW);var V0=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,kU,OW=(kU=class extends V0{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,kU),pP=new OW,LW={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},fd,hP,OU,DW=(OU=class{constructor(){Wt(this,fd,LW);Wt(this,hP,!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,hP=new WeakMap,OU),Qf=new DW;function jW(t){setTimeout(t,0)}var UW=typeof window>"u"||"Deno"in globalThis;function Xs(){}function FW(t,e){return typeof t=="function"?t(e):t}function hT(t){return typeof t=="number"&&t>=0&&t!==1/0}function WU(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 qN(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:o,stale:a}=t;if(o){if(r){if(e.queryHash!==mP(o,e.options))return!1}else if(!n0(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 KN(t,e){const{exact:n,status:r,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(n){if(t0(e.options.mutationKey)!==t0(s))return!1}else if(!n0(e.options.mutationKey,s))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function mP(t,e){return((e==null?void 0:e.queryKeyHashFn)||t0)(t)}function t0(t){return JSON.stringify(t,(e,n)=>mT(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function n0(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>n0(t[n],e[n])):!1}var zW=Object.prototype.hasOwnProperty;function $U(t,e,n=0){if(t===e)return t;if(n>500)return e;const r=YN(t)&&YN(e);if(!r&&!(mT(t)&&mT(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{Qf.setTimeout(e,t)})}function gT(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?$U(t,e):e}function HW(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function VW(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var gP=Symbol();function XU(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===gP?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function qU(t,e){return typeof t=="function"?t(...e):!!t}function GW(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 r0=(()=>{let t=()=>UW;return{isServer(){return t()},setIsServer(e){t=e}}})();function vT(){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 WW=jW;function $W(){let t=[],e=0,n=a=>{a()},r=a=>{a()},i=WW;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=$W(),sg,hd,og,LU,XW=(LU=class extends V0{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,LU),J_=new XW;function qW(t){return Math.min(1e3*2**t,3e4)}function KU(t){return(t??"online")==="online"?J_.isOnline():!0}var yT=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function YU(t){let e=!1,n=0,r;const i=vT(),s=()=>i.status!=="pending",o=S=>{var _;if(!s()){const w=new yT(S);m(w),(_=t.onCancel)==null||_.call(t,w)}},a=()=>{e=!0},l=()=>{e=!1},c=()=>pP.isFocused()&&(t.networkMode==="always"||J_.isOnline())&&t.canRun(),d=()=>KU(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 E=t.retry??(r0.isServer()?0:3),T=t.retryDelay??qW,C=typeof T=="function"?T(n,w):T,O=E===!0||typeof E=="number"&&nc()?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,DU,ZU=(DU=class{constructor(){Wt(this,dh)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),hT(this.gcTime)&&wt(this,dh,Qf.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(r0.isServer()?1/0:300*1e3))}clearGcTimeout(){me(this,dh)!==void 0&&(Qf.clearTimeout(me(this,dh)),wt(this,dh,void 0))}},dh=new WeakMap,DU);function KW(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=>{GW(T,()=>e.signal,()=>S=!0)},w=XU(e.options,e.fetchOptions),E=async(T,C,O)=>{if(S)return Promise.reject(e.signal.reason);if(C==null&&T.pages.length)return Promise.resolve(T);const L=(()=>{const U={client:e.client,queryKey:e.queryKey,pageParam:C,direction:O?"backward":"forward",meta:e.options.meta};return _(U),U})(),F=await w(L),{maxPages:V}=e.options,k=O?VW:HW;return{pages:k(T.pages,F,V),pageParams:k(T.pageParams,C,V)}};if(i&&s.length){const T=i==="backward",C=T?YW:QN,O={pages:s,pageParams:o},N=C(r,O);a=await E(O,N,T)}else{const T=t??s.length;do{const C=l===0?o[0]??r.initialPageParam:QN(r,a);if(l>0&&C==null)break;a=await E(a,C),l++}while(l{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 QN(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 YW(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,Go,hh,gi,U0,ph,go,QU,Cc,jU,ZW=(jU=class extends ZU{constructor(e){super();Wt(this,go);Wt(this,ag);Wt(this,fh);Wt(this,lg);Wt(this,Go);Wt(this,hh);Wt(this,gi);Wt(this,U0);Wt(this,ph);wt(this,ph,!1),wt(this,U0,e.defaultOptions),this.setOptions(e.options),this.observers=[],wt(this,hh,e.client),wt(this,Go,me(this,hh).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,wt(this,fh,eI(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,U0),...e},e!=null&&e._type&&wt(this,ag,e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=eI(this.options);n.data!==void 0&&(this.setState(JN(n.data,n.dataUpdatedAt)),wt(this,fh,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&me(this,Go).remove(this)}setData(e,n){const r=gT(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===gP||!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:!WU(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,Go).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,QU).call(this)?me(this,gi).cancel({revert:!0}):me(this,gi).cancelRetry()),this.scheduleGc()),me(this,Go).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,E,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=XU(this.options,n),N=(()=>{const L={client:me(this,hh),queryKey:this.queryKey,meta:this.meta};return i(L),L})();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"?KW(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,YU({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:C=>{C instanceof yT&&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,Go).config).onSuccess)==null||y.call(m,C,this),(S=(x=me(this,Go).config).onSettled)==null||S.call(x,C,this.state.error,this),C}catch(C){if(C instanceof yT){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,Go).config).onError)==null||w.call(_,C,this),(T=(E=me(this,Go).config).onSettled)==null||T.call(E,this.state.data,C,this),C}finally{this.scheduleGc()}}},ag=new WeakMap,fh=new WeakMap,lg=new WeakMap,Go=new WeakMap,hh=new WeakMap,gi=new WeakMap,U0=new WeakMap,ph=new WeakMap,go=new WeakSet,QU=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,...JU(r.data,this.options),fetchMeta:e.meta??null};case"success":const i={...r,...JN(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,Go).notify({query:this,type:"updated",action:e})})},jU);function JU(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:KU(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function JN(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function eI(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,F0,ws,mh,cg,Ic,pd,z0,ug,dg,gh,vh,md,fg,Bn,Ly,xT,bT,_T,wT,ST,MT,ET,eF,UU,QW=(UU=class extends V0{constructor(e,n){super();Wt(this,Bn);Wt(this,$s);Wt(this,An);Wt(this,F0);Wt(this,ws);Wt(this,mh);Wt(this,cg);Wt(this,Ic);Wt(this,pd);Wt(this,z0);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,vT()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(me(this,An).addObserver(this),tI(me(this,An),this.options)?_n(this,Bn,Ly).call(this):this.updateResult(),_n(this,Bn,wT).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return AT(me(this,An),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return AT(me(this,An),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,_n(this,Bn,ST).call(this),_n(this,Bn,MT).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,ET).call(this),me(this,An).setOptions(this.options),n._defaulted&&!pT(this.options,n)&&me(this,$s).getQueryCache().notify({type:"observerOptionsUpdated",query:me(this,An),observer:this});const i=this.hasListeners();i&&nI(me(this,An),r,this.options,n)&&_n(this,Bn,Ly).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,xT).call(this);const s=_n(this,Bn,bT).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,_T).call(this,s)}getOptimisticResult(e){const n=me(this,$s).getQueryCache().build(me(this,$s),e),r=this.createResult(n,e);return e8(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,Ly).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,F0),{state:d}=e;let f={...d},m=!1,y;if(n._optimisticResults){const k=this.hasListeners(),U=!k&&tI(e,n),H=k&&nI(e,r,n,i);(U||H)&&(f={...f,...JU(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=gT(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,z0))y=me(this,ug);else try{wt(this,z0,n.select),y=n.select(y),y=gT(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 E=f.fetchStatus==="fetching",T=_==="pending",C=_==="error",O=T&&E,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:E,isRefetching:E&&!T,isLoadingError:C&&!N,isPaused:f.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:C&&N,isStale:vP(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,U=F.status==="error"&&!k,H=pe=>{U?pe.reject(F.error):k&&pe.resolve(F.data)},ne=()=>{const pe=wt(this,Ic,F.promise=vT());H(pe)},te=me(this,Ic);switch(te.status){case"pending":e.queryHash===r.queryHash&&H(te);break;case"fulfilled":(U||F.data!==te.value)&&ne();break;case"rejected":(!U||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)),pT(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,eF).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&_n(this,Bn,wT).call(this)}},$s=new WeakMap,An=new WeakMap,F0=new WeakMap,ws=new WeakMap,mh=new WeakMap,cg=new WeakMap,Ic=new WeakMap,pd=new WeakMap,z0=new WeakMap,ug=new WeakMap,dg=new WeakMap,gh=new WeakMap,vh=new WeakMap,md=new WeakMap,fg=new WeakMap,Bn=new WeakSet,Ly=function(e){_n(this,Bn,ET).call(this);let n=me(this,An).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(Xs)),n},xT=function(){_n(this,Bn,ST).call(this);const e=bd(this.options.staleTime,me(this,An));if(r0.isServer()||me(this,ws).isStale||!hT(e))return;const r=WU(me(this,ws).dataUpdatedAt,e)+1;wt(this,gh,Qf.setTimeout(()=>{me(this,ws).isStale||this.updateResult()},r))},bT=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(me(this,An)):this.options.refetchInterval)??!1},_T=function(e){_n(this,Bn,MT).call(this),wt(this,md,e),!(r0.isServer()||vo(this.options.enabled,me(this,An))===!1||!hT(me(this,md))||me(this,md)===0)&&wt(this,vh,Qf.setInterval(()=>{(this.options.refetchIntervalInBackground||pP.isFocused())&&_n(this,Bn,Ly).call(this)},me(this,md)))},wT=function(){_n(this,Bn,xT).call(this),_n(this,Bn,_T).call(this,_n(this,Bn,bT).call(this))},ST=function(){me(this,gh)!==void 0&&(Qf.clearTimeout(me(this,gh)),wt(this,gh,void 0))},MT=function(){me(this,vh)!==void 0&&(Qf.clearInterval(me(this,vh)),wt(this,vh,void 0))},ET=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,F0,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},eF=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"})})},UU);function JW(t,e){return vo(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&vo(e.retryOnMount,t)===!1)}function tI(t,e){return JW(t,e)||t.state.data!==void 0&&AT(t,e,e.refetchOnMount)}function AT(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&&vP(t,e)}return!1}function nI(t,e,n,r){return(t!==e||vo(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&vP(t,n)}function vP(t,e){return vo(e.enabled,t)!==!1&&t.isStaleByTime(bd(e.staleTime,t))}function e8(t,e){return!pT(t.getCurrentResult(),e)}var B0,yl,ts,yh,xl,sd,FU,t8=(FU=class extends ZU{constructor(e){super();Wt(this,xl);Wt(this,B0);Wt(this,yl);Wt(this,ts);Wt(this,yh);wt(this,B0,e.client),this.mutationId=e.mutationId,wt(this,ts,e.mutationCache),wt(this,yl,[]),this.state=e.state||n8(),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,E,T,C,O,N,L;const n=()=>{_n(this,xl,sd).call(this,{type:"continue"})},r={client:me(this,B0),meta:this.options.meta,mutationKey:this.options.mutationKey};wt(this,yh,YU({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=(E=this.options).onError)==null?void 0:T.call(E,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((L=(N=this.options).onSettled)==null?void 0:L.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)}}},B0=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})})},FU);function n8(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var kc,Oa,H0,zU,r8=(zU=class extends V0{constructor(e={}){super();Wt(this,kc);Wt(this,Oa);Wt(this,H0);this.config=e,wt(this,kc,new Set),wt(this,Oa,new Map),wt(this,H0,0)}build(e,n,r){const i=new t8({client:e,mutationCache:this,mutationId:++ub(this,H0)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){me(this,kc).add(e);const n=fb(e);if(typeof n=="string"){const r=me(this,Oa).get(n);r?r.push(e):me(this,Oa).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(me(this,kc).delete(e)){const n=fb(e);if(typeof n=="string"){const r=me(this,Oa).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,Oa).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=fb(e);if(typeof n=="string"){const r=me(this,Oa).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=fb(e);if(typeof n=="string"){const i=(r=me(this,Oa).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,Oa).clear()})}getAll(){return Array.from(me(this,kc))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>KN(n,r))}findAll(e={}){return this.getAll().filter(n=>KN(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,Oa=new WeakMap,H0=new WeakMap,zU);function fb(t){var e;return(e=t.options.scope)==null?void 0:e.id}var bl,BU,i8=(BU=class extends V0{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??mP(i,n);let o=this.get(s);return o||(o=new ZW({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=>qN(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>qN(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,BU),Sr,gd,vd,hg,pg,yd,mg,gg,HU,s8=(HU=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 i8),wt(this,gd,t.mutationCache||new r8),wt(this,vd,t.defaultOptions||{}),wt(this,hg,new Map),wt(this,pg,new Map),wt(this,yd,0)}mount(){ub(this,yd)._++,me(this,yd)===1&&(wt(this,mg,pP.subscribe(async t=>{t&&(await this.resumePausedMutations(),me(this,Sr).onFocus())})),wt(this,gg,J_.subscribe(async t=>{t&&(await this.resumePausedMutations(),me(this,Sr).onOnline())})))}unmount(){var t,e;ub(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=FW(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 J_.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(t0(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...me(this,hg).values()],n={};return e.forEach(r=>{n0(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){me(this,pg).set(t0(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...me(this,pg).values()],n={};return e.forEach(r=>{n0(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=mP(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===gP&&(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,HU),tF=R.createContext(void 0),$h=t=>{const e=R.useContext(tF);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},o8=({client:t,children:e})=>(R.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),v.jsx(tF.Provider,{value:t,children:e})),nF=R.createContext(!1),a8=()=>R.useContext(nF);nF.Provider;function l8(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var c8=R.createContext(l8()),u8=()=>R.useContext(c8),d8=(t,e,n)=>{const r=n!=null&&n.state.error&&typeof t.throwOnError=="function"?qU(t.throwOnError,[n.state.error,n]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},f8=t=>{R.useEffect(()=>{t.clearReset()},[t])},h8=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||qU(n,[t.error,r])),p8=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))}},m8=(t,e)=>t.isLoading&&t.isFetching&&!e,g8=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,rI=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function v8(t,e,n){var y,x,S,_;const r=a8(),i=u8(),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,p8(o),d8(o,i,a),f8(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 E=m?d.subscribe(Fi.batchCalls(w)):Xs;return d.updateResult(),E},[d,m]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),R.useEffect(()=>{d.setOptions(o)},[o,d]),g8(o,f))throw rI(o,d,i);if(h8({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&&!r0.isServer()&&m8(f,r)){const w=c?rI(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 v8(t,QW)}/** +`+j.stack}return{value:u,source:h,stack:I,digest:null}}function D(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 A=h.value;return b.callback=function(){Yx||(Yx=!0,DM=A),z(u,h)},b}function ze(u,h,b){b=zn(-1,b),b.tag=3;var A=u.type.getDerivedStateFromError;if(typeof A=="function"){var I=h.value;b.payload=function(){return A(I)},b.callback=function(){z(u,h)}}var j=u.stateNode;return j!==null&&typeof j.componentDidCatch=="function"&&(b.callback=function(){z(u,h),typeof A!="function"&&(Uu===null?Uu=new Set([this]):Uu.add(this));var G=h.stack;this.componentDidCatch(h.value,{componentStack:G!==null?G:""})}),b}function tt(u,h,b){var A=u.pingCache;if(A===null){A=u.pingCache=new ie;var I=new Set;A.set(h,I)}else I=A.get(h),I===void 0&&(I=new Set,A.set(h,I));I.has(b)||(I.add(b),u=uW.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,A,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,A){h.child=u===null?sf(h,null,b,A):cc(h,u.child,b,A)}function Jr(u,h,b,A,I){b=b.render;var j=h.ref;return al(h,I),A=df(u,h,b,A,j,I),b=Fv(),u!==null&&!ln?(h.updateQueue=u.updateQueue,h.flags&=-2053,u.lanes&=~I,xc(u,h,I)):(qn&&b&&Iv(h),h.flags|=1,bt(u,h,A,I),h.child)}function ys(u,h,b,A,I){if(u===null){var j=b.type;return typeof j=="function"&&!VM(j)&&j.defaultProps===void 0&&b.compare===null&&b.defaultProps===void 0?(h.tag=15,h.type=j,Ie(u,h,j,A,I)):(u=nb(b.type,null,A,h,h.mode,I),u.ref=h.ref,u.return=h,h.child=u)}if(j=u.child,(u.lanes&I)===0){var G=j.memoizedProps;if(b=b.compare,b=b!==null?b:Jl,b(G,A)&&u.ref===h.ref)return xc(u,h,I)}return h.flags|=1,u=Hu(j,A),u.ref=h.ref,u.return=h,h.child=u}function Ie(u,h,b,A,I){if(u!==null){var j=u.memoizedProps;if(Jl(j,A)&&u.ref===h.ref)if(ln=!1,h.pendingProps=A=j,(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,A,I)}function be(u,h,b){var A=h.pendingProps,I=A.children,j=u!==null?u.memoizedState:null;if(A.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=j!==null?j.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},A=j!==null?j.baseLanes:b,Gn(Qp,uo),uo|=A}else j!==null?(A=j.baseLanes|b,h.memoizedState=null):A=b,Gn(Qp,uo),uo|=A;return bt(u,h,I,b),h.child}function Ue(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,A,I){var j=ui(b)?ga:Kr.current;return j=sc(h,j),al(h,I),b=df(u,h,b,A,j,I),A=Fv(),u!==null&&!ln?(h.updateQueue=u.updateQueue,h.flags&=-2053,u.lanes&=~I,xc(u,h,I)):(qn&&A&&Iv(h),h.flags|=1,bt(u,h,b,I),h.child)}function It(u,h,b,A,I){if(ui(b)){var j=!0;oc(h)}else j=!1;if(al(h,I),h.stateNode===null)Wx(u,h),p(h,b,A),M(h,b,A,I),A=!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!==A||he!==De)&&g(h,G,A,De),Fn=!1;var Ye=h.memoizedState;G.state=Ye,lr(h,A,G,I),he=h.memoizedState,se!==A||Ye!==he||Pi.current||Fn?(typeof Ze=="function"&&(gf(h,b,Ze,A),he=h.memoizedState),(se=Fn||Vx(h,b,se,A,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=A,h.memoizedState=he),G.props=A,G.state=he,G.context=De,A=se):(typeof G.componentDidMount=="function"&&(h.flags|=4194308),A=!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,A,he),Fn=!1,Ye=h.memoizedState,G.state=Ye,lr(h,A,G,I);var Tt=h.memoizedState;se!==Je||Ye!==Tt||Pi.current||Fn?(typeof _t=="function"&&(gf(h,b,_t,A),Tt=h.memoizedState),(De=Fn||Vx(h,b,De,A,Ye,Tt,he)||!1)?(Ze||typeof G.UNSAFE_componentWillUpdate!="function"&&typeof G.componentWillUpdate!="function"||(typeof G.componentWillUpdate=="function"&&G.componentWillUpdate(A,Tt,he),typeof G.UNSAFE_componentWillUpdate=="function"&&G.UNSAFE_componentWillUpdate(A,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=A,h.memoizedState=Tt),G.props=A,G.state=Tt,G.context=he,A=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),A=!1)}return on(u,h,b,A,j,I)}function on(u,h,b,A,I,j){Ue(u,h);var G=(h.flags&128)!==0;if(!A&&!G)return I&&Rv(h,b,!1),xc(u,h,j);A=h.stateNode,Bt.current=h;var se=G&&typeof b.getDerivedStateFromError!="function"?null:A.render();return h.flags|=1,u!==null&&G?(h.child=cc(h,u.child,null,j),h.child=cc(h,null,se,j)):bt(u,h,se,j),h.memoizedState=A.state,I&&Rv(h,b,!0),h.child}function sn(u){var h=u.stateNode;h.pendingContext?Pv(u,h.pendingContext,h.pendingContext!==h.context):h.context&&Pv(u,h.context,!1),cf(u,h.containerInfo)}function En(u,h,b,A,I){return ol(),Nu(I),h.flags|=256,bt(u,h,b,A),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 A=h.pendingProps,I=Kn.current,j=!1,G=(h.flags&128)!==0,se;if((se=G)||(se=u!==null&&u.memoizedState===null?!1:(I&2)!==0),se?(j=!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=A.children,u=A.fallback,j?(A=h.mode,j=h.child,G={mode:"hidden",children:G},(A&1)===0&&j!==null?(j.childLanes=0,j.pendingProps=G):j=rb(G,A,0,null),u=_f(u,A,b,null),j.return=h,u.return=h,j.sibling=u,h.child=j,h.child.memoizedState=bn(b),h.memoizedState=br,u):Xv(h,G));if(I=u.memoizedState,I!==null&&(se=I.dehydrated,se!==null))return QG(u,h,G,A,se,I,b);if(j){j=A.fallback,G=h.mode,I=u.child,se=I.sibling;var he={mode:"hidden",children:A.children};return(G&1)===0&&h.child!==I?(A=h.child,A.childLanes=0,A.pendingProps=he,h.deletions=null):(A=Hu(I,he),A.subtreeFlags=I.subtreeFlags&14680064),se!==null?j=Hu(se,j):(j=_f(j,G,b,null),j.flags|=2),j.return=h,A.return=h,A.sibling=j,h.child=A,A=j,j=h.child,G=u.child.memoizedState,G=G===null?bn(b):{baseLanes:G.baseLanes|b,cachePool:null,transitions:G.transitions},j.memoizedState=G,j.childLanes=u.childLanes&~b,h.memoizedState=br,A}return j=u.child,u=j.sibling,A=Hu(j,{mode:"visible",children:A.children}),(h.mode&1)===0&&(A.lanes=b),A.return=h,A.sibling=null,u!==null&&(b=h.deletions,b===null?(h.deletions=[u],h.flags|=16):b.push(u)),h.child=A,h.memoizedState=null,A}function Xv(u,h){return h=rb({mode:"visible",children:h},u.mode,0,null),h.return=u,u.child=h}function Gx(u,h,b,A){return A!==null&&Nu(A),cc(h,u.child,null,b),u=Xv(h,h.pendingProps.children),u.flags|=2,h.memoizedState=null,u}function QG(u,h,b,A,I,j,G){if(b)return h.flags&256?(h.flags&=-257,A=D(Error(n(422))),Gx(u,h,G,A)):h.memoizedState!==null?(h.child=u.child,h.flags|=128,null):(j=A.fallback,I=h.mode,A=rb({mode:"visible",children:A.children},I,0,null),j=_f(j,I,G,null),j.flags|=2,A.return=h,j.return=h,A.sibling=j,h.child=A,(h.mode&1)!==0&&cc(h,u.child,null,G),h.child.memoizedState=bn(G),h.memoizedState=br,j);if((h.mode&1)===0)return Gx(u,h,G,null);if(I.data==="$!"){if(A=I.nextSibling&&I.nextSibling.dataset,A)var se=A.dgst;return A=se,j=Error(n(419)),A=D(j,A,void 0),Gx(u,h,G,A)}if(se=(G&u.childLanes)!==0,ln||se){if(A=hi,A!==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&(A.suspendedLanes|G))!==0?0:I,I!==0&&I!==j.retryLane&&(j.retryLane=I,oo(u,I),Ca(A,u,I,-1))}return HM(),A=D(Error(n(421))),Gx(u,h,G,A)}return I.data==="$?"?(h.flags|=128,h.child=u.child,h=dW.bind(null,u),I._reactRetry=h,null):(u=j.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=Xv(h,A.children),h.flags|=4096,h)}function aN(u,h,b){u.lanes|=h;var A=u.alternate;A!==null&&(A.lanes|=h),af(u.return,h,b)}function TM(u,h,b,A,I){var j=u.memoizedState;j===null?u.memoizedState={isBackwards:h,rendering:null,renderingStartTime:0,last:A,tail:b,tailMode:I}:(j.isBackwards=h,j.rendering=null,j.renderingStartTime=0,j.last=A,j.tail=b,j.tailMode=I)}function lN(u,h,b){var A=h.pendingProps,I=A.revealOrder,j=A.tail;if(bt(u,h,A.children,b),A=Kn.current,(A&2)!==0)A=A&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&&aN(u,b,h);else if(u.tag===19)aN(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}A&=1}if(Gn(Kn,A),(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),TM(h,!1,I,b,j);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}TM(h,!0,b,null,j);break;case"together":TM(h,!1,null,null,void 0);break;default:h.memoizedState=null}return h.child}function Wx(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 JG(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 A=h.type._context,I=h.memoizedProps.value;Gn(uc,A._currentValue),A._currentValue=I;break;case 13:if(A=h.memoizedState,A!==null)return A.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(A=(b&h.childLanes)!==0,(u.flags&128)!==0){if(A)return lN(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),A)break;return null;case 22:case 23:return h.lanes=0,be(u,h,b)}return xc(u,h,b)}var cN,CM,uN,dN;cN=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}},CM=function(){},uN=function(u,h,b,A){var I=u.memoizedProps;if(I!==A){u=h.stateNode,xr(ms.current);var j=null;switch(b){case"input":I=Ge(u,I),A=Ge(u,A),j=[];break;case"select":I=q({},I,{value:void 0}),A=q({},A,{value:void 0}),j=[];break;case"textarea":I=Ee(u,I),A=Ee(u,A),j=[];break;default:typeof I.onClick!="function"&&typeof A.onClick=="function"&&(u.onclick=Zd)}J(b,A);var G;b=null;for(De in I)if(!A.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)?j||(j=[]):(j=j||[]).push(De,null));for(De in A){var he=A[De];if(se=I!=null?I[De]:void 0,A.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||(j||(j=[]),j.push(De,b)),b=he;else De==="dangerouslySetInnerHTML"?(he=he?he.__html:void 0,se=se?se.__html:void 0,he!=null&&se!==he&&(j=j||[]).push(De,he)):De==="children"?typeof he!="string"&&typeof he!="number"||(j=j||[]).push(De,""+he):De!=="suppressContentEditableWarning"&&De!=="suppressHydrationWarning"&&(i.hasOwnProperty(De)?(he!=null&&De==="onScroll"&&Wn("scroll",u),j||se===he||(j=[])):(j=j||[]).push(De,he))}b&&(j=j||[]).push("style",b);var De=j;(h.updateQueue=De)&&(h.flags|=4)}},dN=function(u,h,b,A){b!==A&&(h.flags|=4)};function qv(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 A=null;b!==null;)b.alternate!==null&&(A=b),b=b.sibling;A===null?h||u.tail===null?u.tail=null:u.tail.sibling=null:A.sibling=null}}function Yi(u){var h=u.alternate!==null&&u.alternate.child===u.child,b=0,A=0;if(h)for(var I=u.child;I!==null;)b|=I.lanes|I.childLanes,A|=I.subtreeFlags&14680064,A|=I.flags&14680064,I.return=u,I=I.sibling;else for(I=u.child;I!==null;)b|=I.lanes|I.childLanes,A|=I.subtreeFlags,A|=I.flags,I.return=u,I=I.sibling;return u.subtreeFlags|=A,u.childLanes=b,h}function eW(u,h,b){var A=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 A=h.stateNode,ll(),$n(Pi),$n(Kr),Lo(),A.pendingContext&&(A.context=A.pendingContext,A.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&&(FM(zs),zs=null))),CM(u,h),Yi(h),null;case 5:Ou(h);var I=xr(_a.current);if(b=h.type,u!==null&&h.stateNode!=null)uN(u,h,b,A,I),u.ref!==h.ref&&(h.flags|=512,h.flags|=2097152);else{if(!A){if(h.stateNode===null)throw Error(n(166));return Yi(h),null}if(u=xr(ms.current),Ru(h)){A=h.stateNode,b=h.type;var j=h.memoizedProps;switch(A[Nr]=h,A[Pu]=j,u=(h.mode&1)!==0,b){case"dialog":Wn("cancel",A),Wn("close",A);break;case"iframe":case"object":case"embed":Wn("load",A);break;case"video":case"audio":for(I=0;I<\/script>",u=u.removeChild(u.firstChild)):typeof A.is=="string"?u=G.createElement(b,{is:A.is}):(u=G.createElement(b),b==="select"&&(G=u,A.multiple?G.multiple=!0:A.size&&(G.size=A.size))):u=G.createElementNS(u,b),u[Nr]=h,u[Pu]=A,cN(u,h,!1,!1),h.stateNode=u;e:{switch(G=Ae(b,A),b){case"dialog":Wn("cancel",u),Wn("close",u),I=A;break;case"iframe":case"object":case"embed":Wn("load",u),I=A;break;case"video":case"audio":for(I=0;IJp&&(h.flags|=128,A=!0,qv(j,!1),h.lanes=4194304)}else{if(!A)if(u=ao(G),u!==null){if(h.flags|=128,A=!0,b=u.updateQueue,b!==null&&(h.updateQueue=b,h.flags|=4),qv(j,!0),j.tail===null&&j.tailMode==="hidden"&&!G.alternate&&!qn)return Yi(h),null}else 2*st()-j.renderingStartTime>Jp&&b!==1073741824&&(h.flags|=128,A=!0,qv(j,!1),h.lanes=4194304);j.isBackwards?(G.sibling=h.child,h.child=G):(b=j.last,b!==null?b.sibling=G:h.child=G,j.last=G)}return j.tail!==null?(h=j.tail,j.rendering=h,j.tail=h.sibling,j.renderingStartTime=st(),h.sibling=null,b=Kn.current,Gn(Kn,A?b&1|2:b&1),h):(Yi(h),null);case 22:case 23:return BM(),A=h.memoizedState!==null,u!==null&&u.memoizedState!==null!==A&&(h.flags|=8192),A&&(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 tW(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),Lo(),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 BM(),null;case 24:return null;default:return null}}var $x=!1,Zi=!1,nW=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(A){_r(u,h,A)}else b.current=null}function PM(u,h,b){try{b()}catch(A){_r(u,h,A)}}var fN=!1;function rW(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 A=b.getSelection&&b.getSelection();if(A&&A.rangeCount!==0){b=A.anchorNode;var I=A.anchorOffset,j=A.focusNode;A=A.focusOffset;try{b.nodeType,j.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!==j||A!==0&&Je.nodeType!==3||(he=G+A),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===j&&++Ze===A&&(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(Sv={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=fN,fN=!1,Tt}function Kv(u,h,b){var A=h.updateQueue;if(A=A!==null?A.lastEffect:null,A!==null){var I=A=A.next;do{if((I.tag&u)===u){var j=I.destroy;I.destroy=void 0,j!==void 0&&PM(h,b,j)}I=I.next}while(I!==A)}}function Xx(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 A=b.create;b.destroy=A()}b=b.next}while(b!==h)}}function RM(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 hN(u){var h=u.alternate;h!==null&&(u.alternate=null,hN(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 pN(u){return u.tag===5||u.tag===3||u.tag===4}function mN(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||pN(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 NM(u,h,b){var A=u.tag;if(A===5||A===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(A!==4&&(u=u.child,u!==null))for(NM(u,h,b),u=u.sibling;u!==null;)NM(u,h,b),u=u.sibling}function IM(u,h,b){var A=u.tag;if(A===5||A===6)u=u.stateNode,h?b.insertBefore(u,h):b.appendChild(u);else if(A!==4&&(u=u.child,u!==null))for(IM(u,h,b),u=u.sibling;u!==null;)IM(u,h,b),u=u.sibling}var ki=null,Aa=!1;function ju(u,h,b){for(b=b.child;b!==null;)gN(u,h,b),b=b.sibling}function gN(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 A=ki,I=Aa;ki=null,ju(u,h,b),ki=A,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:A=ki,I=Aa,ki=b.stateNode.containerInfo,Aa=!0,ju(u,h,b),ki=A,Aa=I;break;case 0:case 11:case 14:case 15:if(!Zi&&(A=b.updateQueue,A!==null&&(A=A.lastEffect,A!==null))){I=A=A.next;do{var j=I,G=j.destroy;j=j.tag,G!==void 0&&((j&2)!==0||(j&4)!==0)&&PM(b,h,G),I=I.next}while(I!==A)}ju(u,h,b);break;case 1:if(!Zi&&(Zp(b,h),A=b.stateNode,typeof A.componentWillUnmount=="function"))try{A.props=b.memoizedProps,A.state=b.memoizedState,A.componentWillUnmount()}catch(se){_r(b,h,se)}ju(u,h,b);break;case 21:ju(u,h,b);break;case 22:b.mode&1?(Zi=(A=Zi)||b.memoizedState!==null,ju(u,h,b),Zi=A):ju(u,h,b);break;default:ju(u,h,b)}}function vN(u){var h=u.updateQueue;if(h!==null){u.updateQueue=null;var b=u.stateNode;b===null&&(b=u.stateNode=new nW),h.forEach(function(A){var I=fW.bind(null,u,A);b.has(A)||(b.add(A),A.then(I,I))})}}function Ta(u,h){var b=h.deletions;if(b!==null)for(var A=0;AI&&(I=G),A&=~j}if(A=I,A=st()-A,A=(120>A?120:480>A?480:1080>A?1080:1920>A?1920:3e3>A?3e3:4320>A?4320:1960*sW(A/1960))-A,10u?16:u,Fu===null)var A=!1;else{if(u=Fu,Fu=null,Qx=0,(On&6)!==0)throw Error(n(331));var I=On;for(On|=4,Et=u.current;Et!==null;){var j=Et,G=j.child;if((Et.flags&16)!==0){var se=j.deletions;if(se!==null){for(var he=0;hest()-LM?xf(u,0):OM|=b),Vs(u,h)}function RN(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 dW(u){var h=u.memoizedState,b=0;h!==null&&(b=h.retryLane),RN(u,b)}function fW(u,h){var b=0;switch(u.tag){case 13:var A=u.stateNode,I=u.memoizedState;I!==null&&(b=I.retryLane);break;case 19:A=u.stateNode;break;default:throw Error(n(314))}A!==null&&A.delete(h),RN(u,b)}var NN;NN=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,JG(u,h,b);ln=(u.flags&131072)!==0}else ln=!1,qn&&(h.flags&1048576)!==0&&Nv(h,Fp,h.index);switch(h.lanes=0,h.tag){case 2:var A=h.type;Wx(u,h),u=h.pendingProps;var I=sc(h,Kr.current);al(h,b),I=df(null,h,A,u,I,b);var j=Fv();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(A)?(j=!0,oc(h)):j=!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,A,u,b),h=on(null,h,A,!0,j,b)):(h.tag=0,qn&&j&&Iv(h),bt(null,h,I,b),h=h.child),h;case 16:A=h.elementType;e:{switch(Wx(u,h),u=h.pendingProps,I=A._init,A=I(A._payload),h.type=A,I=h.tag=pW(A),u=Bs(A,u),I){case 0:h=gt(null,h,A,u,b);break e;case 1:h=It(null,h,A,u,b);break e;case 11:h=Jr(null,h,A,u,b);break e;case 14:h=ys(null,h,A,Bs(A.type,u),b);break e}throw Error(n(306,A,""))}return h;case 0:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Bs(A,I),gt(u,h,A,I,b);case 1:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Bs(A,I),It(u,h,A,I,b);case 3:e:{if(sn(h),u===null)throw Error(n(387));A=h.pendingProps,j=h.memoizedState,I=j.element,mr(u,h),lr(h,A,null,b);var G=h.memoizedState;if(A=G.element,j.isDehydrated)if(j={element:A,isDehydrated:!1,cache:G.cache,pendingSuspenseBoundaries:G.pendingSuspenseBoundaries,transitions:G.transitions},h.updateQueue.baseState=j,h.memoizedState=j,h.flags&256){I=P(Error(n(423)),h),h=En(u,h,A,b,I);break e}else if(A!==I){I=P(Error(n(424)),h),h=En(u,h,A,b,I);break e}else for(Ni=ha(h.stateNode.containerInfo.firstChild),Yr=h,qn=!0,zs=null,b=sf(h,null,A,b),h.child=b;b;)b.flags=b.flags&-3|4096,b=b.sibling;else{if(ol(),A===I){h=xc(u,h,b);break e}bt(u,h,A,b)}h=h.child}return h;case 5:return mc(h),u===null&&Bp(h),A=h.type,I=h.pendingProps,j=u!==null?u.memoizedProps:null,G=I.children,Mv(A,I)?G=null:j!==null&&Mv(A,j)&&(h.flags|=32),Ue(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),A=h.pendingProps,u===null?h.child=cc(h,null,A,b):bt(u,h,A,b),h.child;case 11:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Bs(A,I),Jr(u,h,A,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(A=h.type._context,I=h.pendingProps,j=h.memoizedProps,G=I.value,Gn(uc,A._currentValue),A._currentValue=G,j!==null)if(ds(j.value,G)){if(j.children===I.children&&!Pi.current){h=xc(u,h,b);break e}}else for(j=h.child,j!==null&&(j.return=h);j!==null;){var se=j.dependencies;if(se!==null){G=j.child;for(var he=se.firstContext;he!==null;){if(he.context===A){if(j.tag===1){he=zn(-1,b&-b),he.tag=2;var De=j.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}}j.lanes|=b,he=j.alternate,he!==null&&(he.lanes|=b),af(j.return,b,h),se.lanes|=b;break}he=he.next}}else if(j.tag===10)G=j.type===h.type?null:j.child;else if(j.tag===18){if(G=j.return,G===null)throw Error(n(341));G.lanes|=b,se=G.alternate,se!==null&&(se.lanes|=b),af(G,b,h),G=j.sibling}else G=j.child;if(G!==null)G.return=j;else for(G=j;G!==null;){if(G===h){G=null;break}if(j=G.sibling,j!==null){j.return=G.return,G=j;break}G=G.return}j=G}bt(u,h,I.children,b),h=h.child}return h;case 9:return I=h.type,A=h.pendingProps.children,al(h,b),I=ps(I),A=A(I),h.flags|=1,bt(u,h,A,b),h.child;case 14:return A=h.type,I=Bs(A,h.pendingProps),I=Bs(A.type,I),ys(u,h,A,I,b);case 15:return Ie(u,h,h.type,h.pendingProps,b);case 17:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Bs(A,I),Wx(u,h),h.tag=1,ui(A)?(u=!0,oc(h)):u=!1,al(h,b),p(h,A,I),M(h,A,I,b),on(null,h,A,!0,u,b);case 19:return lN(u,h,b);case 22:return be(u,h,b)}throw Error(n(156,h.tag))};function IN(u,h){return ke(u,h)}function hW(u,h,b,A){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=A,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Uo(u,h,b,A){return new hW(u,h,b,A)}function VM(u){return u=u.prototype,!(!u||!u.isReactComponent)}function pW(u){if(typeof u=="function")return VM(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 nb(u,h,b,A,I,j){var G=2;if(A=u,typeof u=="function")VM(u)&&(G=1);else if(typeof u=="string")G=5;else e:switch(u){case L:return _f(b.children,I,j,h);case F:G=8,I|=8;break;case V:return u=Uo(12,b,h,I|2),u.elementType=V,u.lanes=j,u;case ne:return u=Uo(13,b,h,I),u.elementType=ne,u.lanes=j,u;case te:return u=Uo(19,b,h,I),u.elementType=te,u.lanes=j,u;case ce:return rb(b,I,j,h);default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case k:G=10;break e;case U:G=9;break e;case H:G=11;break e;case pe:G=14;break e;case oe:G=16,A=null;break e}throw Error(n(130,u==null?u:typeof u,""))}return h=Uo(G,b,h,I),h.elementType=u,h.type=A,h.lanes=j,h}function _f(u,h,b,A){return u=Uo(7,u,A,h),u.lanes=b,u}function rb(u,h,b,A){return u=Uo(22,u,A,h),u.elementType=ce,u.lanes=b,u.stateNode={isHidden:!1},u}function GM(u,h,b){return u=Uo(6,u,null,h),u.lanes=b,u}function WM(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 mW(u,h,b,A,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=A,this.onRecoverableError=I,this.mutableSourceEagerHydrationData=null}function $M(u,h,b,A,I,j,G,se,he){return u=new mW(u,h,b,se,he),h===1?(h=1,j===!0&&(h|=8)):h=0,j=Uo(3,null,null,h),u.current=j,j.stateNode=u,j.memoizedState={element:A,isDehydrated:b,cache:null,transitions:null,pendingSuspenseBoundaries:null},an(j),u}function gW(u,h,b){var A=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),JM.exports=RW(),JM.exports}var XN;function NW(){if(XN)return db;XN=1;var t=GU();return db.createRoot=t.createRoot,db.hydrateRoot=t.hydrateRoot,db}var IW=NW();const kW=B1(IW);var V0=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,kU,OW=(kU=class extends V0{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,kU),pP=new OW,LW={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},fd,hP,OU,DW=(OU=class{constructor(){Wt(this,fd,LW);Wt(this,hP,!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,hP=new WeakMap,OU),Qf=new DW;function jW(t){setTimeout(t,0)}var UW=typeof window>"u"||"Deno"in globalThis;function Xs(){}function FW(t,e){return typeof t=="function"?t(e):t}function hT(t){return typeof t=="number"&&t>=0&&t!==1/0}function WU(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 qN(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:o,stale:a}=t;if(o){if(r){if(e.queryHash!==mP(o,e.options))return!1}else if(!n0(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 KN(t,e){const{exact:n,status:r,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(n){if(t0(e.options.mutationKey)!==t0(s))return!1}else if(!n0(e.options.mutationKey,s))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function mP(t,e){return((e==null?void 0:e.queryKeyHashFn)||t0)(t)}function t0(t){return JSON.stringify(t,(e,n)=>mT(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function n0(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>n0(t[n],e[n])):!1}var zW=Object.prototype.hasOwnProperty;function $U(t,e,n=0){if(t===e)return t;if(n>500)return e;const r=YN(t)&&YN(e);if(!r&&!(mT(t)&&mT(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{Qf.setTimeout(e,t)})}function gT(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?$U(t,e):e}function HW(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function VW(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var gP=Symbol();function XU(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===gP?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function qU(t,e){return typeof t=="function"?t(...e):!!t}function GW(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 r0=(()=>{let t=()=>UW;return{isServer(){return t()},setIsServer(e){t=e}}})();function vT(){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 WW=jW;function $W(){let t=[],e=0,n=a=>{a()},r=a=>{a()},i=WW;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=$W(),sg,hd,og,LU,XW=(LU=class extends V0{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,LU),J_=new XW;function qW(t){return Math.min(1e3*2**t,3e4)}function KU(t){return(t??"online")==="online"?J_.isOnline():!0}var yT=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function YU(t){let e=!1,n=0,r;const i=vT(),s=()=>i.status!=="pending",o=S=>{var _;if(!s()){const w=new yT(S);m(w),(_=t.onCancel)==null||_.call(t,w)}},a=()=>{e=!0},l=()=>{e=!1},c=()=>pP.isFocused()&&(t.networkMode==="always"||J_.isOnline())&&t.canRun(),d=()=>KU(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 E=t.retry??(r0.isServer()?0:3),T=t.retryDelay??qW,C=typeof T=="function"?T(n,w):T,O=E===!0||typeof E=="number"&&nc()?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,DU,ZU=(DU=class{constructor(){Wt(this,dh)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),hT(this.gcTime)&&wt(this,dh,Qf.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(r0.isServer()?1/0:300*1e3))}clearGcTimeout(){me(this,dh)!==void 0&&(Qf.clearTimeout(me(this,dh)),wt(this,dh,void 0))}},dh=new WeakMap,DU);function KW(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=>{GW(T,()=>e.signal,()=>S=!0)},w=XU(e.options,e.fetchOptions),E=async(T,C,O)=>{if(S)return Promise.reject(e.signal.reason);if(C==null&&T.pages.length)return Promise.resolve(T);const L=(()=>{const U={client:e.client,queryKey:e.queryKey,pageParam:C,direction:O?"backward":"forward",meta:e.options.meta};return _(U),U})(),F=await w(L),{maxPages:V}=e.options,k=O?VW:HW;return{pages:k(T.pages,F,V),pageParams:k(T.pageParams,C,V)}};if(i&&s.length){const T=i==="backward",C=T?YW:QN,O={pages:s,pageParams:o},N=C(r,O);a=await E(O,N,T)}else{const T=t??s.length;do{const C=l===0?o[0]??r.initialPageParam:QN(r,a);if(l>0&&C==null)break;a=await E(a,C),l++}while(l{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 QN(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 YW(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,Go,hh,gi,U0,ph,go,QU,Cc,jU,ZW=(jU=class extends ZU{constructor(e){super();Wt(this,go);Wt(this,ag);Wt(this,fh);Wt(this,lg);Wt(this,Go);Wt(this,hh);Wt(this,gi);Wt(this,U0);Wt(this,ph);wt(this,ph,!1),wt(this,U0,e.defaultOptions),this.setOptions(e.options),this.observers=[],wt(this,hh,e.client),wt(this,Go,me(this,hh).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,wt(this,fh,eI(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,U0),...e},e!=null&&e._type&&wt(this,ag,e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=eI(this.options);n.data!==void 0&&(this.setState(JN(n.data,n.dataUpdatedAt)),wt(this,fh,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&me(this,Go).remove(this)}setData(e,n){const r=gT(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===gP||!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:!WU(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,Go).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,QU).call(this)?me(this,gi).cancel({revert:!0}):me(this,gi).cancelRetry()),this.scheduleGc()),me(this,Go).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,E,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=XU(this.options,n),N=(()=>{const L={client:me(this,hh),queryKey:this.queryKey,meta:this.meta};return i(L),L})();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"?KW(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,YU({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:C=>{C instanceof yT&&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,Go).config).onSuccess)==null||y.call(m,C,this),(S=(x=me(this,Go).config).onSettled)==null||S.call(x,C,this.state.error,this),C}catch(C){if(C instanceof yT){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,Go).config).onError)==null||w.call(_,C,this),(T=(E=me(this,Go).config).onSettled)==null||T.call(E,this.state.data,C,this),C}finally{this.scheduleGc()}}},ag=new WeakMap,fh=new WeakMap,lg=new WeakMap,Go=new WeakMap,hh=new WeakMap,gi=new WeakMap,U0=new WeakMap,ph=new WeakMap,go=new WeakSet,QU=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,...JU(r.data,this.options),fetchMeta:e.meta??null};case"success":const i={...r,...JN(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,Go).notify({query:this,type:"updated",action:e})})},jU);function JU(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:KU(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function JN(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function eI(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,F0,ws,mh,cg,Ic,pd,z0,ug,dg,gh,vh,md,fg,Bn,Ly,xT,bT,_T,wT,ST,MT,ET,eF,UU,QW=(UU=class extends V0{constructor(e,n){super();Wt(this,Bn);Wt(this,$s);Wt(this,An);Wt(this,F0);Wt(this,ws);Wt(this,mh);Wt(this,cg);Wt(this,Ic);Wt(this,pd);Wt(this,z0);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,vT()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(me(this,An).addObserver(this),tI(me(this,An),this.options)?_n(this,Bn,Ly).call(this):this.updateResult(),_n(this,Bn,wT).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return AT(me(this,An),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return AT(me(this,An),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,_n(this,Bn,ST).call(this),_n(this,Bn,MT).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,ET).call(this),me(this,An).setOptions(this.options),n._defaulted&&!pT(this.options,n)&&me(this,$s).getQueryCache().notify({type:"observerOptionsUpdated",query:me(this,An),observer:this});const i=this.hasListeners();i&&nI(me(this,An),r,this.options,n)&&_n(this,Bn,Ly).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,xT).call(this);const s=_n(this,Bn,bT).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,_T).call(this,s)}getOptimisticResult(e){const n=me(this,$s).getQueryCache().build(me(this,$s),e),r=this.createResult(n,e);return e8(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,Ly).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,F0),{state:d}=e;let f={...d},m=!1,y;if(n._optimisticResults){const k=this.hasListeners(),U=!k&&tI(e,n),H=k&&nI(e,r,n,i);(U||H)&&(f={...f,...JU(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=gT(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,z0))y=me(this,ug);else try{wt(this,z0,n.select),y=n.select(y),y=gT(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 E=f.fetchStatus==="fetching",T=_==="pending",C=_==="error",O=T&&E,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:E,isRefetching:E&&!T,isLoadingError:C&&!N,isPaused:f.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:C&&N,isStale:vP(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,U=F.status==="error"&&!k,H=pe=>{U?pe.reject(F.error):k&&pe.resolve(F.data)},ne=()=>{const pe=wt(this,Ic,F.promise=vT());H(pe)},te=me(this,Ic);switch(te.status){case"pending":e.queryHash===r.queryHash&&H(te);break;case"fulfilled":(U||F.data!==te.value)&&ne();break;case"rejected":(!U||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)),pT(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,eF).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&_n(this,Bn,wT).call(this)}},$s=new WeakMap,An=new WeakMap,F0=new WeakMap,ws=new WeakMap,mh=new WeakMap,cg=new WeakMap,Ic=new WeakMap,pd=new WeakMap,z0=new WeakMap,ug=new WeakMap,dg=new WeakMap,gh=new WeakMap,vh=new WeakMap,md=new WeakMap,fg=new WeakMap,Bn=new WeakSet,Ly=function(e){_n(this,Bn,ET).call(this);let n=me(this,An).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(Xs)),n},xT=function(){_n(this,Bn,ST).call(this);const e=bd(this.options.staleTime,me(this,An));if(r0.isServer()||me(this,ws).isStale||!hT(e))return;const r=WU(me(this,ws).dataUpdatedAt,e)+1;wt(this,gh,Qf.setTimeout(()=>{me(this,ws).isStale||this.updateResult()},r))},bT=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(me(this,An)):this.options.refetchInterval)??!1},_T=function(e){_n(this,Bn,MT).call(this),wt(this,md,e),!(r0.isServer()||vo(this.options.enabled,me(this,An))===!1||!hT(me(this,md))||me(this,md)===0)&&wt(this,vh,Qf.setInterval(()=>{(this.options.refetchIntervalInBackground||pP.isFocused())&&_n(this,Bn,Ly).call(this)},me(this,md)))},wT=function(){_n(this,Bn,xT).call(this),_n(this,Bn,_T).call(this,_n(this,Bn,bT).call(this))},ST=function(){me(this,gh)!==void 0&&(Qf.clearTimeout(me(this,gh)),wt(this,gh,void 0))},MT=function(){me(this,vh)!==void 0&&(Qf.clearInterval(me(this,vh)),wt(this,vh,void 0))},ET=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,F0,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},eF=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"})})},UU);function JW(t,e){return vo(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&vo(e.retryOnMount,t)===!1)}function tI(t,e){return JW(t,e)||t.state.data!==void 0&&AT(t,e,e.refetchOnMount)}function AT(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&&vP(t,e)}return!1}function nI(t,e,n,r){return(t!==e||vo(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&vP(t,n)}function vP(t,e){return vo(e.enabled,t)!==!1&&t.isStaleByTime(bd(e.staleTime,t))}function e8(t,e){return!pT(t.getCurrentResult(),e)}var B0,yl,ts,yh,xl,sd,FU,t8=(FU=class extends ZU{constructor(e){super();Wt(this,xl);Wt(this,B0);Wt(this,yl);Wt(this,ts);Wt(this,yh);wt(this,B0,e.client),this.mutationId=e.mutationId,wt(this,ts,e.mutationCache),wt(this,yl,[]),this.state=e.state||n8(),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,E,T,C,O,N,L;const n=()=>{_n(this,xl,sd).call(this,{type:"continue"})},r={client:me(this,B0),meta:this.options.meta,mutationKey:this.options.mutationKey};wt(this,yh,YU({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=(E=this.options).onError)==null?void 0:T.call(E,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((L=(N=this.options).onSettled)==null?void 0:L.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)}}},B0=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})})},FU);function n8(){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,H0,zU,r8=(zU=class extends V0{constructor(e={}){super();Wt(this,kc);Wt(this,La);Wt(this,H0);this.config=e,wt(this,kc,new Set),wt(this,La,new Map),wt(this,H0,0)}build(e,n,r){const i=new t8({client:e,mutationCache:this,mutationId:++ub(this,H0)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){me(this,kc).add(e);const n=fb(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=fb(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=fb(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=fb(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=>KN(n,r))}findAll(e={}){return this.getAll().filter(n=>KN(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,H0=new WeakMap,zU);function fb(t){var e;return(e=t.options.scope)==null?void 0:e.id}var bl,BU,i8=(BU=class extends V0{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??mP(i,n);let o=this.get(s);return o||(o=new ZW({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=>qN(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>qN(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,BU),Sr,gd,vd,hg,pg,yd,mg,gg,HU,s8=(HU=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 i8),wt(this,gd,t.mutationCache||new r8),wt(this,vd,t.defaultOptions||{}),wt(this,hg,new Map),wt(this,pg,new Map),wt(this,yd,0)}mount(){ub(this,yd)._++,me(this,yd)===1&&(wt(this,mg,pP.subscribe(async t=>{t&&(await this.resumePausedMutations(),me(this,Sr).onFocus())})),wt(this,gg,J_.subscribe(async t=>{t&&(await this.resumePausedMutations(),me(this,Sr).onOnline())})))}unmount(){var t,e;ub(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=FW(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 J_.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(t0(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...me(this,hg).values()],n={};return e.forEach(r=>{n0(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){me(this,pg).set(t0(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...me(this,pg).values()],n={};return e.forEach(r=>{n0(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=mP(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===gP&&(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,HU),tF=R.createContext(void 0),$h=t=>{const e=R.useContext(tF);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},o8=({client:t,children:e})=>(R.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),v.jsx(tF.Provider,{value:t,children:e})),nF=R.createContext(!1),a8=()=>R.useContext(nF);nF.Provider;function l8(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var c8=R.createContext(l8()),u8=()=>R.useContext(c8),d8=(t,e,n)=>{const r=n!=null&&n.state.error&&typeof t.throwOnError=="function"?qU(t.throwOnError,[n.state.error,n]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},f8=t=>{R.useEffect(()=>{t.clearReset()},[t])},h8=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||qU(n,[t.error,r])),p8=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))}},m8=(t,e)=>t.isLoading&&t.isFetching&&!e,g8=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,rI=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function v8(t,e,n){var y,x,S,_;const r=a8(),i=u8(),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,p8(o),d8(o,i,a),f8(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 E=m?d.subscribe(Fi.batchCalls(w)):Xs;return d.updateResult(),E},[d,m]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),R.useEffect(()=>{d.setOptions(o)},[o,d]),g8(o,f))throw rI(o,d,i);if(h8({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&&!r0.isServer()&&m8(f,r)){const w=c?rI(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 v8(t,QW)}/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -437,7 +437,7 @@ Error generating stack: `+j.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const xh=vt("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"}]]),OT=[{id:"dashboard",label:"Zentrale",hint:"System- & Stack-Status",icon:z8},{id:"models",label:"Modell-Manager",hint:"Verwalten, laden & Gateway-Routing",icon:CT},{id:"memory",label:"Gedächtnis",hint:"Geteiltes Memory verwalten",icon:V1},{id:"connect",label:"Verbinden",hint:"IDE-/Agent-Configs erzeugen",icon:NT},{id:"agent",label:"Hermes",hint:"Agent-Status & Verdrahtung",icon:qc},{id:"terminal",label:"Terminal",hint:"Interaktives Hermes-Agent-Terminal",icon:aF},{id:"voice",label:"Sprechen",hint:"Mit Hermes per Sprache reden (3D-Avatar)",icon:oF},{id:"guide",label:"Anleitung",hint:"Einrichten & Vibe-Coding",icon:C8}];var aI=1,a9=.9,l9=.8,c9=.17,rE=.1,iE=.999,u9=.9999,d9=.99,f9=/[\\\/_+.#"@\[\(\{&]/,h9=/[\\\/_+.#"@\[\(\{&]/g,p9=/[\s-]/,uF=/[\s-]/g;function LT(t,e,n,r,i,s,o){if(s===e.length)return i===t.length?aI:d9;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=LT(t,e,n,r,c+1,s+1,o),f>d&&(c===i?f*=aI:f9.test(t.charAt(c-1))?(f*=l9,y=t.slice(i,c-1).match(h9),y&&i>0&&(f*=Math.pow(iE,y.length))):p9.test(t.charAt(c-1))?(f*=a9,x=t.slice(i,c-1).match(uF),x&&i>0&&(f*=Math.pow(iE,x.length))):(f*=c9,i>0&&(f*=Math.pow(iE,c-i))),t.charAt(c)!==e.charAt(s)&&(f*=u9)),(ff&&(f=m*rE)),f>d&&(d=f),c=n.indexOf(l,c+1);return o[a]=d,d}function lI(t){return t.toLowerCase().replace(uF," ")}function m9(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,LT(t,e,lI(t),lI(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 cI(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function bg(...t){return e=>{let n=!1;const r=t.map(i=>{const s=cI(i,e);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i{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,v9(i,...e)]}function v9(...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 o0=globalThis!=null&&globalThis.document?R.useLayoutEffect:()=>{},y9=H1[" useId ".trim().toString()]||(()=>{}),x9=0;function Hc(t){const[e,n]=R.useState(y9());return o0(()=>{n(r=>r??String(x9++))},[t]),e?`radix-${e}`:""}var b9=H1[" useInsertionEffect ".trim().toString()]||o0;function _9({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[i,s,o]=w9({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=S9(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 w9({defaultProp:t,onChange:e}){const[n,r]=R.useState(t),i=R.useRef(n),s=R.useRef(e);return b9(()=>{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 S9(t){return typeof t=="function"}var W1=GU();function dF(t){const e=R.forwardRef((n,r)=>{let{children:i,...s}=n,o=null,a=!1;const l=[];uI(i)&&typeof hb=="function"&&(i=hb(i._payload)),R.Children.forEach(i,m=>{var y;if(C9(m)){a=!0;const x=m;let S="child"in x.props?x.props.child:x.props.children;uI(S)&&typeof hb=="function"&&(S=hb(S._payload)),o=E9(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?T9(o):void 0,d=Xh(r,c);if(!o){if(i||i===0)throw new Error(a?I9(t):N9(t));return i}const f=A9(s,o.props??{});return o.type!==R.Fragment&&(f.ref=r?d:c),R.cloneElement(o,f)});return e.displayName=`${t}.Slot`,e}var M9=Symbol.for("radix.slottable"),E9=(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 A9(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 T9(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 C9(t){return R.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===M9}var P9=Symbol.for("react.lazy");function uI(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===P9&&"_payload"in t&&R9(t._payload)}function R9(t){return typeof t=="object"&&t!==null&&"then"in t}var N9=t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,I9=t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,hb=H1[" use ".trim().toString()],k9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Vi=k9.reduce((t,e)=>{const n=dF(`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 O9(t,e){t&&W1.flushSync(()=>t.dispatchEvent(e))}function a0(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 L9(t,e=globalThis==null?void 0:globalThis.document){const n=a0(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 D9="DismissableLayer",DT="dismissableLayer.update",j9="dismissableLayer.pointerDownOutside",U9="dismissableLayer.focusOutside",dI,_P=R.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),fF=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(_P),[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),E=_.indexOf(w),T=f?_.indexOf(f):-1,C=d.layersWithOutsidePointerEventsDisabled.size>0,O=T>=E,N=R.useRef(!1),L=H9(V=>{const k=V.target;if(!(k instanceof Node))return;const U=[...d.branches].some(H=>H.contains(k));!O||U||(s==null||s(V),a==null||a(V),V.defaultPrevented||l==null||l())},{ownerDocument:y,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:N,dismissableSurfaces:d.dismissableSurfaces}),F=V9(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 L9(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&&(dI=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),fI(),()=>{n&&(d.layersWithOutsidePointerEventsDisabled.delete(f),d.layersWithOutsidePointerEventsDisabled.size===0&&(y.body.style.pointerEvents=dI))}},[f,y,n,d]),R.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),fI())},[f,d]),R.useEffect(()=>{const V=()=>x({});return document.addEventListener(DT,V),()=>document.removeEventListener(DT,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,L.onPointerDownCapture)})});fF.displayName=D9;var F9="DismissableLayerBranch",z9=R.forwardRef((t,e)=>{const n=R.useContext(_P),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})});z9.displayName=F9;function B9(){const t=R.useContext(_P),[e,n]=R.useState(null);return R.useEffect(()=>{if(e)return t.dismissableSurfaces.add(e),()=>{t.dismissableSurfaces.delete(e)}},[e,t.dismissableSurfaces]),n}function H9(t,e){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:s}=e,o=a0(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(E){if(!l.current)return;const T=E.target;T instanceof Node&&[...s].some(O=>O.contains(T))||c.current.set(E.type,!0),E.type==="click"&&window.setTimeout(()=>{l.current&&d.current()},0)}function x(E){l.current&&c.current.set(E.type,!1)}const S=E=>{if(E.target&&!a.current){let T=function(){n.removeEventListener("click",d.current);const O=m();f(),O||hF(j9,o,C,{discrete:!0})};const C={originalEvent:E};l.current=!0,i.current=r&&E.button===0,c.current.clear(),!r||E.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 E of _)n.addEventListener(E,y,!0),n.addEventListener(E,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 E of _)n.removeEventListener(E,y,!0),n.removeEventListener(E,x)}},[n,o,r,i,s]),{onPointerDownCapture:()=>a.current=!0}}function V9(t,e=globalThis==null?void 0:globalThis.document){const n=a0(t),r=R.useRef(!1);return R.useEffect(()=>{const i=s=>{s.target&&!r.current&&hF(U9,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 fI(){const t=new CustomEvent(DT);document.dispatchEvent(t)}function hF(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?O9(i,s):i.dispatchEvent(s)}var sE="focusScope.autoFocusOnMount",oE="focusScope.autoFocusOnUnmount",hI={bubbles:!1,cancelable:!0},G9="FocusScope",pF=R.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=t,[a,l]=R.useState(null),c=a0(i),d=a0(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 E=new MutationObserver(w);return a&&E.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",_),E.disconnect()}}},[r,a,y.paused]),R.useEffect(()=>{if(a){mI.add(y);const S=document.activeElement;if(!a.contains(S)){const w=new CustomEvent(sE,hI);a.addEventListener(sE,c),a.dispatchEvent(w),w.defaultPrevented||(W9(Y9(mF(a)),{select:!0}),document.activeElement===S&&od(a))}return()=>{a.removeEventListener(sE,c),setTimeout(()=>{const w=new CustomEvent(oE,hI);a.addEventListener(oE,d),a.dispatchEvent(w),w.defaultPrevented||od(S??document.body,{select:!0}),a.removeEventListener(oE,d),mI.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 E=S.currentTarget,[T,C]=$9(E);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===E&&S.preventDefault()}},[n,r,y.paused]);return v.jsx(Vi.div,{tabIndex:-1,...o,ref:m,onKeyDown:x})});pF.displayName=G9;function W9(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(od(r,{select:e}),document.activeElement!==n)return}function $9(t){const e=mF(t),n=pI(e,t),r=pI(e.reverse(),t);return[n,r]}function mF(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 pI(t,e){for(const n of t)if(!X9(n,{upTo:e}))return n}function X9(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 q9(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&&q9(t)&&e&&t.select()}}var mI=K9();function K9(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=gI(t,e),t.unshift(e)},remove(e){var n;t=gI(t,e),(n=t[0])==null||n.resume()}}}function gI(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function Y9(t){return t.filter(e=>e.tagName!=="A")}var Z9="Portal",gF=R.forwardRef((t,e)=>{var a;const{container:n,...r}=t,[i,s]=R.useState(!1);o0(()=>s(!0),[]);const o=n||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?W1.createPortal(v.jsx(Vi.div,{...r,ref:e}),o):null});gF.displayName=Z9;function Q9(t,e){return R.useReducer((n,r)=>e[n][r]??n,t)}var $1=t=>{const{present:e,children:n}=t,r=J9(e),i=typeof n=="function"?n({present:r.isPresent}):R.Children.only(n),s=e$(r.ref,t$(i));return typeof n=="function"||r.isPresent?R.cloneElement(i,{ref:s}):null};$1.displayName="Presence";function J9(t){const[e,n]=R.useState(),r=R.useRef(null),i=R.useRef(t),s=R.useRef("none"),o=t?"mounted":"unmounted",[a,l]=Q9(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return R.useEffect(()=>{const c=pb(r.current);s.current=a==="mounted"?c:"none"},[a]),o0(()=>{const c=r.current,d=i.current;if(d!==t){const m=s.current,y=pb(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]),o0(()=>{if(e){let c;const d=e.ownerDocument.defaultView??window,f=y=>{const S=pb(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=pb(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 vI(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function e$(...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=vI(o,n);return!i&&typeof a=="function"&&(i=!0),a});if(i)return()=>{for(let o=0;o{ul||(ul={start:yI(),end:yI()});const{start:t,end:e}=ul;return document.body.firstElementChild!==t&&document.body.insertAdjacentElement("afterbegin",t),document.body.lastElementChild!==e&&document.body.insertAdjacentElement("beforeend",e),mb++,()=>{mb===1&&(ul==null||ul.start.remove(),ul==null||ul.end.remove(),ul=null),mb=Math.max(0,mb-1)}},[])}function yI(){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"u")return x$;var e=b$(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])}},w$=bF(),Ym="data-scroll-locked",S$=function(t,e,n,r){var i=t.left,s=t.top,o=t.right,a=t.gap;return n===void 0&&(n="margin"),` + */const xh=vt("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"}]]),OT=[{id:"dashboard",label:"Zentrale",hint:"System- & Stack-Status",icon:z8},{id:"models",label:"Modell-Manager",hint:"Verwalten, laden & Gateway-Routing",icon:CT},{id:"memory",label:"Gedächtnis",hint:"Geteiltes Memory verwalten",icon:V1},{id:"connect",label:"Verbinden",hint:"IDE-/Agent-Configs erzeugen",icon:NT},{id:"agent",label:"Hermes",hint:"Agent-Status & Verdrahtung",icon:qc},{id:"terminal",label:"Terminal",hint:"Interaktives Hermes-Agent-Terminal",icon:aF},{id:"voice",label:"Sprechen",hint:"Mit Hermes per Sprache reden (3D-Avatar)",icon:oF},{id:"guide",label:"Anleitung",hint:"Einrichten & Vibe-Coding",icon:C8}];var aI=1,a9=.9,l9=.8,c9=.17,rE=.1,iE=.999,u9=.9999,d9=.99,f9=/[\\\/_+.#"@\[\(\{&]/,h9=/[\\\/_+.#"@\[\(\{&]/g,p9=/[\s-]/,uF=/[\s-]/g;function LT(t,e,n,r,i,s,o){if(s===e.length)return i===t.length?aI:d9;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=LT(t,e,n,r,c+1,s+1,o),f>d&&(c===i?f*=aI:f9.test(t.charAt(c-1))?(f*=l9,y=t.slice(i,c-1).match(h9),y&&i>0&&(f*=Math.pow(iE,y.length))):p9.test(t.charAt(c-1))?(f*=a9,x=t.slice(i,c-1).match(uF),x&&i>0&&(f*=Math.pow(iE,x.length))):(f*=c9,i>0&&(f*=Math.pow(iE,c-i))),t.charAt(c)!==e.charAt(s)&&(f*=u9)),(ff&&(f=m*rE)),f>d&&(d=f),c=n.indexOf(l,c+1);return o[a]=d,d}function lI(t){return t.toLowerCase().replace(uF," ")}function m9(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,LT(t,e,lI(t),lI(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 cI(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function bg(...t){return e=>{let n=!1;const r=t.map(i=>{const s=cI(i,e);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i{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,v9(i,...e)]}function v9(...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 o0=globalThis!=null&&globalThis.document?R.useLayoutEffect:()=>{},y9=H1[" useId ".trim().toString()]||(()=>{}),x9=0;function Hc(t){const[e,n]=R.useState(y9());return o0(()=>{n(r=>r??String(x9++))},[t]),e?`radix-${e}`:""}var b9=H1[" useInsertionEffect ".trim().toString()]||o0;function _9({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[i,s,o]=w9({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=S9(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 w9({defaultProp:t,onChange:e}){const[n,r]=R.useState(t),i=R.useRef(n),s=R.useRef(e);return b9(()=>{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 S9(t){return typeof t=="function"}var W1=GU();function dF(t){const e=R.forwardRef((n,r)=>{let{children:i,...s}=n,o=null,a=!1;const l=[];uI(i)&&typeof hb=="function"&&(i=hb(i._payload)),R.Children.forEach(i,m=>{var y;if(C9(m)){a=!0;const x=m;let S="child"in x.props?x.props.child:x.props.children;uI(S)&&typeof hb=="function"&&(S=hb(S._payload)),o=E9(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?T9(o):void 0,d=Xh(r,c);if(!o){if(i||i===0)throw new Error(a?I9(t):N9(t));return i}const f=A9(s,o.props??{});return o.type!==R.Fragment&&(f.ref=r?d:c),R.cloneElement(o,f)});return e.displayName=`${t}.Slot`,e}var M9=Symbol.for("radix.slottable"),E9=(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 A9(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 T9(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 C9(t){return R.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===M9}var P9=Symbol.for("react.lazy");function uI(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===P9&&"_payload"in t&&R9(t._payload)}function R9(t){return typeof t=="object"&&t!==null&&"then"in t}var N9=t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,I9=t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,hb=H1[" use ".trim().toString()],k9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Vi=k9.reduce((t,e)=>{const n=dF(`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 O9(t,e){t&&W1.flushSync(()=>t.dispatchEvent(e))}function a0(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 L9(t,e=globalThis==null?void 0:globalThis.document){const n=a0(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 D9="DismissableLayer",DT="dismissableLayer.update",j9="dismissableLayer.pointerDownOutside",U9="dismissableLayer.focusOutside",dI,_P=R.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),fF=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(_P),[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),E=_.indexOf(w),T=f?_.indexOf(f):-1,C=d.layersWithOutsidePointerEventsDisabled.size>0,O=T>=E,N=R.useRef(!1),L=H9(V=>{const k=V.target;if(!(k instanceof Node))return;const U=[...d.branches].some(H=>H.contains(k));!O||U||(s==null||s(V),a==null||a(V),V.defaultPrevented||l==null||l())},{ownerDocument:y,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:N,dismissableSurfaces:d.dismissableSurfaces}),F=V9(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 L9(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&&(dI=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),fI(),()=>{n&&(d.layersWithOutsidePointerEventsDisabled.delete(f),d.layersWithOutsidePointerEventsDisabled.size===0&&(y.body.style.pointerEvents=dI))}},[f,y,n,d]),R.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),fI())},[f,d]),R.useEffect(()=>{const V=()=>x({});return document.addEventListener(DT,V),()=>document.removeEventListener(DT,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,L.onPointerDownCapture)})});fF.displayName=D9;var F9="DismissableLayerBranch",z9=R.forwardRef((t,e)=>{const n=R.useContext(_P),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})});z9.displayName=F9;function B9(){const t=R.useContext(_P),[e,n]=R.useState(null);return R.useEffect(()=>{if(e)return t.dismissableSurfaces.add(e),()=>{t.dismissableSurfaces.delete(e)}},[e,t.dismissableSurfaces]),n}function H9(t,e){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:s}=e,o=a0(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(E){if(!l.current)return;const T=E.target;T instanceof Node&&[...s].some(O=>O.contains(T))||c.current.set(E.type,!0),E.type==="click"&&window.setTimeout(()=>{l.current&&d.current()},0)}function x(E){l.current&&c.current.set(E.type,!1)}const S=E=>{if(E.target&&!a.current){let T=function(){n.removeEventListener("click",d.current);const O=m();f(),O||hF(j9,o,C,{discrete:!0})};const C={originalEvent:E};l.current=!0,i.current=r&&E.button===0,c.current.clear(),!r||E.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 E of _)n.addEventListener(E,y,!0),n.addEventListener(E,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 E of _)n.removeEventListener(E,y,!0),n.removeEventListener(E,x)}},[n,o,r,i,s]),{onPointerDownCapture:()=>a.current=!0}}function V9(t,e=globalThis==null?void 0:globalThis.document){const n=a0(t),r=R.useRef(!1);return R.useEffect(()=>{const i=s=>{s.target&&!r.current&&hF(U9,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 fI(){const t=new CustomEvent(DT);document.dispatchEvent(t)}function hF(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?O9(i,s):i.dispatchEvent(s)}var sE="focusScope.autoFocusOnMount",oE="focusScope.autoFocusOnUnmount",hI={bubbles:!1,cancelable:!0},G9="FocusScope",pF=R.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=t,[a,l]=R.useState(null),c=a0(i),d=a0(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 E=new MutationObserver(w);return a&&E.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",_),E.disconnect()}}},[r,a,y.paused]),R.useEffect(()=>{if(a){mI.add(y);const S=document.activeElement;if(!a.contains(S)){const w=new CustomEvent(sE,hI);a.addEventListener(sE,c),a.dispatchEvent(w),w.defaultPrevented||(W9(Y9(mF(a)),{select:!0}),document.activeElement===S&&od(a))}return()=>{a.removeEventListener(sE,c),setTimeout(()=>{const w=new CustomEvent(oE,hI);a.addEventListener(oE,d),a.dispatchEvent(w),w.defaultPrevented||od(S??document.body,{select:!0}),a.removeEventListener(oE,d),mI.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 E=S.currentTarget,[T,C]=$9(E);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===E&&S.preventDefault()}},[n,r,y.paused]);return v.jsx(Vi.div,{tabIndex:-1,...o,ref:m,onKeyDown:x})});pF.displayName=G9;function W9(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(od(r,{select:e}),document.activeElement!==n)return}function $9(t){const e=mF(t),n=pI(e,t),r=pI(e.reverse(),t);return[n,r]}function mF(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 pI(t,e){for(const n of t)if(!X9(n,{upTo:e}))return n}function X9(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 q9(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&&q9(t)&&e&&t.select()}}var mI=K9();function K9(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=gI(t,e),t.unshift(e)},remove(e){var n;t=gI(t,e),(n=t[0])==null||n.resume()}}}function gI(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function Y9(t){return t.filter(e=>e.tagName!=="A")}var Z9="Portal",gF=R.forwardRef((t,e)=>{var a;const{container:n,...r}=t,[i,s]=R.useState(!1);o0(()=>s(!0),[]);const o=n||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?W1.createPortal(v.jsx(Vi.div,{...r,ref:e}),o):null});gF.displayName=Z9;function Q9(t,e){return R.useReducer((n,r)=>e[n][r]??n,t)}var $1=t=>{const{present:e,children:n}=t,r=J9(e),i=typeof n=="function"?n({present:r.isPresent}):R.Children.only(n),s=e$(r.ref,t$(i));return typeof n=="function"||r.isPresent?R.cloneElement(i,{ref:s}):null};$1.displayName="Presence";function J9(t){const[e,n]=R.useState(),r=R.useRef(null),i=R.useRef(t),s=R.useRef("none"),o=t?"mounted":"unmounted",[a,l]=Q9(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return R.useEffect(()=>{const c=pb(r.current);s.current=a==="mounted"?c:"none"},[a]),o0(()=>{const c=r.current,d=i.current;if(d!==t){const m=s.current,y=pb(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]),o0(()=>{if(e){let c;const d=e.ownerDocument.defaultView??window,f=y=>{const S=pb(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=pb(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 vI(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function e$(...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=vI(o,n);return!i&&typeof a=="function"&&(i=!0),a});if(i)return()=>{for(let o=0;o{dl||(dl={start:yI(),end:yI()});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),mb++,()=>{mb===1&&(dl==null||dl.start.remove(),dl==null||dl.end.remove(),dl=null),mb=Math.max(0,mb-1)}},[])}function yI(){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"u")return x$;var e=b$(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])}},w$=bF(),Ym="data-scroll-locked",S$=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(i$,` { overflow: hidden `).concat(r,`; padding-right: `).concat(a,"px ").concat(r,`; @@ -477,7 +477,7 @@ Error generating stack: `+j.message+` `)},bI=function(){var t=parseInt(document.body.getAttribute(Ym)||"0",10);return isFinite(t)?t:0},M$=function(){R.useEffect(function(){return document.body.setAttribute(Ym,(bI()+1).toString()),function(){var t=bI()-1;t<=0?document.body.removeAttribute(Ym):document.body.setAttribute(Ym,t.toString())}},[])},E$=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;M$();var s=R.useMemo(function(){return _$(i)},[i]);return R.createElement(w$,{styles:S$(s,!e,i,n?"":"!important")})},jT=!1;if(typeof window<"u")try{var gb=Object.defineProperty({},"passive",{get:function(){return jT=!0,!0}});window.addEventListener("test",gb,gb),window.removeEventListener("test",gb,gb)}catch{jT=!1}var tm=jT?{passive:!1}:!1,A$=function(t){return t.tagName==="TEXTAREA"},_F=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!A$(t)&&n[e]==="visible")},T$=function(t){return _F(t,"overflowY")},C$=function(t){return _F(t,"overflowX")},_I=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=wF(t,r);if(i){var s=SF(t,r),o=s[1],a=s[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},P$=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},R$=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},wF=function(t,e){return t==="v"?T$(e):C$(e)},SF=function(t,e){return t==="v"?P$(e):R$(e)},N$=function(t,e){return t==="h"&&e==="rtl"?-1:1},I$=function(t,e,n,r,i){var s=N$(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=SF(t,a),x=y[0],S=y[1],_=y[2],w=S-_-s*x;(x||w)&&wF(t,a)&&(f+=w,m+=x);var E=a.parentNode;a=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}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},vb=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},wI=function(t){return[t.deltaX,t.deltaY]},SI=function(t){return t&&"current"in t?t.current:t},k$=function(t,e){return t[0]===e[0]&&t[1]===e[1]},O$=function(t){return` .block-interactivity-`.concat(t,` {pointer-events: none;} .allow-interactivity-`).concat(t,` {pointer-events: all;} -`)},L$=0,nm=[];function D$(t){var e=R.useRef([]),n=R.useRef([0,0]),r=R.useRef(),i=R.useState(L$++)[0],s=R.useState(bF)[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=r$([t.lockRef.current],(t.shards||[]).map(SI),!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=vb(S),E=n.current,T="deltaX"in S?S.deltaX:E[0]-w[0],C="deltaY"in S?S.deltaY:E[1]-w[1],O,N=S.target,L=Math.abs(T)>Math.abs(C)?"h":"v";if("touches"in S&&L==="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 U=_I(L,N);if(!U)return!0;if(U?O=L:(O=L==="v"?"h":"v",U=_I(L,N)),!U)return!1;if(!r.current&&"changedTouches"in S&&(T||C)&&(r.current=O),!O)return!0;var H=r.current||O;return I$(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 _?wI(_):vb(_),E=e.current.filter(function(O){return O.name===_.type&&(O.target===_.target||_.target===O.shadowParent)&&k$(O.delta,w)})[0];if(E&&E.should){_.cancelable&&_.preventDefault();return}if(!E){var T=(o.current.shards||[]).map(SI).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,E){var T={name:S,delta:_,target:w,should:E,shadowParent:j$(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=vb(S),r.current=void 0},[]),f=R.useCallback(function(S){c(S.type,wI(S),S.target,a(S,t.lockRef.current))},[]),m=R.useCallback(function(S){c(S.type,vb(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:O$(i)}):null,y?R.createElement(E$,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function j$(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const U$=f$(xF,D$);var MF=R.forwardRef(function(t,e){return R.createElement(X1,_l({},t,{ref:e,sideCar:U$}))});MF.classNames=X1.classNames;var F$=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},rm=new WeakMap,yb=new WeakMap,xb={},uE=0,EF=function(t){return t&&(t.host||EF(t.parentNode))},z$=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=EF(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})},B$=function(t,e,n,r){var i=z$(e,Array.isArray(t)?t:[t]);xb[n]||(xb[n]=new WeakMap);var s=xb[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&&yb.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(),uE++,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||(yb.has(f)||f.removeAttribute(r),yb.delete(f)),y||f.removeAttribute(n)}),uE--,uE||(rm=new WeakMap,rm=new WeakMap,yb=new WeakMap,xb={})}},H$=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=F$(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),B$(r,i,n,"aria-hidden")):function(){return null}},q1="Dialog",[AF]=g9(q1),[V$,Ga]=AF(q1),TF=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]=_9({prop:r,defaultProp:i??!1,onChange:s,caller:q1});return v.jsx(V$,{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})};TF.displayName=q1;var CF="DialogTrigger",G$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Ga(CF,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":SP(i.open),...r,ref:s,onClick:_d(t.onClick,i.onOpenToggle)})});G$.displayName=CF;var wP="DialogPortal",[W$,PF]=AF(wP,{forceMount:void 0}),RF=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:i}=t,s=Ga(wP,e);return v.jsx(W$,{scope:e,forceMount:n,children:R.Children.map(r,o=>v.jsx($1,{present:n||s.open,children:v.jsx(gF,{asChild:!0,container:i,children:o})}))})};RF.displayName=wP;var nw="DialogOverlay",NF=R.forwardRef((t,e)=>{const n=PF(nw,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=Ga(nw,t.__scopeDialog);return s.modal?v.jsx($1,{present:r||s.open,children:v.jsx(X$,{...i,ref:e})}):null});NF.displayName=nw;var $$=dF("DialogOverlay.RemoveScroll"),X$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Ga(nw,n),s=B9(),o=Xh(e,s);return v.jsx(MF,{as:$$,allowPinchZoom:!0,shards:[i.contentRef],children:v.jsx(Vi.div,{"data-state":SP(i.open),...r,ref:o,style:{pointerEvents:"auto",...r.style}})})}),_g="DialogContent",IF=R.forwardRef((t,e)=>{const n=PF(_g,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=Ga(_g,t.__scopeDialog);return v.jsx($1,{present:r||s.open,children:s.modal?v.jsx(q$,{...i,ref:e}):v.jsx(K$,{...i,ref:e})})});IF.displayName=_g;var q$=R.forwardRef((t,e)=>{const n=Ga(_g,t.__scopeDialog),r=R.useRef(null),i=Xh(e,n.contentRef,r);return R.useEffect(()=>{const s=r.current;if(s)return H$(s)},[]),v.jsx(kF,{...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())})}),K$=R.forwardRef((t,e)=>{const n=Ga(_g,t.__scopeDialog),r=R.useRef(!1),i=R.useRef(!1);return v.jsx(kF,{...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()}})}),kF=R.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,...o}=t,a=Ga(_g,n);return n$(),v.jsx(v.Fragment,{children:v.jsx(pF,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:v.jsx(fF,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":SP(a.open),...o,ref:e,deferPointerDownOutside:!0,onDismiss:()=>a.onOpenChange(!1)})})})}),OF="DialogTitle",Y$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Ga(OF,n);return v.jsx(Vi.h2,{id:i.titleId,...r,ref:e})});Y$.displayName=OF;var LF="DialogDescription",Z$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Ga(LF,n);return v.jsx(Vi.p,{id:i.descriptionId,...r,ref:e})});Z$.displayName=LF;var DF="DialogClose",Q$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Ga(DF,n);return v.jsx(Vi.button,{type:"button",...r,ref:e,onClick:_d(t.onClick,()=>i.onOpenChange(!1))})});Q$.displayName=DF;function SP(t){return t?"open":"closed"}var ty='[cmdk-group=""]',dE='[cmdk-group-items=""]',J$='[cmdk-group-heading=""]',jF='[cmdk-item=""]',MI=`${jF}:not([aria-disabled="true"])`,UT="cmdk-item-select",Dm="data-value",e7=(t,e,n)=>m9(t,e,n),UF=R.createContext(void 0),G0=()=>R.useContext(UF),FF=R.createContext(void 0),MP=()=>R.useContext(FF),zF=R.createContext(void 0),BF=R.forwardRef((t,e)=>{let n=jm(()=>{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=jm(()=>new Set),i=jm(()=>new Map),s=jm(()=>new Map),o=jm(()=>new Set),a=HF(t),{label:l,children:c,value:d,onValueChange:f,filter:m,shouldFilter:y,loop:x,disablePointerSelection:S=!1,vimBindings:_=!0,...w}=t,E=Hc(),T=Hc(),C=Hc(),O=R.useRef(null),N=d7();Ch(()=>{if(d!==void 0){let Z=d.trim();n.current.value=Z,L.emit()}},[d]),Ch(()=>{N(6,ne)},[]);let L=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,U);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(E))==null||fe.focus()}if(N(7,()=>{var Me;n.current.selectedItemId=(Me=te())==null?void 0:Me.id,L.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}}L.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(),L.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||U(),L.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&&U(),L.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:E,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:e7;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(dE);_e?_e.appendChild(fe.parentElement===_e?fe:fe.closest(`${dE} > *`)):ae.appendChild(fe.parentElement===ae?fe:fe.closest(`${dE} > *`))}),ge.sort((fe,_e)=>_e[1]-fe[1]).forEach(fe=>{var _e;let Se=(_e=O.current)==null?void 0:_e.querySelector(`${ty}[${Dm}="${encodeURIComponent(fe[0])}"]`);Se==null||Se.parentElement.appendChild(Se)})}function U(){let Z=pe().find(ae=>ae.getAttribute("aria-disabled")!=="true"),ge=Z==null?void 0:Z.getAttribute(Dm);L.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(ty))==null?void 0:ge.querySelector(J$))==null||ae.scrollIntoView({block:"nearest"})),fe.scrollIntoView({block:"nearest"}))}function te(){var Z;return(Z=O.current)==null?void 0:Z.querySelector(`${jF}[aria-selected="true"]`)}function pe(){var Z;return Array.from(((Z=O.current)==null?void 0:Z.querySelectorAll(MI))||[])}function oe(Z){let ge=pe()[Z];ge&&L.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&&L.setState("value",Se.getAttribute(Dm))}function B(Z){let ge=te(),ae=ge==null?void 0:ge.closest(ty),fe;for(;ae&&!fe;)ae=Z>0?c7(ae,ty):u7(ae,ty),fe=ae==null?void 0:ae.querySelector(MI);fe?L.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:h7},l),K1(t,Z=>R.createElement(FF.Provider,{value:L},R.createElement(UF.Provider,{value:F},Z))))}),t7=R.forwardRef((t,e)=>{var n,r;let i=Hc(),s=R.useRef(null),o=R.useContext(zF),a=G0(),l=HF(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=VF(i,s,[t.value,t.children,s],t.keywords),f=MP(),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,L;S(),(L=(N=l.current).onSelect)==null||L.call(N,d.current)}function S(){f.setState("value",d.current,!0)}if(!y)return null;let{disabled:_,value:w,onSelect:E,forceMount:T,keywords:C,...O}=t;return R.createElement(Vi.div,{ref:bg(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)}),n7=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=G0(),f=Ed(y=>i||d.filter()===!1?!0:y.search?y.filtered.groups.has(o):!0);Ch(()=>d.group(o),[]),VF(o,a,[t.value,t.heading,l]);let m=R.useMemo(()=>({id:o,forceMount:i}),[i]);return R.createElement(Vi.div,{ref:bg(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),K1(t,y=>R.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?c:void 0},R.createElement(zF.Provider,{value:m},y))))}),r7=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:bg(i,e),...r,"cmdk-separator":"",role:"separator"})}),i7=R.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,i=t.value!=null,s=MP(),o=Ed(c=>c.search),a=Ed(c=>c.selectedItemId),l=G0();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)}})}),s7=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=G0();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:bg(s,e),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":a,"aria-label":r,id:l.listId},K1(t,c=>R.createElement("div",{ref:bg(o,l.listInnerRef),"cmdk-list-sizer":""},c)))}),o7=R.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:s,container:o,...a}=t;return R.createElement(TF,{open:n,onOpenChange:r},R.createElement(RF,{container:o},R.createElement(NF,{"cmdk-overlay":"",className:i}),R.createElement(IF,{"aria-label":t.label,"cmdk-dialog":"",className:s},R.createElement(BF,{ref:e,...a}))))}),a7=R.forwardRef((t,e)=>Ed(n=>n.filtered.count===0)?R.createElement(Vi.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),l7=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},K1(t,o=>R.createElement("div",{"aria-hidden":!0},o)))}),im=Object.assign(BF,{List:s7,Item:t7,Input:i7,Group:n7,Separator:r7,Dialog:o7,Empty:a7,Loading:l7});function c7(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function u7(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function HF(t){let e=R.useRef(t);return Ch(()=>{e.current=t}),e}var Ch=typeof window>"u"?R.useEffect:R.useLayoutEffect;function jm(t){let e=R.useRef();return e.current===void 0&&(e.current=t()),e}function Ed(t){let e=MP(),n=()=>t(e.snapshot());return R.useSyncExternalStore(e.subscribe,n,n)}function VF(t,e,n,r=[]){let i=R.useRef(),s=G0();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 d7=()=>{let[t,e]=R.useState(),n=jm(()=>new Map);return Ch(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,i)=>{n.current.set(r,i),e({})}};function f7(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function K1({asChild:t,children:e},n){return t&&R.isValidElement(e)?R.cloneElement(f7(e),{ref:e.ref},n(e.props.children)):n(e)}var h7={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function p7({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:OT.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 Ut(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"]},m7=(t=!0)=>ls({queryKey:Lr.memoryGraph,queryFn:()=>Ut("/api/memory/graph"),enabled:t}),g7=()=>ls({queryKey:Lr.health,queryFn:()=>Ut("/api/health"),refetchInterval:1e4}),Y1=(t=5e3)=>ls({queryKey:Lr.systemStatus,queryFn:()=>Ut("/api/system/status"),refetchInterval:t}),v7=(t=3e3)=>ls({queryKey:Lr.services,queryFn:()=>Ut("/api/system/services"),refetchInterval:t}),qh=(t=4e3)=>ls({queryKey:Lr.models,queryFn:()=>Ut("/api/models"),refetchInterval:t}),y7=(t=4e3)=>ls({queryKey:Lr.routing,queryFn:()=>Ut("/api/routing"),refetchInterval:t}),x7=(t=2e3)=>ls({queryKey:Lr.jobs,queryFn:()=>Ut("/api/jobs"),refetchInterval:t,select:e=>e.jobs??[]}),EP=(t=3e3)=>ls({queryKey:Lr.tokenStats,queryFn:()=>Ut("/api/system/token-stats"),refetchInterval:t}),AP=(t=5e3)=>ls({queryKey:Lr.agentStatus,queryFn:()=>Ut("/api/agent/status"),refetchInterval:t}),b7=(t=6e4)=>ls({queryKey:Lr.hermesBrain,queryFn:()=>Ut("/api/agent/brain"),refetchInterval:t}),TP=t=>ls({queryKey:Lr.updates,queryFn:()=>Ut("/api/maintenance/updates"),refetchInterval:t}),_7=()=>ls({queryKey:Lr.discover,queryFn:()=>Ut("/api/discover")}),w7=t=>ls({queryKey:Lr.drafts(t),queryFn:()=>Ut(`/api/models/drafts?target=${encodeURIComponent(t??"")}`),enabled:!!t}),GF=t=>ls({queryKey:Lr.connect(t),queryFn:()=>Ut(t?`/api/connect?${t}`:"/api/connect")}),S7=()=>ls({queryKey:Lr.connectHealth,queryFn:()=>Ut("/api/connect/health"),refetchInterval:15e3}),FT=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),Ut(`/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 zT(t){return t?t>1024**3?`${(t/1024**3).toFixed(1)} GB`:`${(t/1024**2).toFixed(0)} MB`:""}function Ho(t){if(!t)return"—";const e=t/1024**3;return e>=1?`${e.toFixed(1)} GB`:`${(t/1024**2).toFixed(0)} MB`}function M7(t){if(!t)return"";const e=Math.floor(t/60);return e>0?`${e} min`:`${t} s`}function EI(t){return t?`${Math.round(t/1024)}k`:"—"}function WF(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{const e=T7(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{const a=o.split(CP);return a[0]===""&&a.length!==1&&a.shift(),$F(a,e)||A7(o)},getConflictingClassGroupIds:(o,a)=>{const l=n[o]||[];return a&&r[o]?[...l,...r[o]]:l}}},$F=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),i=r?$F(t.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(CP);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},AI=/^\[(.+)\]$/,A7=t=>{if(AI.test(t)){const e=AI.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},T7=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return P7(Object.entries(t.classGroups),n).forEach(([s,o])=>{BT(o,r,s,e)}),r},BT=(t,e,n,r)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:TI(e,i);s.classGroupId=n;return}if(typeof i=="function"){if(C7(i)){BT(i(r),e,n,r);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([s,o])=>{BT(o,TI(e,s),n,r)})})},TI=(t,e)=>{let n=t;return e.split(CP).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},C7=t=>t.isThemeGetter,P7=(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,R7=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)}}},XF="!",N7=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;_d?f-d:void 0;return{modifiers:l,hasImportantModifier:y,baseClassName:x,maybePostfixModifierPosition:S}};return n?a=>n({className:a,parseClassName:o}):o},I7=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},k7=t=>({cache:R7(t.cacheSize),parseClassName:N7(t),...E7(t)}),O7=/\s+/,L7=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(O7);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 _=I7(d).join(":"),w=f?_+XF:_,E=w+S;if(s.includes(E))continue;s.push(E);const T=i(S,x);for(let C=0;C0?" "+a:a)}return a};function D7(){let t=0,e,n,r="";for(;t{if(typeof t=="string")return t;let e,n="";for(let r=0;rf(d),t());return n=k7(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=L7(l,n);return i(l,d),d}return function(){return s(D7.apply(null,arguments))}}const rr=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},KF=/^\[(?:([a-z-]+):)?(.+)\]$/i,U7=/^\d+\/\d+$/,F7=new Set(["px","full","screen"]),z7=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,B7=/\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$/,H7=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,V7=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,G7=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,_c=t=>Zm(t)||F7.has(t)||U7.test(t),Gu=t=>zg(t,"length",Q7),Zm=t=>!!t&&!Number.isNaN(Number(t)),fE=t=>zg(t,"number",Zm),ny=t=>!!t&&Number.isInteger(Number(t)),W7=t=>t.endsWith("%")&&Zm(t.slice(0,-1)),fn=t=>KF.test(t),Wu=t=>z7.test(t),$7=new Set(["length","size","percentage"]),X7=t=>zg(t,$7,YF),q7=t=>zg(t,"position",YF),K7=new Set(["image","url"]),Y7=t=>zg(t,K7,eX),Z7=t=>zg(t,"",J7),ry=()=>!0,zg=(t,e,n)=>{const r=KF.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},Q7=t=>B7.test(t)&&!H7.test(t),YF=()=>!1,J7=t=>V7.test(t),eX=t=>G7.test(t),tX=()=>{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"),E=rr("padding"),T=rr("saturate"),C=rr("scale"),O=rr("sepia"),N=rr("skew"),L=rr("space"),F=rr("translate"),V=()=>["auto","contain","none"],k=()=>["auto","hidden","clip","visible","scroll"],U=()=>["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:[ry],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:[W7,Gu],inset:U(),margin:U(),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",ny,fn]}],basis:[{basis:U()}],"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",ny,fn]}],"grid-cols":[{"grid-cols":[ry]}],"col-start-end":[{col:["auto",{span:["full",ny,fn]},fn]}],"col-start":[{"col-start":te()}],"col-end":[{"col-end":te()}],"grid-rows":[{"grid-rows":[ry]}],"row-start-end":[{row:["auto",{span:[ny,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:[E]}],px:[{px:[E]}],py:[{py:[E]}],ps:[{ps:[E]}],pe:[{pe:[E]}],pt:[{pt:[E]}],pr:[{pr:[E]}],pb:[{pb:[E]}],pl:[{pl:[E]}],m:[{m:[_]}],mx:[{mx:[_]}],my:[{my:[_]}],ms:[{ms:[_]}],me:[{me:[_]}],mt:[{mt:[_]}],mr:[{mr:[_]}],mb:[{mb:[_]}],ml:[{ml:[_]}],"space-x":[{"space-x":[L]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[L]}],"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",fE]}],"font-family":[{font:[ry]}],"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,fE]}],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(),q7]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",X7]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Y7]}],"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,Z7]}],"shadow-color":[{shadow:[ry]}],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:[ny,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,fE]}],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"]}}},nX=j7(tX);function nt(...t){return nX(er(t))}function wg(t){return t?t.replace(/127\.0\.0\.1|localhost/g,"192.168.178.151"):""}const ZF=["fast","heavy","coder","vision","scout"],rX={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"},PP=t=>t&&rX[t]||"bg-slate-500/15 text-slate-300 border-slate-500/25";function iX({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 CI(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 sX(){const{data:t}=qh(2e3),{data:e}=EP(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(i0,{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(q8,{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",PP(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:[Ho(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 HT=[],VT=[];const GT=new Set,QF=()=>GT.forEach(t=>t());function JF(t){return GT.add(t),()=>{GT.delete(t)}}function oX(t){HT=[...HT,t].slice(-40),QF()}function aX(t){VT=[...VT,t].slice(-40),QF()}const lX=()=>R.useSyncExternalStore(JF,()=>HT),cX=()=>R.useSyncExternalStore(JF,()=>VT);function uX(){const{data:t,dataUpdatedAt:e}=Y1(3e3),{data:n,dataUpdatedAt:r}=EP(3e3),i=R.useRef(null);R.useEffect(()=>{var s,o,a,l;t&&oX({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);aX({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 dX(){const{data:t,error:e}=Y1(3e3),n=lX();return{sys:t,hist:n,error:e}}var fX=["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 RP(t){if(typeof t!="string")return!1;var e=fX;return e.includes(t)}var hX=["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"],pX=new Set(hX);function e5(t){return typeof t!="string"?!1:pX.has(t)}function t5(t){return typeof t=="string"&&t.startsWith("data-")}function Fa(t){if(typeof t!="object"||t===null)return{};var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e5(n)||t5(n))&&(e[n]=t[n]);return e}function Z1(t){if(t==null)return null;if(R.isValidElement(t)&&typeof t.props=="object"&&t.props!==null){var e=t.props;return Fa(e)}return typeof t=="object"&&!Array.isArray(t)?Fa(t):null}function Ko(t){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e5(n)||t5(n)||RP(n))&&(e[n]=t[n]);return e}function mX(t){return t==null?null:R.isValidElement(t)?Ko(t.props):typeof t=="object"&&!Array.isArray(t)?Ko(t):null}var gX=["children","width","height","viewBox","className","style","title","desc"];function WT(){return WT=Object.assign?Object.assign.bind():function(t){for(var e=1;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=vX(t,gX),f=s||{width:r,height:i,x:0,y:0},m=er("recharts-surface",o);return R.createElement("svg",WT({},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)}),xX=["children","className"];function $T(){return $T=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var n=t.children,r=t.className,i=bX(t,xX),s=er("recharts-layer",r);return R.createElement("g",$T({className:s},Ko(i),{ref:e}),n)}),wX=R.createContext(null);function Mr(t){return function(){return t}}const XT=Math.PI,qT=2*XT,Gf=1e-6,SX=qT-Gf;function r5(t){this._+=t[0];for(let e=1,n=t.length;e=0))throw new Error(`invalid digits: ${t}`);if(e>15)return r5;const n=10**e;return function(r){this._+=r[0];for(let i=1,s=r.length;iGf)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),E=Math.sqrt(m),T=s*Math.tan((XT-Math.acos((S+m-_)/(2*w*E)))/2),C=T/E,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%qT+qT),m>SX?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>=XT)},${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 i5(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 EX(e)}function NP(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function s5(t){this._context=t}s5.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 Q1(t){return new s5(t)}function o5(t){return t[0]}function a5(t){return t[1]}function l5(t,e){var n=Mr(!0),r=null,i=Q1,s=null,o=i5(a);t=typeof t=="function"?t:t===void 0?o5:Mr(t),e=typeof e=="function"?e:e===void 0?a5:Mr(e);function a(l){var c,d=(l=NP(l)).length,f,m=!1,y;for(r==null&&(s=i(y=o())),c=0;c<=d;++c)!(c=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(E)return a=null,E+""||null}function d(){return l5().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 c5{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 AX(t){return new c5(t,!0)}function TX(t){return new c5(t,!1)}function rw(){}function iw(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 u5(t){this._context=t}u5.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:iw(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:iw(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function CX(t){return new u5(t)}function d5(t){this._context=t}d5.prototype={areaStart:rw,areaEnd:rw,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:iw(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function PX(t){return new d5(t)}function f5(t){this._context=t}f5.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:iw(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function RX(t){return new f5(t)}function h5(t){this._context=t}h5.prototype={areaStart:rw,areaEnd:rw,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 NX(t){return new h5(t)}function PI(t){return t<0?-1:1}function RI(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(PI(s)+PI(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(a))||0}function NI(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function hE(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 sw(t){this._context=t}sw.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:hE(this,this._t0,NI(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,hE(this,NI(this,n=RI(this,t,e)),n);break;default:hE(this,this._t0,n=RI(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function p5(t){this._context=new m5(t)}(p5.prototype=Object.create(sw.prototype)).point=function(t,e){sw.prototype.point.call(this,e,t)};function m5(t){this._context=t}m5.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 IX(t){return new sw(t)}function kX(t){return new p5(t)}function g5(t){this._context=t}g5.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=II(t),i=II(e),s=0,o=1;o=0;--e)i[e]=(o[e]-i[e+1])/s[e];for(s[n-1]=(t[n]+i[n-1])/2,e=0;e=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 LX(t){return new J1(t,.5)}function DX(t){return new J1(t,0)}function jX(t){return new J1(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=0;)n[e]=e;return n}function UX(t,e){return t[e]}function FX(t){const e=[];return e.key=t,e}function zX(){var t=Mr([]),e=KT,n=Ph,r=UX;function i(s){var o=Array.from(t.apply(this,arguments),FX),a,l=o.length,c=-1,d;for(const f of s)for(a=0,++c;a0){for(var n,r,i=0,s=t[0].length,o;i0){for(var n=0,r=t[e[0]],i,s=r.length;n0)||!((s=(i=t[e[0]]).length)>0))){for(var n=0,r=1,i,s,o;r1&&arguments[1]!==void 0?arguments[1]:WX,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{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",$X=0,l0=t=>{var e=++$X;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},x5=t=>{if(!Array.isArray(t))return!1;for(var e=t.length,n={},r=0;rr&&(typeof e=="function"?e(r):Kh(r,e))===n)}var Hi=t=>t===null||typeof t>"u",OP=t=>Hi(t)?t:"".concat(t.charAt(0).toUpperCase()).concat(t.slice(1));function Ks(t){return t!=null}function Bg(){}var _5=t=>"radius"in t&&"startAngle"in t&&"endAngle"in t,LP=(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=>{RP(i)&&typeof n[i]=="function"&&(r[i]=(s=>n[i](n,s)))}),r},XX=(t,e,n)=>r=>(t(e,n,r),null),qX=(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];RP(i)&&typeof s=="function"&&(r||(r={}),r[i]=XX(s,e,n))}),r};function kI(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 KX(t){for(var e=1;e(o[a]===void 0&&r[a]!==void 0&&(o[a]=r[a]),o),n);return s}function JX(t,e){const n=new Map;for(let r=0;rObject.prototype.propertyIsEnumerable.call(t,e))}function DP(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const iq="[object RegExp]",S5="[object String]",M5="[object Number]",E5="[object Boolean]",A5="[object Arguments]",sq="[object Symbol]",oq="[object Date]",aq="[object Map]",lq="[object Set]",cq="[object Array]",uq="[object ArrayBuffer]",dq="[object Object]",fq="[object DataView]",hq="[object Uint8Array]",pq="[object Uint8ClampedArray]",mq="[object Uint16Array]",gq="[object Uint32Array]",vq="[object Int8Array]",yq="[object Int16Array]",xq="[object Int32Array]",bq="[object Float32Array]",_q="[object Float64Array]",OI=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})();function wq(t){return typeof OI.Buffer<"u"&&OI.Buffer.isBuffer(t)}function Sq(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(ZT(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{}):QT(t,e,function r(i,s,o,a,l,c){const d=n(i,s,o,a,l,c);return d!==void 0?!!d:QT(i,s,r,c,!1)},new Map,!0)}function QT(t,e,n,r,i=!1){if(e===t)return!0;switch(typeof e){case"object":return Aq(t,e,n,r);case"function":return Object.keys(e).length>0?QT(t,{...e},n,r,i):F_(t,e);default:return T5(t)&&i?typeof e=="string"?e==="":!0:F_(t,e)}}function Aq(t,e,n,r){if(e==null)return!0;if(Array.isArray(e))return P5(t,e,n,r);if(e instanceof Map)return Tq(t,e,n,r);if(e instanceof Set)return Cq(t,e,n,r);const i=Object.keys(e);if(t==null||ZT(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{})}function Pq(t){return t=Eq(t),e=>R5(e,t)}function Rq(t,e){return Sq(t,(n,r,i,s)=>{if(typeof t=="object"){if(DP(t)==="[object Object]"&&typeof t.constructor!="function"){const o={};return s.set(t,o),Ia(o,t,i,s),o}switch(Object.prototype.toString.call(t)){case M5:case S5:case E5:{const o=new t.constructor(t==null?void 0:t.valueOf());return Ia(o,t),o}case A5:{const o={};return Ia(o,t),o.length=t.length,o[Symbol.iterator]=t[Symbol.iterator],o}default:return}}})}function Nq(t){return Rq(t)}const Iq=/^(?:0|[1-9]\d*)$/;function N5(t,e=Number.MAX_SAFE_INTEGER){switch(typeof t){case"number":return Number.isInteger(t)&&t>=0&&t=0}function I5(t){return t!=null&&typeof t!="function"&&jq(t.length)}function Uq(t){return typeof t=="object"&&t!==null}function Fq(t){return Uq(t)&&I5(t)}function LI(t,e=w5){return Fq(t)?JX(Array.from(t),eq(Dq(e),1)):[]}function zq(t,e,n){return e===!0?LI(t,n):typeof e=="function"?LI(t,e):t}var pE={exports:{}},mE={},gE={exports:{}},vE={};/** +`)},L$=0,nm=[];function D$(t){var e=R.useRef([]),n=R.useRef([0,0]),r=R.useRef(),i=R.useState(L$++)[0],s=R.useState(bF)[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=r$([t.lockRef.current],(t.shards||[]).map(SI),!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=vb(S),E=n.current,T="deltaX"in S?S.deltaX:E[0]-w[0],C="deltaY"in S?S.deltaY:E[1]-w[1],O,N=S.target,L=Math.abs(T)>Math.abs(C)?"h":"v";if("touches"in S&&L==="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 U=_I(L,N);if(!U)return!0;if(U?O=L:(O=L==="v"?"h":"v",U=_I(L,N)),!U)return!1;if(!r.current&&"changedTouches"in S&&(T||C)&&(r.current=O),!O)return!0;var H=r.current||O;return I$(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 _?wI(_):vb(_),E=e.current.filter(function(O){return O.name===_.type&&(O.target===_.target||_.target===O.shadowParent)&&k$(O.delta,w)})[0];if(E&&E.should){_.cancelable&&_.preventDefault();return}if(!E){var T=(o.current.shards||[]).map(SI).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,E){var T={name:S,delta:_,target:w,should:E,shadowParent:j$(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=vb(S),r.current=void 0},[]),f=R.useCallback(function(S){c(S.type,wI(S),S.target,a(S,t.lockRef.current))},[]),m=R.useCallback(function(S){c(S.type,vb(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:O$(i)}):null,y?R.createElement(E$,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function j$(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const U$=f$(xF,D$);var MF=R.forwardRef(function(t,e){return R.createElement(X1,_l({},t,{ref:e,sideCar:U$}))});MF.classNames=X1.classNames;var F$=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},rm=new WeakMap,yb=new WeakMap,xb={},uE=0,EF=function(t){return t&&(t.host||EF(t.parentNode))},z$=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=EF(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})},B$=function(t,e,n,r){var i=z$(e,Array.isArray(t)?t:[t]);xb[n]||(xb[n]=new WeakMap);var s=xb[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&&yb.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(),uE++,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||(yb.has(f)||f.removeAttribute(r),yb.delete(f)),y||f.removeAttribute(n)}),uE--,uE||(rm=new WeakMap,rm=new WeakMap,yb=new WeakMap,xb={})}},H$=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=F$(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),B$(r,i,n,"aria-hidden")):function(){return null}},q1="Dialog",[AF]=g9(q1),[V$,Wa]=AF(q1),TF=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]=_9({prop:r,defaultProp:i??!1,onChange:s,caller:q1});return v.jsx(V$,{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})};TF.displayName=q1;var CF="DialogTrigger",G$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Wa(CF,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":SP(i.open),...r,ref:s,onClick:_d(t.onClick,i.onOpenToggle)})});G$.displayName=CF;var wP="DialogPortal",[W$,PF]=AF(wP,{forceMount:void 0}),RF=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:i}=t,s=Wa(wP,e);return v.jsx(W$,{scope:e,forceMount:n,children:R.Children.map(r,o=>v.jsx($1,{present:n||s.open,children:v.jsx(gF,{asChild:!0,container:i,children:o})}))})};RF.displayName=wP;var nw="DialogOverlay",NF=R.forwardRef((t,e)=>{const n=PF(nw,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=Wa(nw,t.__scopeDialog);return s.modal?v.jsx($1,{present:r||s.open,children:v.jsx(X$,{...i,ref:e})}):null});NF.displayName=nw;var $$=dF("DialogOverlay.RemoveScroll"),X$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Wa(nw,n),s=B9(),o=Xh(e,s);return v.jsx(MF,{as:$$,allowPinchZoom:!0,shards:[i.contentRef],children:v.jsx(Vi.div,{"data-state":SP(i.open),...r,ref:o,style:{pointerEvents:"auto",...r.style}})})}),_g="DialogContent",IF=R.forwardRef((t,e)=>{const n=PF(_g,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=Wa(_g,t.__scopeDialog);return v.jsx($1,{present:r||s.open,children:s.modal?v.jsx(q$,{...i,ref:e}):v.jsx(K$,{...i,ref:e})})});IF.displayName=_g;var q$=R.forwardRef((t,e)=>{const n=Wa(_g,t.__scopeDialog),r=R.useRef(null),i=Xh(e,n.contentRef,r);return R.useEffect(()=>{const s=r.current;if(s)return H$(s)},[]),v.jsx(kF,{...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())})}),K$=R.forwardRef((t,e)=>{const n=Wa(_g,t.__scopeDialog),r=R.useRef(!1),i=R.useRef(!1);return v.jsx(kF,{...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()}})}),kF=R.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,...o}=t,a=Wa(_g,n);return n$(),v.jsx(v.Fragment,{children:v.jsx(pF,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:v.jsx(fF,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":SP(a.open),...o,ref:e,deferPointerDownOutside:!0,onDismiss:()=>a.onOpenChange(!1)})})})}),OF="DialogTitle",Y$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Wa(OF,n);return v.jsx(Vi.h2,{id:i.titleId,...r,ref:e})});Y$.displayName=OF;var LF="DialogDescription",Z$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Wa(LF,n);return v.jsx(Vi.p,{id:i.descriptionId,...r,ref:e})});Z$.displayName=LF;var DF="DialogClose",Q$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Wa(DF,n);return v.jsx(Vi.button,{type:"button",...r,ref:e,onClick:_d(t.onClick,()=>i.onOpenChange(!1))})});Q$.displayName=DF;function SP(t){return t?"open":"closed"}var ty='[cmdk-group=""]',dE='[cmdk-group-items=""]',J$='[cmdk-group-heading=""]',jF='[cmdk-item=""]',MI=`${jF}:not([aria-disabled="true"])`,UT="cmdk-item-select",Dm="data-value",e7=(t,e,n)=>m9(t,e,n),UF=R.createContext(void 0),G0=()=>R.useContext(UF),FF=R.createContext(void 0),MP=()=>R.useContext(FF),zF=R.createContext(void 0),BF=R.forwardRef((t,e)=>{let n=jm(()=>{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=jm(()=>new Set),i=jm(()=>new Map),s=jm(()=>new Map),o=jm(()=>new Set),a=HF(t),{label:l,children:c,value:d,onValueChange:f,filter:m,shouldFilter:y,loop:x,disablePointerSelection:S=!1,vimBindings:_=!0,...w}=t,E=Hc(),T=Hc(),C=Hc(),O=R.useRef(null),N=d7();Ch(()=>{if(d!==void 0){let Z=d.trim();n.current.value=Z,L.emit()}},[d]),Ch(()=>{N(6,ne)},[]);let L=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,U);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(E))==null||fe.focus()}if(N(7,()=>{var Me;n.current.selectedItemId=(Me=te())==null?void 0:Me.id,L.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}}L.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(),L.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||U(),L.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&&U(),L.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:E,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:e7;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(dE);_e?_e.appendChild(fe.parentElement===_e?fe:fe.closest(`${dE} > *`)):ae.appendChild(fe.parentElement===ae?fe:fe.closest(`${dE} > *`))}),ge.sort((fe,_e)=>_e[1]-fe[1]).forEach(fe=>{var _e;let Se=(_e=O.current)==null?void 0:_e.querySelector(`${ty}[${Dm}="${encodeURIComponent(fe[0])}"]`);Se==null||Se.parentElement.appendChild(Se)})}function U(){let Z=pe().find(ae=>ae.getAttribute("aria-disabled")!=="true"),ge=Z==null?void 0:Z.getAttribute(Dm);L.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(ty))==null?void 0:ge.querySelector(J$))==null||ae.scrollIntoView({block:"nearest"})),fe.scrollIntoView({block:"nearest"}))}function te(){var Z;return(Z=O.current)==null?void 0:Z.querySelector(`${jF}[aria-selected="true"]`)}function pe(){var Z;return Array.from(((Z=O.current)==null?void 0:Z.querySelectorAll(MI))||[])}function oe(Z){let ge=pe()[Z];ge&&L.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&&L.setState("value",Se.getAttribute(Dm))}function B(Z){let ge=te(),ae=ge==null?void 0:ge.closest(ty),fe;for(;ae&&!fe;)ae=Z>0?c7(ae,ty):u7(ae,ty),fe=ae==null?void 0:ae.querySelector(MI);fe?L.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:h7},l),K1(t,Z=>R.createElement(FF.Provider,{value:L},R.createElement(UF.Provider,{value:F},Z))))}),t7=R.forwardRef((t,e)=>{var n,r;let i=Hc(),s=R.useRef(null),o=R.useContext(zF),a=G0(),l=HF(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=VF(i,s,[t.value,t.children,s],t.keywords),f=MP(),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,L;S(),(L=(N=l.current).onSelect)==null||L.call(N,d.current)}function S(){f.setState("value",d.current,!0)}if(!y)return null;let{disabled:_,value:w,onSelect:E,forceMount:T,keywords:C,...O}=t;return R.createElement(Vi.div,{ref:bg(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)}),n7=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=G0(),f=Ed(y=>i||d.filter()===!1?!0:y.search?y.filtered.groups.has(o):!0);Ch(()=>d.group(o),[]),VF(o,a,[t.value,t.heading,l]);let m=R.useMemo(()=>({id:o,forceMount:i}),[i]);return R.createElement(Vi.div,{ref:bg(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),K1(t,y=>R.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?c:void 0},R.createElement(zF.Provider,{value:m},y))))}),r7=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:bg(i,e),...r,"cmdk-separator":"",role:"separator"})}),i7=R.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,i=t.value!=null,s=MP(),o=Ed(c=>c.search),a=Ed(c=>c.selectedItemId),l=G0();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)}})}),s7=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=G0();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:bg(s,e),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":a,"aria-label":r,id:l.listId},K1(t,c=>R.createElement("div",{ref:bg(o,l.listInnerRef),"cmdk-list-sizer":""},c)))}),o7=R.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:s,container:o,...a}=t;return R.createElement(TF,{open:n,onOpenChange:r},R.createElement(RF,{container:o},R.createElement(NF,{"cmdk-overlay":"",className:i}),R.createElement(IF,{"aria-label":t.label,"cmdk-dialog":"",className:s},R.createElement(BF,{ref:e,...a}))))}),a7=R.forwardRef((t,e)=>Ed(n=>n.filtered.count===0)?R.createElement(Vi.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),l7=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},K1(t,o=>R.createElement("div",{"aria-hidden":!0},o)))}),im=Object.assign(BF,{List:s7,Item:t7,Input:i7,Group:n7,Separator:r7,Dialog:o7,Empty:a7,Loading:l7});function c7(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function u7(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function HF(t){let e=R.useRef(t);return Ch(()=>{e.current=t}),e}var Ch=typeof window>"u"?R.useEffect:R.useLayoutEffect;function jm(t){let e=R.useRef();return e.current===void 0&&(e.current=t()),e}function Ed(t){let e=MP(),n=()=>t(e.snapshot());return R.useSyncExternalStore(e.subscribe,n,n)}function VF(t,e,n,r=[]){let i=R.useRef(),s=G0();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 d7=()=>{let[t,e]=R.useState(),n=jm(()=>new Map);return Ch(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,i)=>{n.current.set(r,i),e({})}};function f7(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function K1({asChild:t,children:e},n){return t&&R.isValidElement(e)?R.cloneElement(f7(e),{ref:e.ref},n(e.props.children)):n(e)}var h7={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function p7({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:OT.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 Ut(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"]},m7=(t=!0)=>ls({queryKey:Lr.memoryGraph,queryFn:()=>Ut("/api/memory/graph"),enabled:t}),g7=()=>ls({queryKey:Lr.health,queryFn:()=>Ut("/api/health"),refetchInterval:1e4}),Y1=(t=5e3)=>ls({queryKey:Lr.systemStatus,queryFn:()=>Ut("/api/system/status"),refetchInterval:t}),v7=(t=3e3)=>ls({queryKey:Lr.services,queryFn:()=>Ut("/api/system/services"),refetchInterval:t}),qh=(t=4e3)=>ls({queryKey:Lr.models,queryFn:()=>Ut("/api/models"),refetchInterval:t}),y7=(t=4e3)=>ls({queryKey:Lr.routing,queryFn:()=>Ut("/api/routing"),refetchInterval:t}),x7=(t=2e3)=>ls({queryKey:Lr.jobs,queryFn:()=>Ut("/api/jobs"),refetchInterval:t,select:e=>e.jobs??[]}),EP=(t=3e3)=>ls({queryKey:Lr.tokenStats,queryFn:()=>Ut("/api/system/token-stats"),refetchInterval:t}),AP=(t=5e3)=>ls({queryKey:Lr.agentStatus,queryFn:()=>Ut("/api/agent/status"),refetchInterval:t}),b7=(t=6e4)=>ls({queryKey:Lr.hermesBrain,queryFn:()=>Ut("/api/agent/brain"),refetchInterval:t}),TP=t=>ls({queryKey:Lr.updates,queryFn:()=>Ut("/api/maintenance/updates"),refetchInterval:t}),_7=()=>ls({queryKey:Lr.discover,queryFn:()=>Ut("/api/discover")}),w7=t=>ls({queryKey:Lr.drafts(t),queryFn:()=>Ut(`/api/models/drafts?target=${encodeURIComponent(t??"")}`),enabled:!!t}),GF=t=>ls({queryKey:Lr.connect(t),queryFn:()=>Ut(t?`/api/connect?${t}`:"/api/connect")}),S7=()=>ls({queryKey:Lr.connectHealth,queryFn:()=>Ut("/api/connect/health"),refetchInterval:15e3}),FT=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),Ut(`/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 zT(t){return t?t>1024**3?`${(t/1024**3).toFixed(1)} GB`:`${(t/1024**2).toFixed(0)} MB`:""}function Ho(t){if(!t)return"—";const e=t/1024**3;return e>=1?`${e.toFixed(1)} GB`:`${(t/1024**2).toFixed(0)} MB`}function M7(t){if(!t)return"";const e=Math.floor(t/60);return e>0?`${e} min`:`${t} s`}function EI(t){return t?`${Math.round(t/1024)}k`:"—"}function WF(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{const e=T7(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{const a=o.split(CP);return a[0]===""&&a.length!==1&&a.shift(),$F(a,e)||A7(o)},getConflictingClassGroupIds:(o,a)=>{const l=n[o]||[];return a&&r[o]?[...l,...r[o]]:l}}},$F=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),i=r?$F(t.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(CP);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},AI=/^\[(.+)\]$/,A7=t=>{if(AI.test(t)){const e=AI.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},T7=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return P7(Object.entries(t.classGroups),n).forEach(([s,o])=>{BT(o,r,s,e)}),r},BT=(t,e,n,r)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:TI(e,i);s.classGroupId=n;return}if(typeof i=="function"){if(C7(i)){BT(i(r),e,n,r);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([s,o])=>{BT(o,TI(e,s),n,r)})})},TI=(t,e)=>{let n=t;return e.split(CP).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},C7=t=>t.isThemeGetter,P7=(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,R7=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)}}},XF="!",N7=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;_d?f-d:void 0;return{modifiers:l,hasImportantModifier:y,baseClassName:x,maybePostfixModifierPosition:S}};return n?a=>n({className:a,parseClassName:o}):o},I7=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},k7=t=>({cache:R7(t.cacheSize),parseClassName:N7(t),...E7(t)}),O7=/\s+/,L7=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(O7);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 _=I7(d).join(":"),w=f?_+XF:_,E=w+S;if(s.includes(E))continue;s.push(E);const T=i(S,x);for(let C=0;C0?" "+a:a)}return a};function D7(){let t=0,e,n,r="";for(;t{if(typeof t=="string")return t;let e,n="";for(let r=0;rf(d),t());return n=k7(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=L7(l,n);return i(l,d),d}return function(){return s(D7.apply(null,arguments))}}const rr=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},KF=/^\[(?:([a-z-]+):)?(.+)\]$/i,U7=/^\d+\/\d+$/,F7=new Set(["px","full","screen"]),z7=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,B7=/\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$/,H7=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,V7=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,G7=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,_c=t=>Zm(t)||F7.has(t)||U7.test(t),Gu=t=>zg(t,"length",Q7),Zm=t=>!!t&&!Number.isNaN(Number(t)),fE=t=>zg(t,"number",Zm),ny=t=>!!t&&Number.isInteger(Number(t)),W7=t=>t.endsWith("%")&&Zm(t.slice(0,-1)),fn=t=>KF.test(t),Wu=t=>z7.test(t),$7=new Set(["length","size","percentage"]),X7=t=>zg(t,$7,YF),q7=t=>zg(t,"position",YF),K7=new Set(["image","url"]),Y7=t=>zg(t,K7,eX),Z7=t=>zg(t,"",J7),ry=()=>!0,zg=(t,e,n)=>{const r=KF.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},Q7=t=>B7.test(t)&&!H7.test(t),YF=()=>!1,J7=t=>V7.test(t),eX=t=>G7.test(t),tX=()=>{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"),E=rr("padding"),T=rr("saturate"),C=rr("scale"),O=rr("sepia"),N=rr("skew"),L=rr("space"),F=rr("translate"),V=()=>["auto","contain","none"],k=()=>["auto","hidden","clip","visible","scroll"],U=()=>["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:[ry],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:[W7,Gu],inset:U(),margin:U(),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",ny,fn]}],basis:[{basis:U()}],"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",ny,fn]}],"grid-cols":[{"grid-cols":[ry]}],"col-start-end":[{col:["auto",{span:["full",ny,fn]},fn]}],"col-start":[{"col-start":te()}],"col-end":[{"col-end":te()}],"grid-rows":[{"grid-rows":[ry]}],"row-start-end":[{row:["auto",{span:[ny,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:[E]}],px:[{px:[E]}],py:[{py:[E]}],ps:[{ps:[E]}],pe:[{pe:[E]}],pt:[{pt:[E]}],pr:[{pr:[E]}],pb:[{pb:[E]}],pl:[{pl:[E]}],m:[{m:[_]}],mx:[{mx:[_]}],my:[{my:[_]}],ms:[{ms:[_]}],me:[{me:[_]}],mt:[{mt:[_]}],mr:[{mr:[_]}],mb:[{mb:[_]}],ml:[{ml:[_]}],"space-x":[{"space-x":[L]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[L]}],"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",fE]}],"font-family":[{font:[ry]}],"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,fE]}],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(),q7]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",X7]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Y7]}],"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,Z7]}],"shadow-color":[{shadow:[ry]}],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:[ny,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,fE]}],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"]}}},nX=j7(tX);function nt(...t){return nX(er(t))}function wg(t){return t?t.replace(/127\.0\.0\.1|localhost/g,"192.168.178.151"):""}const ZF=["fast","heavy","coder","vision","scout"],rX={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"},PP=t=>t&&rX[t]||"bg-slate-500/15 text-slate-300 border-slate-500/25";function iX({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 CI(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 sX(){const{data:t}=qh(2e3),{data:e}=EP(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(i0,{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(q8,{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",PP(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:[Ho(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 HT=[],VT=[];const GT=new Set,QF=()=>GT.forEach(t=>t());function JF(t){return GT.add(t),()=>{GT.delete(t)}}function oX(t){HT=[...HT,t].slice(-40),QF()}function aX(t){VT=[...VT,t].slice(-40),QF()}const lX=()=>R.useSyncExternalStore(JF,()=>HT),cX=()=>R.useSyncExternalStore(JF,()=>VT);function uX(){const{data:t,dataUpdatedAt:e}=Y1(3e3),{data:n,dataUpdatedAt:r}=EP(3e3),i=R.useRef(null);R.useEffect(()=>{var s,o,a,l;t&&oX({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);aX({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 dX(){const{data:t,error:e}=Y1(3e3),n=lX();return{sys:t,hist:n,error:e}}var fX=["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 RP(t){if(typeof t!="string")return!1;var e=fX;return e.includes(t)}var hX=["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"],pX=new Set(hX);function e5(t){return typeof t!="string"?!1:pX.has(t)}function t5(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)&&(e5(n)||t5(n))&&(e[n]=t[n]);return e}function Z1(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)&&(e5(n)||t5(n)||RP(n))&&(e[n]=t[n]);return e}function mX(t){return t==null?null:R.isValidElement(t)?Ko(t.props):typeof t=="object"&&!Array.isArray(t)?Ko(t):null}var gX=["children","width","height","viewBox","className","style","title","desc"];function WT(){return WT=Object.assign?Object.assign.bind():function(t){for(var e=1;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=vX(t,gX),f=s||{width:r,height:i,x:0,y:0},m=er("recharts-surface",o);return R.createElement("svg",WT({},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)}),xX=["children","className"];function $T(){return $T=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var n=t.children,r=t.className,i=bX(t,xX),s=er("recharts-layer",r);return R.createElement("g",$T({className:s},Ko(i),{ref:e}),n)}),wX=R.createContext(null);function Mr(t){return function(){return t}}const XT=Math.PI,qT=2*XT,Gf=1e-6,SX=qT-Gf;function r5(t){this._+=t[0];for(let e=1,n=t.length;e=0))throw new Error(`invalid digits: ${t}`);if(e>15)return r5;const n=10**e;return function(r){this._+=r[0];for(let i=1,s=r.length;iGf)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),E=Math.sqrt(m),T=s*Math.tan((XT-Math.acos((S+m-_)/(2*w*E)))/2),C=T/E,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%qT+qT),m>SX?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>=XT)},${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 i5(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 EX(e)}function NP(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function s5(t){this._context=t}s5.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 Q1(t){return new s5(t)}function o5(t){return t[0]}function a5(t){return t[1]}function l5(t,e){var n=Mr(!0),r=null,i=Q1,s=null,o=i5(a);t=typeof t=="function"?t:t===void 0?o5:Mr(t),e=typeof e=="function"?e:e===void 0?a5:Mr(e);function a(l){var c,d=(l=NP(l)).length,f,m=!1,y;for(r==null&&(s=i(y=o())),c=0;c<=d;++c)!(c=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(E)return a=null,E+""||null}function d(){return l5().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 c5{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 AX(t){return new c5(t,!0)}function TX(t){return new c5(t,!1)}function rw(){}function iw(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 u5(t){this._context=t}u5.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:iw(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:iw(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function CX(t){return new u5(t)}function d5(t){this._context=t}d5.prototype={areaStart:rw,areaEnd:rw,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:iw(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function PX(t){return new d5(t)}function f5(t){this._context=t}f5.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:iw(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function RX(t){return new f5(t)}function h5(t){this._context=t}h5.prototype={areaStart:rw,areaEnd:rw,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 NX(t){return new h5(t)}function PI(t){return t<0?-1:1}function RI(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(PI(s)+PI(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(a))||0}function NI(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function hE(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 sw(t){this._context=t}sw.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:hE(this,this._t0,NI(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,hE(this,NI(this,n=RI(this,t,e)),n);break;default:hE(this,this._t0,n=RI(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function p5(t){this._context=new m5(t)}(p5.prototype=Object.create(sw.prototype)).point=function(t,e){sw.prototype.point.call(this,e,t)};function m5(t){this._context=t}m5.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 IX(t){return new sw(t)}function kX(t){return new p5(t)}function g5(t){this._context=t}g5.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=II(t),i=II(e),s=0,o=1;o=0;--e)i[e]=(o[e]-i[e+1])/s[e];for(s[n-1]=(t[n]+i[n-1])/2,e=0;e=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 LX(t){return new J1(t,.5)}function DX(t){return new J1(t,0)}function jX(t){return new J1(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=0;)n[e]=e;return n}function UX(t,e){return t[e]}function FX(t){const e=[];return e.key=t,e}function zX(){var t=Mr([]),e=KT,n=Ph,r=UX;function i(s){var o=Array.from(t.apply(this,arguments),FX),a,l=o.length,c=-1,d;for(const f of s)for(a=0,++c;a0){for(var n,r,i=0,s=t[0].length,o;i0){for(var n=0,r=t[e[0]],i,s=r.length;n0)||!((s=(i=t[e[0]]).length)>0))){for(var n=0,r=1,i,s,o;r1&&arguments[1]!==void 0?arguments[1]:WX,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{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",$X=0,l0=t=>{var e=++$X;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},x5=t=>{if(!Array.isArray(t))return!1;for(var e=t.length,n={},r=0;rr&&(typeof e=="function"?e(r):Kh(r,e))===n)}var Hi=t=>t===null||typeof t>"u",OP=t=>Hi(t)?t:"".concat(t.charAt(0).toUpperCase()).concat(t.slice(1));function Ks(t){return t!=null}function Bg(){}var _5=t=>"radius"in t&&"startAngle"in t&&"endAngle"in t,LP=(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=>{RP(i)&&typeof n[i]=="function"&&(r[i]=(s=>n[i](n,s)))}),r},XX=(t,e,n)=>r=>(t(e,n,r),null),qX=(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];RP(i)&&typeof s=="function"&&(r||(r={}),r[i]=XX(s,e,n))}),r};function kI(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 KX(t){for(var e=1;e(o[a]===void 0&&r[a]!==void 0&&(o[a]=r[a]),o),n);return s}function JX(t,e){const n=new Map;for(let r=0;rObject.prototype.propertyIsEnumerable.call(t,e))}function DP(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const iq="[object RegExp]",S5="[object String]",M5="[object Number]",E5="[object Boolean]",A5="[object Arguments]",sq="[object Symbol]",oq="[object Date]",aq="[object Map]",lq="[object Set]",cq="[object Array]",uq="[object ArrayBuffer]",dq="[object Object]",fq="[object DataView]",hq="[object Uint8Array]",pq="[object Uint8ClampedArray]",mq="[object Uint16Array]",gq="[object Uint32Array]",vq="[object Int8Array]",yq="[object Int16Array]",xq="[object Int32Array]",bq="[object Float32Array]",_q="[object Float64Array]",OI=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})();function wq(t){return typeof OI.Buffer<"u"&&OI.Buffer.isBuffer(t)}function Sq(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(ZT(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{}):QT(t,e,function r(i,s,o,a,l,c){const d=n(i,s,o,a,l,c);return d!==void 0?!!d:QT(i,s,r,c,!1)},new Map,!0)}function QT(t,e,n,r,i=!1){if(e===t)return!0;switch(typeof e){case"object":return Aq(t,e,n,r);case"function":return Object.keys(e).length>0?QT(t,{...e},n,r,i):F_(t,e);default:return T5(t)&&i?typeof e=="string"?e==="":!0:F_(t,e)}}function Aq(t,e,n,r){if(e==null)return!0;if(Array.isArray(e))return P5(t,e,n,r);if(e instanceof Map)return Tq(t,e,n,r);if(e instanceof Set)return Cq(t,e,n,r);const i=Object.keys(e);if(t==null||ZT(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{})}function Pq(t){return t=Eq(t),e=>R5(e,t)}function Rq(t,e){return Sq(t,(n,r,i,s)=>{if(typeof t=="object"){if(DP(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 M5:case S5:case E5:{const o=new t.constructor(t==null?void 0:t.valueOf());return ka(o,t),o}case A5:{const o={};return ka(o,t),o.length=t.length,o[Symbol.iterator]=t[Symbol.iterator],o}default:return}}})}function Nq(t){return Rq(t)}const Iq=/^(?:0|[1-9]\d*)$/;function N5(t,e=Number.MAX_SAFE_INTEGER){switch(typeof t){case"number":return Number.isInteger(t)&&t>=0&&t=0}function I5(t){return t!=null&&typeof t!="function"&&jq(t.length)}function Uq(t){return typeof t=="object"&&t!==null}function Fq(t){return Uq(t)&&I5(t)}function LI(t,e=w5){return Fq(t)?JX(Array.from(t),eq(Dq(e),1)):[]}function zq(t,e,n){return e===!0?LI(t,n):typeof e=="function"?LI(t,e):t}var pE={exports:{}},mE={},gE={exports:{}},vE={};/** * @license React * use-sync-external-store-shim.production.js * @@ -494,11 +494,11 @@ Error generating stack: `+j.message+` * 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 Vq(){if(UI)return mE;UI=1;var t=Wh(),e=Hq();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 mE.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(!E){if(E=!0,T=N,N=m(N),y!==void 0&&S.hasValue){var L=S.value;if(y(L,N))return C=L}return C=N}if(L=C,r(T,N))return L;var F=m(N);return y!==void 0&&y(L,F)?(T=N,L):(T=N,C=F)}var E=!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(_),_},mE}var FI;function Gq(){return FI||(FI=1,pE.exports=Vq()),pE.exports}var Wq=Gq(),jP=R.createContext(null),$q=t=>t,Wr=()=>{var t=R.useContext(jP);return t?t.store.dispatch:$q},z_=()=>{},Xq=()=>z_,qq=(t,e)=>t===e;function zt(t){var e=R.useContext(jP),n=R.useMemo(()=>e?r=>{if(r!=null)return t(r)}:z_,[e,t]);return Wq.useSyncExternalStoreWithSelector(e?e.subscription.addNestedSub:Xq,e?e.store.getState:z_,e?e.store.getState:z_,n,qq)}function Kq(t,e=`expected a function, instead received ${typeof t}`){if(typeof t!="function")throw new TypeError(e)}function Yq(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 zI=t=>Array.isArray(t)?t:[t];function Zq(t){const e=Array.isArray(t[0])?t[0]:t;return Yq(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function Qq(t,e){const n=[],{length:r}=t;for(let i=0;itypeof WeakRef>"u"?Jq:WeakRef,k5=eK(),tK=0,BI=1;function _b(){return{s:tK,v:void 0,o:null,p:null}}function nK(t){return t instanceof k5?t.deref():t}function O5(t,e={}){let n=_b();const{resultEqualityCheck:r}=e;let i,s=0;function o(){let a=n;const{length:l}=arguments;for(let f=0,m=l;f{n=_b(),o.resetResultsCount()},o.resultsCount=()=>s,o.resetResultsCount=()=>{s=0},o}function rK(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()),Kq(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);const d={...n,...l},{memoize:f,memoizeOptions:m=[],argsMemoize:y=O5,argsMemoizeOptions:x=[]}=d,S=zI(m),_=zI(x),w=Zq(i),E=f(function(){return s++,c.apply(null,arguments)},...S),T=y(function(){o++;const O=Qq(w,arguments);return a=E.apply(null,O),a},..._);return Object.assign(T,{resultFunc:c,memoizedResultFunc:E,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=rK(O5);function iK(t,e=1){const n=[],r=Math.floor(e),i=(s,o)=>{for(let a=0;a{if(t!==e){const r=HI(t),i=HI(e);if(r===i&&r===0){if(te)return n==="desc"?-1:1}return n==="desc"?i-r:r-i}return 0};function L5(t){return typeof t=="symbol"||t instanceof Symbol}const oK=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,aK=/^\w*$/;function lK(t,e){return Array.isArray(t)?!1:typeof t=="number"||typeof t=="boolean"||t==null||L5(t)?!0:typeof t=="string"&&(aK.test(t)||!oK.test(t))||e!=null}function cK(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;dl==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)||lK(a)?a:{key:a,path:kP(a)}));return t.map(a=>({original:a,criteria:o.map(l=>s(l,a))})).slice().sort((a,l)=>{for(let c=0;ca.original)}function eS(t,...e){const n=e.length;return n>1&&JT(t,e[0],e[1])?e=[]:n>2&&JT(e[0],e[1],e[2])&&(e=[e[0]]),cK(t,iK(e),["asc"])}var D5=t=>t.legend.settings,uK=t=>t.legend.size,dK=t=>t.legend.payload;Oe([dK,D5],(t,e)=>{var n=e.itemSorter,r=t.flat(1);return n?eS(r,n):r});function fK(t,e){return gK(t)||mK(t,e)||pK(t,e)||hK()}function hK(){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 pK(t,e){if(t){if(typeof t=="string")return VI(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)?VI(t,e):void 0}}function VI(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);nwb||Math.abs(t.left-e.left)>wb||Math.abs(t.top-e.top)>wb||Math.abs(t.width-e.width)>wb}function WI(t){var e=t.getBoundingClientRect();return{height:e.height,left:e.left,top:e.top,width:e.width}}function vK(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=R.useState({height:0,left:0,top:0,width:0}),n=fK(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=WI(l);if(GI(c,o.current)&&i(c),typeof ResizeObserver<"u"){var d=new ResizeObserver(()=>{var f=WI(l);GI(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 yK=typeof Symbol=="function"&&Symbol.observable||"@@observable",$I=yK,yE=()=>Math.random().toString(36).substring(7).split("").join("."),xK={INIT:`@@redux/INIT${yE()}`,REPLACE:`@@redux/REPLACE${yE()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${yE()}`},ow=xK;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 j5(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(j5)(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 E=a++;return o.set(E,_),function(){if(w){if(l)throw new Error(Li(6));w=!1,c(),o.delete(E),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(E=>{E()}),_}function y(_){if(typeof _!="function")throw new Error(Li(10));r=_,m({type:ow.REPLACE})}function x(){const _=f;return{subscribe(w){if(typeof w!="object"||w===null)throw new Error(Li(11));function E(){const C=w;C.next&&C.next(d())}return E(),{unsubscribe:_(E)}},[$I](){return this}}}return m({type:ow.INIT}),{dispatch:m,subscribe:f,getState:d,replaceReducer:y,[$I]:x}}function bK(t){Object.keys(t).forEach(e=>{const n=t[e];if(typeof n(void 0,{type:ow.INIT})>"u")throw new Error(Li(12));if(typeof n(void 0,{type:ow.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Li(13))})}function U5(t){const e=Object.keys(t),n={};for(let s=0;s"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 aw(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,n)=>(...r)=>e(n(...r)))}function _K(...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=aw(...a)(i.dispatch),{...i,dispatch:s}}}function F5(t){return UP(t)&&"type"in t&&typeof t.type=="string"}var z5=Symbol.for("immer-nothing"),XI=Symbol.for("immer-draftable"),Cs=Symbol.for("immer-state");function Da(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var _o=Object,Sg=_o.getPrototypeOf,lw="constructor",tS="prototype",eC="configurable",cw="enumerable",B_="writable",c0="value",Kc=t=>!!t&&!!t[Cs];function za(t){var e;return t?B5(t)||rS(t)||!!t[XI]||!!((e=t[lw])!=null&&e[XI])||iS(t)||sS(t):!1}var wK=_o[tS][lw].toString(),qI=new WeakMap;function B5(t){if(!t||!FP(t))return!1;const e=Sg(t);if(e===null||e===_o[tS])return!0;const n=_o.hasOwnProperty.call(e,lw)&&e[lw];if(n===Object)return!0;if(!Um(n))return!1;let r=qI.get(n);return r===void 0&&(r=Function.toString.call(n),qI.set(n,r)),r===wK}function nS(t,e,n=!0){W0(t)===0?(n?Reflect.ownKeys(t):_o.keys(t)).forEach(i=>{e(i,t[i],t)}):t.forEach((r,i)=>e(i,r,t))}function W0(t){const e=t[Cs];return e?e.type_:rS(t)?1:iS(t)?2:sS(t)?3:0}var KI=(t,e,n=W0(t))=>n===2?t.has(e):_o[tS].hasOwnProperty.call(t,e),tC=(t,e,n=W0(t))=>n===2?t.get(e):t[e],uw=(t,e,n,r=W0(t))=>{r===2?t.set(e,n):r===3?t.add(n):t[e]=n};function SK(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}var rS=Array.isArray,iS=t=>t instanceof Map,sS=t=>t instanceof Set,FP=t=>typeof t=="object",Um=t=>typeof t=="function",xE=t=>typeof t=="boolean";function MK(t){const e=+t;return Number.isInteger(e)&&String(e)===t}var Rc=t=>t.copy_||t.base_,zP=t=>t.modified_?t.copy_:t.base_;function nC(t,e){if(iS(t))return new Map(t);if(sS(t))return new Set(t);if(rS(t))return Array[tS].slice.call(t);const n=B5(t);if(e===!0||e==="class_only"&&!n){const r=_o.getOwnPropertyDescriptors(t);delete r[Cs];let i=Reflect.ownKeys(r);for(let s=0;s1&&_o.defineProperties(t,{set:Sb,add:Sb,clear:Sb,delete:Sb}),_o.freeze(t),e&&nS(t,(n,r)=>{BP(r,!0)},!1)),t}function EK(){Da(2)}var Sb={[c0]:EK};function oS(t){return t===null||!FP(t)?!0:_o.isFrozen(t)}var dw="MapSet",rC="Patches",YI="ArrayMethods",H5={};function Nh(t){const e=H5[t];return e||Da(0,t),e}var ZI=t=>!!H5[t],u0,V5=()=>u0,AK=(t,e)=>({drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:ZI(dw)?Nh(dw):void 0,arrayMethodsPlugin_:ZI(YI)?Nh(YI):void 0});function QI(t,e){e&&(t.patchPlugin_=Nh(rC),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function iC(t){sC(t),t.drafts_.forEach(TK),t.drafts_=null}function sC(t){t===u0&&(u0=t.parent_)}var JI=t=>u0=AK(u0,t);function TK(t){const e=t[Cs];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function ek(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];if(t!==void 0&&t!==n){n[Cs].modified_&&(iC(e),Da(4)),za(t)&&(t=tk(e,t));const{patchPlugin_:i}=e;i&&i.generateReplacementPatches_(n[Cs].base_,t,e)}else t=tk(e,n);return CK(e,t,!0),iC(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==z5?t:void 0}function tk(t,e){if(oS(e))return e;const n=e[Cs];if(!n)return fw(e,t.handledSet_,t);if(!aS(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);$5(n,t)}return n.copy_}function CK(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&BP(e,n)}function G5(t){t.finalized_=!0,t.scope_.unfinalizedDrafts_--}var aS=(t,e)=>t.scope_===e,PK=[];function W5(t,e,n,r){const i=Rc(t),s=t.type_;if(r!==void 0&&tC(i,r,s)===e){uw(i,r,n,s);return}if(!t.draftLocations_){const a=t.draftLocations_=new Map;nS(i,(l,c)=>{if(Kc(c)){const d=a.get(c)||[];d.push(l),a.set(c,d)}})}const o=t.draftLocations_.get(e)??PK;for(const a of o)uw(i,a,n,s)}function RK(t,e,n){t.callbacks_.push(function(i){var a;const s=e;if(!s||!aS(s,i))return;(a=i.mapSetPlugin_)==null||a.fixSetContents(s);const o=zP(s);W5(t,s.draft_??s,o,n),$5(s,i)})}function $5(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)}G5(t)}}function NK(t,e,n){const{scope_:r}=t;if(Kc(n)){const i=n[Cs];aS(i,r)&&i.callbacks_.push(function(){H_(t);const o=zP(i);W5(t,n,o,e)})}else za(n)&&t.callbacks_.push(function(){const s=Rc(t);t.type_===3?s.has(n)&&fw(n,r.handledSet_,r):tC(s,e,t.type_)===n&&r.drafts_.length>1&&(t.assigned_.get(e)??!1)===!0&&t.copy_&&fw(tC(t.copy_,e,t.type_),r.handledSet_,r)})}function fw(t,e,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Kc(t)||e.has(t)||!za(t)||oS(t)||(e.add(t),nS(t,(r,i)=>{if(Kc(i)){const s=i[Cs];if(aS(s,n)){const o=zP(s);uw(t,r,o,t.type_),G5(s)}}else za(i)&&fw(i,e,n)})),t}function IK(t,e){const n=rS(t),r={type_:n?1:0,scope_:e?e.scope_:V5(),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=hw;n&&(i=[r],s=d0);const{revoke:o,proxy:a}=Proxy.revocable(i,s);return r.draft_=a,r.revoke_=o,[a,r]}var hw={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(!KI(i,e,t.type_))return kK(t,i,e);const s=i[e];if(t.finalized_||!za(s)||r&&t.operationMethod&&(n!=null&&n.isMutatingArrayMethod(t.operationMethod))&&MK(e))return s;if(s===bE(t.base_,e)){H_(t);const o=t.type_===1?+e:e,a=aC(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=X5(Rc(t),e);if(r!=null&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const i=bE(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(SK(n,i)&&(n!==void 0||KI(t.base_,e,t.type_)))return!0;H_(t),oC(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),NK(t,e,n)),!0},deleteProperty(t,e){return H_(t),bE(t.base_,e)!==void 0||e in t.base_?(t.assigned_.set(e,!1),oC(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&&{[B_]:!0,[eC]:t.type_!==1||e!=="length",[cw]:r[cw],[c0]:n[e]}},defineProperty(){Da(11)},getPrototypeOf(t){return Sg(t.base_)},setPrototypeOf(){Da(12)}},d0={};for(let t in hw){let e=hw[t];d0[t]=function(){const n=arguments;return n[0]=n[0][0],e.apply(this,n)}}d0.deleteProperty=function(t,e){return d0.set.call(this,t,e,void 0)};d0.set=function(t,e,n){return hw.set.call(this,t[0],e,n,t[0])};function bE(t,e){const n=t[Cs];return(n?Rc(n):t)[e]}function kK(t,e,n){var i;const r=X5(e,n);return r?c0 in r?r[c0]:(i=r.get)==null?void 0:i.call(t.draft_):void 0}function X5(t,e){if(!(e in t))return;let n=Sg(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=Sg(n)}}function oC(t){t.modified_||(t.modified_=!0,t.parent_&&oC(t.parent_))}function H_(t){t.copy_||(t.assigned_=new Map,t.copy_=nC(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var OK=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(n,r,i)=>{if(Um(n)&&!Um(r)){const o=r;r=n;const a=this;return function(c=o,...d){return a.produce(c,f=>r.call(this,f,...d))}}Um(r)||Da(6),i!==void 0&&!Um(i)&&Da(7);let s;if(za(n)){const o=JI(this),a=aC(o,n,void 0);let l=!0;try{s=r(a),l=!1}finally{l?iC(o):sC(o)}return QI(o,i),ek(s,o)}else if(!n||!FP(n)){if(s=r(n),s===void 0&&(s=n),s===z5&&(s=void 0),this.autoFreeze_&&BP(s,!0),i){const o=[],a=[];Nh(rC).generateReplacementPatches_(n,s,{patches_:o,inversePatches_:a}),i(o,a)}return s}else Da(1,n)},this.produceWithPatches=(n,r)=>{if(Um(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]},xE(e==null?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),xE(e==null?void 0:e.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),xE(e==null?void 0:e.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){za(e)||Da(8),Kc(e)&&(e=$o(e));const n=JI(this),r=aC(n,e,void 0);return r[Cs].isManual_=!0,sC(n),r}finishDraft(e,n){const r=e&&e[Cs];(!r||!r.isManual_)&&Da(9);const{scope_:i}=r;return QI(i,n),ek(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(rC).applyPatches_;return Kc(e)?i(e,n):this.produce(e,s=>i(s,n))}};function aC(t,e,n,r){const[i,s]=iS(e)?Nh(dw).proxyMap_(e,n):sS(e)?Nh(dw).proxySet_(e,n):IK(e,n);return((n==null?void 0:n.scope_)??V5()).drafts_.push(i),s.callbacks_=(n==null?void 0:n.callbacks_)??[],s.key_=r,n&&r!==void 0?RK(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)||Da(10,t),q5(t)}function q5(t){if(!za(t)||oS(t))return t;const e=t[Cs];let n,r=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=nC(t,e.scope_.immer_.useStrictShallowCopy_),r=e.scope_.immer_.shouldUseStrictIteration()}else n=nC(t,!0);return nS(n,(i,s)=>{uw(n,i,q5(s))},r),e&&(e.finalized_=!1),n}var LK=new OK,K5=LK.produce;function Y5(t){return({dispatch:n,getState:r})=>i=>s=>typeof s=="function"?s(n,r,t):i(s)}var DK=Y5(),jK=Y5,UK=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?aw:aw.apply(null,arguments)};function Eo(t,e){function n(...r){if(e){let i=e(...r);if(!i)throw new Error(So(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=>F5(r)&&r.type===t,n}var Z5=class Dy extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,Dy.prototype)}static get[Symbol.species](){return Dy}concat(...e){return super.concat.apply(this,e)}prepend(...e){return e.length===1&&Array.isArray(e[0])?new Dy(...e[0].concat(this)):new Dy(...e.concat(this))}};function nk(t){return za(t)?K5(t,()=>{}):t}function Mb(t,e,n){return t.has(e)?t.get(e):t.set(e,n(e)).get(e)}function FK(t){return typeof t=="boolean"}var zK=()=>function(e){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:s=!0}=e??{};let o=new Z5;return n&&(FK(n)?o.push(DK):o.push(jK(n.extraArgument))),o},Q5="RTK_autoBatch",sr=()=>t=>({payload:t,meta:{[Q5]:!0}}),rk=t=>e=>{setTimeout(e,t)},BK=(t,e)=>n=>{let r=!1;const i=()=>{r||(r=!0,cancelAnimationFrame(s),clearTimeout(o),n())},s=t(i),o=setTimeout(i,e)},J5=(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?BK(window.requestAnimationFrame,100):rk(10):t.type==="callback"?t.queueNotification:rk(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[Q5]),s=!i,s&&(o||(o=!0,l(c))),r.dispatch(d)}finally{i=!0}}})},HK=t=>function(n){const{autoBatch:r=!0}=n??{};let i=new Z5(t);return r&&i.push(J5(typeof r=="object"?r:void 0)),i};function VK(t){const e=zK(),{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(So(1));let l;typeof r=="function"?l=r(e):l=e();let c=aw;i&&(c=UK({trace:!1,...typeof i=="object"&&i}));const d=_K(...l),f=HK(d);let m=typeof o=="function"?o(f):f();const y=c(...m);return j5(a,s,y)}function e4(t){const e={},n=[];let r;const i={addCase(s,o){const a=typeof s=="string"?s:s.type;if(!a)throw new Error(So(28));if(a in e)throw new Error(So(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 GK(t){return typeof t=="function"}function WK(t,e){let[n,r,i]=e4(e),s;if(GK(t))s=()=>nk(t());else{const a=nk(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(za(d))return K5(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 $K="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",XK=(t=21)=>{let e="",n=t;for(;n--;)e+=$K[Math.random()*64|0];return e},qK=Symbol.for("rtk-slice-createasyncthunk");function KK(t,e){return`${t}/${e}`}function YK({creators:t}={}){var n;const e=(n=t==null?void 0:t.asyncThunk)==null?void 0:n[qK];return function(i){const{name:s,reducerPath:o=s}=i;if(!s)throw new Error(So(11));const a=(typeof i.reducers=="function"?i.reducers(QK()):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(So(12));if(N in c.sliceCaseReducersByType)throw new Error(So(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:KK(s,C),createNotation:typeof i.reducers=="function"};eY(O)?nY(N,O,d,e):JK(N,O,d)});function f(){const[C={},O=[],N=void 0]=typeof i.extraReducers=="function"?e4(i.extraReducers):[i.extraReducers],L={...C,...c.sliceCaseReducersByType};return WK(i.initialState,F=>{for(let V in L)F.addCase(V,L[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 E(C,O=!1){function N(F){let V=F[C];return typeof V>"u"&&O&&(V=Mb(x,N,w)),V}function L(F=m){const V=Mb(y,O,()=>new WeakMap);return Mb(V,F,()=>{const k={};for(const[U,H]of Object.entries(i.selectors??{}))k[U]=ZK(H,F,()=>Mb(x,F,w),O);return k})}return{reducerPath:C,getSelectors:L,get selectors(){return L(N)},selectSlice:N}}const T={name:s,reducer:_,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:w,...E(o),injectInto(C,{reducerPath:O,...N}={}){const L=O??o;return C.inject({reducerPath:L,reducer:_},N),{...T,...E(L,!0)}}};return T}}function ZK(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=YK();function QK(){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 JK({type:t,reducerName:e,createNotation:n},r,i){let s,o;if("reducer"in r){if(n&&!tY(r))throw new Error(So(17));s=r.reducer,o=r.prepare}else s=r;i.addCase(t,s).exposeCaseReducer(e,s).exposeAction(e,o?Eo(t,o):Eo(t))}function eY(t){return t._reducerDefinitionType==="asyncThunk"}function tY(t){return t._reducerDefinitionType==="reducerWithPrepare"}function nY({type:t,reducerName:e},n,r,i){if(!i)throw new Error(So(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||Eb,pending:a||Eb,rejected:l||Eb,settled:c||Eb})}function Eb(){}var rY="task",t4="listener",n4="completed",HP="cancelled",iY=`task-${HP}`,sY=`task-${n4}`,lC=`${t4}-${HP}`,oY=`${t4}-${n4}`,lS=class{constructor(t){fo(this,"code");fo(this,"name","TaskAbortError");fo(this,"message");this.code=t,this.message=`${rY} ${HP} (reason: ${t})`}},VP=(t,e)=>{if(typeof t!="function")throw new TypeError(So(32))},pw=()=>{},r4=(t,e=pw)=>(t.catch(e),t),i4=(t,e)=>(t.addEventListener("abort",e,{once:!0}),()=>t.removeEventListener("abort",e)),bh=t=>{if(t.aborted)throw new lS(t.reason)};function s4(t,e){let n=pw;return new Promise((r,i)=>{const s=()=>i(new lS(t.reason));if(t.aborted){s();return}n=i4(t,s),e.finally(()=>n()).then(r,i)}).finally(()=>{n=pw})}var aY=async(t,e)=>{try{return await Promise.resolve(),{status:"ok",value:await t()}}catch(n){return{status:n instanceof lS?"cancelled":"rejected",error:n}}finally{e==null||e()}},mw=t=>e=>r4(s4(t,e).then(n=>(bh(t),n))),o4=t=>{const e=mw(t);return n=>e(new Promise(r=>setTimeout(r,n)))},{assign:Qm}=Object,ik={},cS="listenerMiddleware",lY=(t,e)=>{const n=r=>i4(t,()=>r.abort(t.reason));return(r,i)=>{VP(r);const s=new AbortController;n(s);const o=aY(async()=>{bh(t),bh(s.signal);const a=await r({pause:mw(s.signal),delay:o4(s.signal),signal:s.signal});return bh(s.signal),a},()=>s.abort(sY));return i!=null&&i.autoJoin&&e.push(o.catch(pw)),{result:mw(t)(o),cancel(){s.abort(iY)}}}},cY=(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 s4(e,Promise.race(a));return bh(e),l}finally{s()}};return((r,i)=>r4(n(r,i)))},a4=t=>{let{type:e,actionCreator:n,matcher:r,predicate:i,effect:s}=t;if(e)i=Eo(e).match;else if(n)e=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(So(21));return VP(s),{predicate:i,type:e,effect:s}},l4=Qm(t=>{const{type:e,predicate:n,effect:r}=a4(t);return{id:XK(),effect:r,type:e,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(So(22))}}},{withTypes:()=>l4}),sk=(t,e)=>{const{type:n,effect:r,predicate:i}=a4(e);return Array.from(t.values()).find(s=>(typeof n=="string"?s.type===n:s.predicate===i)&&s.effect===r)},cC=t=>{t.pending.forEach(e=>{e.abort(lC)})},uY=(t,e)=>()=>{for(const n of e.keys())cC(n);t.clear()},ok=(t,e,n)=>{try{t(e,n)}catch(r){setTimeout(()=>{throw r},0)}},c4=Qm(Eo(`${cS}/add`),{withTypes:()=>c4}),dY=Eo(`${cS}/removeAll`),u4=Qm(Eo(`${cS}/remove`),{withTypes:()=>u4}),fY=(...t)=>{console.error(`${cS}/error`,...t)},$0=(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=fY}=t;VP(o);const a=y=>(y.unsubscribe=()=>e.delete(y.id),e.set(y.id,y),x=>{y.unsubscribe(),x!=null&&x.cancelActive&&cC(y)}),l=(y=>{const x=sk(e,y)??l4(y);return a(x)});Qm(l,{withTypes:()=>l});const c=y=>{const x=sk(e,y);return x&&(x.unsubscribe(),y.cancelActive&&cC(x)),!!x};Qm(c,{withTypes:()=>c});const d=async(y,x,S,_)=>{const w=new AbortController,E=cY(l,w.signal),T=[];try{y.pending.add(w),r(y),await Promise.resolve(y.effect(x,Qm({},S,{getOriginalState:_,condition:(C,O)=>E(C,O).then(Boolean),take:E,delay:o4(w.signal),pause:mw(w.signal),extra:s,signal:w.signal,fork:lY(w.signal,T),unsubscribe:y.unsubscribe,subscribe:()=>{e.set(y.id,y)},cancelActiveListeners:()=>{y.pending.forEach((C,O,N)=>{C!==w&&(C.abort(lC),N.delete(C))})},cancel:()=>{w.abort(lC),y.pending.delete(w)},throwIfCancelled:()=>{bh(w.signal)}})))}catch(C){C instanceof lS||ok(o,C,{raisedBy:"effect"})}finally{await Promise.all(T),w.abort(oY),i(y),y.pending.delete(w)}},f=uY(e,n);return{middleware:y=>x=>S=>{if(!F5(S))return x(S);if(c4.match(S))return l(S.payload);if(dY.match(S)){f();return}if(u4.match(S))return c(S.payload);let _=y.getState();const w=()=>{if(_===ik)throw new Error(So(23));return _};let E;try{if(E=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(L){N=!1,ok(o,L,{raisedBy:"predicate"})}N&&d(O,S,y,w)}}}finally{_=ik}return E},startListening:l,stopListening:c,clearListeners:f}};function So(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 hY={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},d4=cs({name:"chartLayout",initialState:hY,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}}}),uS=d4.actions,pY=uS.setMargin,mY=uS.setLayout,gY=uS.setChartSize,vY=uS.setScale,yY=d4.reducer;function f4(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 ak(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{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",h4=(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},p4=(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,E)=>{var T=r?r.indexOf(w):w,C=o.map(T);return wn(C)?{coordinate:C+S,value:w,offset:S,index:E}:null}).filter(Ks);return _}return l&&c?c.map((w,E)=>{var T=o.map(w);return wn(T)?{coordinate:T+S,value:w,index:E,offset:S}:null}).filter(Ks):o.ticks&&d!=null?o.ticks(d).map((w,E)=>{var T=o.map(w);return wn(T)?{coordinate:T+S,value:w,index:E,offset:S}:null}).filter(Ks):o.domain().map((w,E)=>{var T=o.map(w);return wn(T)?{coordinate:T+S,value:r?r[w]:w,index:E,offset:S}:null}).filter(Ks)},SY=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=0?(c[0]=s,s+=m,c[1]=s):(c[0]=o,o+=m,c[1]=o)}}}},MY=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=0?(l[0]=s,s+=c,l[1]=s):(l[0]=0,l[1]=0)}}}},EY={sign:SY,expand:BX,none:Ph,silhouette:HX,wiggle:VX,positive:MY},AY=(t,e,n)=>{var r,i=(r=EY[n])!==null&&r!==void 0?r:Ph,s=zX().keys(e).value((a,l)=>Number(yi(a,l,0))).order(KT).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 TY(t){return t==null?void 0:String(t)}function lk(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=b5(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 CY=t=>{var e=t.flat(2).filter(Nt);return[Math.min(...e),Math.max(...e)]},PY=t=>[t[0]===1/0?0:t[0],t[1]===-1/0?0:t[1]],RY=(t,e,n)=>{if(!(t==null||Object.keys(t).length===0))return PY(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=f4(c,e,n),f=CY(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]))},ck=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,uk=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,gw=(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=eS(e,d=>d.coordinate),s=1/0,o=1,a=i.length;o{if(e==="horizontal")return t.relativeX;if(e==="vertical")return t.relativeY},IY=(t,e)=>e==="centric"?t.angle:t.radius,tu=t=>t.layout.width,nu=t=>t.layout.height,kY=t=>t.layout.scale,g4=t=>t.layout.margin,dS=Oe(t=>t.cartesianAxis.xAxis,t=>Object.values(t)),fS=Oe(t=>t.cartesianAxis.yAxis,t=>Object.values(t)),OY="data-recharts-item-index",LY="data-recharts-item-id",X0=60;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 Ab(t){for(var e=1;et.brush.height;function zY(t){var e=fS(t);return e.reduce((n,r)=>{if(r.orientation==="left"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:X0;return n+i}return n},0)}function BY(t){var e=fS(t);return e.reduce((n,r)=>{if(r.orientation==="right"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:X0;return n+i}return n},0)}function HY(t){var e=dS(t);return e.reduce((n,r)=>r.orientation==="top"&&!r.mirror&&!r.hide?n+r.height:n,0)}function VY(t){var e=dS(t);return e.reduce((n,r)=>r.orientation==="bottom"&&!r.mirror&&!r.hide?n+r.height:n,0)}var Gi=Oe([tu,nu,g4,FY,zY,BY,HY,VY,D5,uK],(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=Ab(Ab({},f),d),y=m.bottom;m.bottom+=r,m=wY(m,l,c);var x=t-m.left-m.right,S=e-m.top-m.bottom;return Ab(Ab({brushBottom:y},m),{},{width:Math.max(x,0),height:Math.max(S,0)})}),GY=Oe(Gi,t=>({x:t.left,y:t.top,width:t.width,height:t.height})),v4=Oe(tu,nu,(t,e)=>({x:0,y:0,width:t,height:e})),WY=R.createContext(null),Qs=()=>R.useContext(WY)!=null,hS=t=>t.brush,pS=Oe([hS,Gi,g4],(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 $Y(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 XY(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=$Y(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 qY(t,e=0,n={}){const{leading:r=!0,trailing:i=!0}=n;return XY(t,e,{leading:r,maxWait:e,trailing:i})}var vw=function(e,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;si[o++]))}},wl={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},y4=(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}},KY={width:0,height:0,overflow:"visible"},YY={width:0,overflowX:"visible"},ZY={height:0,overflowY:"visible"},QY={},JY=t=>{var e=t.width,n=t.height,r=Rh(e),i=Rh(n);return r&&i?KY:r?YY:i?ZY:QY};function eZ(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 tZ=["aspect","initialDimension","width","height","minWidth","minHeight","maxHeight","children","debounce","id","className","onResize","style"];function yw(){return yw=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);nwb||Math.abs(t.left-e.left)>wb||Math.abs(t.top-e.top)>wb||Math.abs(t.width-e.width)>wb}function WI(t){var e=t.getBoundingClientRect();return{height:e.height,left:e.left,top:e.top,width:e.width}}function vK(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=R.useState({height:0,left:0,top:0,width:0}),n=fK(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=WI(l);if(GI(c,o.current)&&i(c),typeof ResizeObserver<"u"){var d=new ResizeObserver(()=>{var f=WI(l);GI(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 yK=typeof Symbol=="function"&&Symbol.observable||"@@observable",$I=yK,yE=()=>Math.random().toString(36).substring(7).split("").join("."),xK={INIT:`@@redux/INIT${yE()}`,REPLACE:`@@redux/REPLACE${yE()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${yE()}`},ow=xK;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 j5(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(j5)(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 E=a++;return o.set(E,_),function(){if(w){if(l)throw new Error(Li(6));w=!1,c(),o.delete(E),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(E=>{E()}),_}function y(_){if(typeof _!="function")throw new Error(Li(10));r=_,m({type:ow.REPLACE})}function x(){const _=f;return{subscribe(w){if(typeof w!="object"||w===null)throw new Error(Li(11));function E(){const C=w;C.next&&C.next(d())}return E(),{unsubscribe:_(E)}},[$I](){return this}}}return m({type:ow.INIT}),{dispatch:m,subscribe:f,getState:d,replaceReducer:y,[$I]:x}}function bK(t){Object.keys(t).forEach(e=>{const n=t[e];if(typeof n(void 0,{type:ow.INIT})>"u")throw new Error(Li(12));if(typeof n(void 0,{type:ow.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Li(13))})}function U5(t){const e=Object.keys(t),n={};for(let s=0;s"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 aw(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,n)=>(...r)=>e(n(...r)))}function _K(...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=aw(...a)(i.dispatch),{...i,dispatch:s}}}function F5(t){return UP(t)&&"type"in t&&typeof t.type=="string"}var z5=Symbol.for("immer-nothing"),XI=Symbol.for("immer-draftable"),Cs=Symbol.for("immer-state");function ja(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var _o=Object,Sg=_o.getPrototypeOf,lw="constructor",tS="prototype",eC="configurable",cw="enumerable",B_="writable",c0="value",Kc=t=>!!t&&!!t[Cs];function Ba(t){var e;return t?B5(t)||rS(t)||!!t[XI]||!!((e=t[lw])!=null&&e[XI])||iS(t)||sS(t):!1}var wK=_o[tS][lw].toString(),qI=new WeakMap;function B5(t){if(!t||!FP(t))return!1;const e=Sg(t);if(e===null||e===_o[tS])return!0;const n=_o.hasOwnProperty.call(e,lw)&&e[lw];if(n===Object)return!0;if(!Um(n))return!1;let r=qI.get(n);return r===void 0&&(r=Function.toString.call(n),qI.set(n,r)),r===wK}function nS(t,e,n=!0){W0(t)===0?(n?Reflect.ownKeys(t):_o.keys(t)).forEach(i=>{e(i,t[i],t)}):t.forEach((r,i)=>e(i,r,t))}function W0(t){const e=t[Cs];return e?e.type_:rS(t)?1:iS(t)?2:sS(t)?3:0}var KI=(t,e,n=W0(t))=>n===2?t.has(e):_o[tS].hasOwnProperty.call(t,e),tC=(t,e,n=W0(t))=>n===2?t.get(e):t[e],uw=(t,e,n,r=W0(t))=>{r===2?t.set(e,n):r===3?t.add(n):t[e]=n};function SK(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}var rS=Array.isArray,iS=t=>t instanceof Map,sS=t=>t instanceof Set,FP=t=>typeof t=="object",Um=t=>typeof t=="function",xE=t=>typeof t=="boolean";function MK(t){const e=+t;return Number.isInteger(e)&&String(e)===t}var Rc=t=>t.copy_||t.base_,zP=t=>t.modified_?t.copy_:t.base_;function nC(t,e){if(iS(t))return new Map(t);if(sS(t))return new Set(t);if(rS(t))return Array[tS].slice.call(t);const n=B5(t);if(e===!0||e==="class_only"&&!n){const r=_o.getOwnPropertyDescriptors(t);delete r[Cs];let i=Reflect.ownKeys(r);for(let s=0;s1&&_o.defineProperties(t,{set:Sb,add:Sb,clear:Sb,delete:Sb}),_o.freeze(t),e&&nS(t,(n,r)=>{BP(r,!0)},!1)),t}function EK(){ja(2)}var Sb={[c0]:EK};function oS(t){return t===null||!FP(t)?!0:_o.isFrozen(t)}var dw="MapSet",rC="Patches",YI="ArrayMethods",H5={};function Nh(t){const e=H5[t];return e||ja(0,t),e}var ZI=t=>!!H5[t],u0,V5=()=>u0,AK=(t,e)=>({drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:ZI(dw)?Nh(dw):void 0,arrayMethodsPlugin_:ZI(YI)?Nh(YI):void 0});function QI(t,e){e&&(t.patchPlugin_=Nh(rC),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function iC(t){sC(t),t.drafts_.forEach(TK),t.drafts_=null}function sC(t){t===u0&&(u0=t.parent_)}var JI=t=>u0=AK(u0,t);function TK(t){const e=t[Cs];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function ek(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];if(t!==void 0&&t!==n){n[Cs].modified_&&(iC(e),ja(4)),Ba(t)&&(t=tk(e,t));const{patchPlugin_:i}=e;i&&i.generateReplacementPatches_(n[Cs].base_,t,e)}else t=tk(e,n);return CK(e,t,!0),iC(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==z5?t:void 0}function tk(t,e){if(oS(e))return e;const n=e[Cs];if(!n)return fw(e,t.handledSet_,t);if(!aS(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);$5(n,t)}return n.copy_}function CK(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&BP(e,n)}function G5(t){t.finalized_=!0,t.scope_.unfinalizedDrafts_--}var aS=(t,e)=>t.scope_===e,PK=[];function W5(t,e,n,r){const i=Rc(t),s=t.type_;if(r!==void 0&&tC(i,r,s)===e){uw(i,r,n,s);return}if(!t.draftLocations_){const a=t.draftLocations_=new Map;nS(i,(l,c)=>{if(Kc(c)){const d=a.get(c)||[];d.push(l),a.set(c,d)}})}const o=t.draftLocations_.get(e)??PK;for(const a of o)uw(i,a,n,s)}function RK(t,e,n){t.callbacks_.push(function(i){var a;const s=e;if(!s||!aS(s,i))return;(a=i.mapSetPlugin_)==null||a.fixSetContents(s);const o=zP(s);W5(t,s.draft_??s,o,n),$5(s,i)})}function $5(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)}G5(t)}}function NK(t,e,n){const{scope_:r}=t;if(Kc(n)){const i=n[Cs];aS(i,r)&&i.callbacks_.push(function(){H_(t);const o=zP(i);W5(t,n,o,e)})}else Ba(n)&&t.callbacks_.push(function(){const s=Rc(t);t.type_===3?s.has(n)&&fw(n,r.handledSet_,r):tC(s,e,t.type_)===n&&r.drafts_.length>1&&(t.assigned_.get(e)??!1)===!0&&t.copy_&&fw(tC(t.copy_,e,t.type_),r.handledSet_,r)})}function fw(t,e,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Kc(t)||e.has(t)||!Ba(t)||oS(t)||(e.add(t),nS(t,(r,i)=>{if(Kc(i)){const s=i[Cs];if(aS(s,n)){const o=zP(s);uw(t,r,o,t.type_),G5(s)}}else Ba(i)&&fw(i,e,n)})),t}function IK(t,e){const n=rS(t),r={type_:n?1:0,scope_:e?e.scope_:V5(),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=hw;n&&(i=[r],s=d0);const{revoke:o,proxy:a}=Proxy.revocable(i,s);return r.draft_=a,r.revoke_=o,[a,r]}var hw={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(!KI(i,e,t.type_))return kK(t,i,e);const s=i[e];if(t.finalized_||!Ba(s)||r&&t.operationMethod&&(n!=null&&n.isMutatingArrayMethod(t.operationMethod))&&MK(e))return s;if(s===bE(t.base_,e)){H_(t);const o=t.type_===1?+e:e,a=aC(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=X5(Rc(t),e);if(r!=null&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const i=bE(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(SK(n,i)&&(n!==void 0||KI(t.base_,e,t.type_)))return!0;H_(t),oC(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),NK(t,e,n)),!0},deleteProperty(t,e){return H_(t),bE(t.base_,e)!==void 0||e in t.base_?(t.assigned_.set(e,!1),oC(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&&{[B_]:!0,[eC]:t.type_!==1||e!=="length",[cw]:r[cw],[c0]:n[e]}},defineProperty(){ja(11)},getPrototypeOf(t){return Sg(t.base_)},setPrototypeOf(){ja(12)}},d0={};for(let t in hw){let e=hw[t];d0[t]=function(){const n=arguments;return n[0]=n[0][0],e.apply(this,n)}}d0.deleteProperty=function(t,e){return d0.set.call(this,t,e,void 0)};d0.set=function(t,e,n){return hw.set.call(this,t[0],e,n,t[0])};function bE(t,e){const n=t[Cs];return(n?Rc(n):t)[e]}function kK(t,e,n){var i;const r=X5(e,n);return r?c0 in r?r[c0]:(i=r.get)==null?void 0:i.call(t.draft_):void 0}function X5(t,e){if(!(e in t))return;let n=Sg(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=Sg(n)}}function oC(t){t.modified_||(t.modified_=!0,t.parent_&&oC(t.parent_))}function H_(t){t.copy_||(t.assigned_=new Map,t.copy_=nC(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var OK=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(n,r,i)=>{if(Um(n)&&!Um(r)){const o=r;r=n;const a=this;return function(c=o,...d){return a.produce(c,f=>r.call(this,f,...d))}}Um(r)||ja(6),i!==void 0&&!Um(i)&&ja(7);let s;if(Ba(n)){const o=JI(this),a=aC(o,n,void 0);let l=!0;try{s=r(a),l=!1}finally{l?iC(o):sC(o)}return QI(o,i),ek(s,o)}else if(!n||!FP(n)){if(s=r(n),s===void 0&&(s=n),s===z5&&(s=void 0),this.autoFreeze_&&BP(s,!0),i){const o=[],a=[];Nh(rC).generateReplacementPatches_(n,s,{patches_:o,inversePatches_:a}),i(o,a)}return s}else ja(1,n)},this.produceWithPatches=(n,r)=>{if(Um(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]},xE(e==null?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),xE(e==null?void 0:e.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),xE(e==null?void 0:e.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Ba(e)||ja(8),Kc(e)&&(e=$o(e));const n=JI(this),r=aC(n,e,void 0);return r[Cs].isManual_=!0,sC(n),r}finishDraft(e,n){const r=e&&e[Cs];(!r||!r.isManual_)&&ja(9);const{scope_:i}=r;return QI(i,n),ek(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(rC).applyPatches_;return Kc(e)?i(e,n):this.produce(e,s=>i(s,n))}};function aC(t,e,n,r){const[i,s]=iS(e)?Nh(dw).proxyMap_(e,n):sS(e)?Nh(dw).proxySet_(e,n):IK(e,n);return((n==null?void 0:n.scope_)??V5()).drafts_.push(i),s.callbacks_=(n==null?void 0:n.callbacks_)??[],s.key_=r,n&&r!==void 0?RK(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)||ja(10,t),q5(t)}function q5(t){if(!Ba(t)||oS(t))return t;const e=t[Cs];let n,r=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=nC(t,e.scope_.immer_.useStrictShallowCopy_),r=e.scope_.immer_.shouldUseStrictIteration()}else n=nC(t,!0);return nS(n,(i,s)=>{uw(n,i,q5(s))},r),e&&(e.finalized_=!1),n}var LK=new OK,K5=LK.produce;function Y5(t){return({dispatch:n,getState:r})=>i=>s=>typeof s=="function"?s(n,r,t):i(s)}var DK=Y5(),jK=Y5,UK=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?aw:aw.apply(null,arguments)};function Eo(t,e){function n(...r){if(e){let i=e(...r);if(!i)throw new Error(So(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=>F5(r)&&r.type===t,n}var Z5=class Dy extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,Dy.prototype)}static get[Symbol.species](){return Dy}concat(...e){return super.concat.apply(this,e)}prepend(...e){return e.length===1&&Array.isArray(e[0])?new Dy(...e[0].concat(this)):new Dy(...e.concat(this))}};function nk(t){return Ba(t)?K5(t,()=>{}):t}function Mb(t,e,n){return t.has(e)?t.get(e):t.set(e,n(e)).get(e)}function FK(t){return typeof t=="boolean"}var zK=()=>function(e){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:s=!0}=e??{};let o=new Z5;return n&&(FK(n)?o.push(DK):o.push(jK(n.extraArgument))),o},Q5="RTK_autoBatch",sr=()=>t=>({payload:t,meta:{[Q5]:!0}}),rk=t=>e=>{setTimeout(e,t)},BK=(t,e)=>n=>{let r=!1;const i=()=>{r||(r=!0,cancelAnimationFrame(s),clearTimeout(o),n())},s=t(i),o=setTimeout(i,e)},J5=(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?BK(window.requestAnimationFrame,100):rk(10):t.type==="callback"?t.queueNotification:rk(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[Q5]),s=!i,s&&(o||(o=!0,l(c))),r.dispatch(d)}finally{i=!0}}})},HK=t=>function(n){const{autoBatch:r=!0}=n??{};let i=new Z5(t);return r&&i.push(J5(typeof r=="object"?r:void 0)),i};function VK(t){const e=zK(),{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(So(1));let l;typeof r=="function"?l=r(e):l=e();let c=aw;i&&(c=UK({trace:!1,...typeof i=="object"&&i}));const d=_K(...l),f=HK(d);let m=typeof o=="function"?o(f):f();const y=c(...m);return j5(a,s,y)}function e4(t){const e={},n=[];let r;const i={addCase(s,o){const a=typeof s=="string"?s:s.type;if(!a)throw new Error(So(28));if(a in e)throw new Error(So(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 GK(t){return typeof t=="function"}function WK(t,e){let[n,r,i]=e4(e),s;if(GK(t))s=()=>nk(t());else{const a=nk(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 K5(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 $K="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",XK=(t=21)=>{let e="",n=t;for(;n--;)e+=$K[Math.random()*64|0];return e},qK=Symbol.for("rtk-slice-createasyncthunk");function KK(t,e){return`${t}/${e}`}function YK({creators:t}={}){var n;const e=(n=t==null?void 0:t.asyncThunk)==null?void 0:n[qK];return function(i){const{name:s,reducerPath:o=s}=i;if(!s)throw new Error(So(11));const a=(typeof i.reducers=="function"?i.reducers(QK()):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(So(12));if(N in c.sliceCaseReducersByType)throw new Error(So(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:KK(s,C),createNotation:typeof i.reducers=="function"};eY(O)?nY(N,O,d,e):JK(N,O,d)});function f(){const[C={},O=[],N=void 0]=typeof i.extraReducers=="function"?e4(i.extraReducers):[i.extraReducers],L={...C,...c.sliceCaseReducersByType};return WK(i.initialState,F=>{for(let V in L)F.addCase(V,L[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 E(C,O=!1){function N(F){let V=F[C];return typeof V>"u"&&O&&(V=Mb(x,N,w)),V}function L(F=m){const V=Mb(y,O,()=>new WeakMap);return Mb(V,F,()=>{const k={};for(const[U,H]of Object.entries(i.selectors??{}))k[U]=ZK(H,F,()=>Mb(x,F,w),O);return k})}return{reducerPath:C,getSelectors:L,get selectors(){return L(N)},selectSlice:N}}const T={name:s,reducer:_,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:w,...E(o),injectInto(C,{reducerPath:O,...N}={}){const L=O??o;return C.inject({reducerPath:L,reducer:_},N),{...T,...E(L,!0)}}};return T}}function ZK(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=YK();function QK(){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 JK({type:t,reducerName:e,createNotation:n},r,i){let s,o;if("reducer"in r){if(n&&!tY(r))throw new Error(So(17));s=r.reducer,o=r.prepare}else s=r;i.addCase(t,s).exposeCaseReducer(e,s).exposeAction(e,o?Eo(t,o):Eo(t))}function eY(t){return t._reducerDefinitionType==="asyncThunk"}function tY(t){return t._reducerDefinitionType==="reducerWithPrepare"}function nY({type:t,reducerName:e},n,r,i){if(!i)throw new Error(So(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||Eb,pending:a||Eb,rejected:l||Eb,settled:c||Eb})}function Eb(){}var rY="task",t4="listener",n4="completed",HP="cancelled",iY=`task-${HP}`,sY=`task-${n4}`,lC=`${t4}-${HP}`,oY=`${t4}-${n4}`,lS=class{constructor(t){fo(this,"code");fo(this,"name","TaskAbortError");fo(this,"message");this.code=t,this.message=`${rY} ${HP} (reason: ${t})`}},VP=(t,e)=>{if(typeof t!="function")throw new TypeError(So(32))},pw=()=>{},r4=(t,e=pw)=>(t.catch(e),t),i4=(t,e)=>(t.addEventListener("abort",e,{once:!0}),()=>t.removeEventListener("abort",e)),bh=t=>{if(t.aborted)throw new lS(t.reason)};function s4(t,e){let n=pw;return new Promise((r,i)=>{const s=()=>i(new lS(t.reason));if(t.aborted){s();return}n=i4(t,s),e.finally(()=>n()).then(r,i)}).finally(()=>{n=pw})}var aY=async(t,e)=>{try{return await Promise.resolve(),{status:"ok",value:await t()}}catch(n){return{status:n instanceof lS?"cancelled":"rejected",error:n}}finally{e==null||e()}},mw=t=>e=>r4(s4(t,e).then(n=>(bh(t),n))),o4=t=>{const e=mw(t);return n=>e(new Promise(r=>setTimeout(r,n)))},{assign:Qm}=Object,ik={},cS="listenerMiddleware",lY=(t,e)=>{const n=r=>i4(t,()=>r.abort(t.reason));return(r,i)=>{VP(r);const s=new AbortController;n(s);const o=aY(async()=>{bh(t),bh(s.signal);const a=await r({pause:mw(s.signal),delay:o4(s.signal),signal:s.signal});return bh(s.signal),a},()=>s.abort(sY));return i!=null&&i.autoJoin&&e.push(o.catch(pw)),{result:mw(t)(o),cancel(){s.abort(iY)}}}},cY=(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 s4(e,Promise.race(a));return bh(e),l}finally{s()}};return((r,i)=>r4(n(r,i)))},a4=t=>{let{type:e,actionCreator:n,matcher:r,predicate:i,effect:s}=t;if(e)i=Eo(e).match;else if(n)e=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(So(21));return VP(s),{predicate:i,type:e,effect:s}},l4=Qm(t=>{const{type:e,predicate:n,effect:r}=a4(t);return{id:XK(),effect:r,type:e,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(So(22))}}},{withTypes:()=>l4}),sk=(t,e)=>{const{type:n,effect:r,predicate:i}=a4(e);return Array.from(t.values()).find(s=>(typeof n=="string"?s.type===n:s.predicate===i)&&s.effect===r)},cC=t=>{t.pending.forEach(e=>{e.abort(lC)})},uY=(t,e)=>()=>{for(const n of e.keys())cC(n);t.clear()},ok=(t,e,n)=>{try{t(e,n)}catch(r){setTimeout(()=>{throw r},0)}},c4=Qm(Eo(`${cS}/add`),{withTypes:()=>c4}),dY=Eo(`${cS}/removeAll`),u4=Qm(Eo(`${cS}/remove`),{withTypes:()=>u4}),fY=(...t)=>{console.error(`${cS}/error`,...t)},$0=(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=fY}=t;VP(o);const a=y=>(y.unsubscribe=()=>e.delete(y.id),e.set(y.id,y),x=>{y.unsubscribe(),x!=null&&x.cancelActive&&cC(y)}),l=(y=>{const x=sk(e,y)??l4(y);return a(x)});Qm(l,{withTypes:()=>l});const c=y=>{const x=sk(e,y);return x&&(x.unsubscribe(),y.cancelActive&&cC(x)),!!x};Qm(c,{withTypes:()=>c});const d=async(y,x,S,_)=>{const w=new AbortController,E=cY(l,w.signal),T=[];try{y.pending.add(w),r(y),await Promise.resolve(y.effect(x,Qm({},S,{getOriginalState:_,condition:(C,O)=>E(C,O).then(Boolean),take:E,delay:o4(w.signal),pause:mw(w.signal),extra:s,signal:w.signal,fork:lY(w.signal,T),unsubscribe:y.unsubscribe,subscribe:()=>{e.set(y.id,y)},cancelActiveListeners:()=>{y.pending.forEach((C,O,N)=>{C!==w&&(C.abort(lC),N.delete(C))})},cancel:()=>{w.abort(lC),y.pending.delete(w)},throwIfCancelled:()=>{bh(w.signal)}})))}catch(C){C instanceof lS||ok(o,C,{raisedBy:"effect"})}finally{await Promise.all(T),w.abort(oY),i(y),y.pending.delete(w)}},f=uY(e,n);return{middleware:y=>x=>S=>{if(!F5(S))return x(S);if(c4.match(S))return l(S.payload);if(dY.match(S)){f();return}if(u4.match(S))return c(S.payload);let _=y.getState();const w=()=>{if(_===ik)throw new Error(So(23));return _};let E;try{if(E=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(L){N=!1,ok(o,L,{raisedBy:"predicate"})}N&&d(O,S,y,w)}}}finally{_=ik}return E},startListening:l,stopListening:c,clearListeners:f}};function So(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 hY={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},d4=cs({name:"chartLayout",initialState:hY,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}}}),uS=d4.actions,pY=uS.setMargin,mY=uS.setLayout,gY=uS.setChartSize,vY=uS.setScale,yY=d4.reducer;function f4(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 ak(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{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",h4=(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},p4=(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,E)=>{var T=r?r.indexOf(w):w,C=o.map(T);return wn(C)?{coordinate:C+S,value:w,offset:S,index:E}:null}).filter(Ks);return _}return l&&c?c.map((w,E)=>{var T=o.map(w);return wn(T)?{coordinate:T+S,value:w,index:E,offset:S}:null}).filter(Ks):o.ticks&&d!=null?o.ticks(d).map((w,E)=>{var T=o.map(w);return wn(T)?{coordinate:T+S,value:w,index:E,offset:S}:null}).filter(Ks):o.domain().map((w,E)=>{var T=o.map(w);return wn(T)?{coordinate:T+S,value:r?r[w]:w,index:E,offset:S}:null}).filter(Ks)},SY=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=0?(c[0]=s,s+=m,c[1]=s):(c[0]=o,o+=m,c[1]=o)}}}},MY=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=0?(l[0]=s,s+=c,l[1]=s):(l[0]=0,l[1]=0)}}}},EY={sign:SY,expand:BX,none:Ph,silhouette:HX,wiggle:VX,positive:MY},AY=(t,e,n)=>{var r,i=(r=EY[n])!==null&&r!==void 0?r:Ph,s=zX().keys(e).value((a,l)=>Number(yi(a,l,0))).order(KT).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 TY(t){return t==null?void 0:String(t)}function lk(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=b5(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 CY=t=>{var e=t.flat(2).filter(Nt);return[Math.min(...e),Math.max(...e)]},PY=t=>[t[0]===1/0?0:t[0],t[1]===-1/0?0:t[1]],RY=(t,e,n)=>{if(!(t==null||Object.keys(t).length===0))return PY(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=f4(c,e,n),f=CY(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]))},ck=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,uk=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,gw=(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=eS(e,d=>d.coordinate),s=1/0,o=1,a=i.length;o{if(e==="horizontal")return t.relativeX;if(e==="vertical")return t.relativeY},IY=(t,e)=>e==="centric"?t.angle:t.radius,tu=t=>t.layout.width,nu=t=>t.layout.height,kY=t=>t.layout.scale,g4=t=>t.layout.margin,dS=Oe(t=>t.cartesianAxis.xAxis,t=>Object.values(t)),fS=Oe(t=>t.cartesianAxis.yAxis,t=>Object.values(t)),OY="data-recharts-item-index",LY="data-recharts-item-id",X0=60;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 Ab(t){for(var e=1;et.brush.height;function zY(t){var e=fS(t);return e.reduce((n,r)=>{if(r.orientation==="left"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:X0;return n+i}return n},0)}function BY(t){var e=fS(t);return e.reduce((n,r)=>{if(r.orientation==="right"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:X0;return n+i}return n},0)}function HY(t){var e=dS(t);return e.reduce((n,r)=>r.orientation==="top"&&!r.mirror&&!r.hide?n+r.height:n,0)}function VY(t){var e=dS(t);return e.reduce((n,r)=>r.orientation==="bottom"&&!r.mirror&&!r.hide?n+r.height:n,0)}var Gi=Oe([tu,nu,g4,FY,zY,BY,HY,VY,D5,uK],(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=Ab(Ab({},f),d),y=m.bottom;m.bottom+=r,m=wY(m,l,c);var x=t-m.left-m.right,S=e-m.top-m.bottom;return Ab(Ab({brushBottom:y},m),{},{width:Math.max(x,0),height:Math.max(S,0)})}),GY=Oe(Gi,t=>({x:t.left,y:t.top,width:t.width,height:t.height})),v4=Oe(tu,nu,(t,e)=>({x:0,y:0,width:t,height:e})),WY=R.createContext(null),Qs=()=>R.useContext(WY)!=null,hS=t=>t.brush,pS=Oe([hS,Gi,g4],(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 $Y(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 XY(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=$Y(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 qY(t,e=0,n={}){const{leading:r=!0,trailing:i=!0}=n;return XY(t,e,{leading:r,maxWait:e,trailing:i})}var vw=function(e,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;si[o++]))}},wl={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},y4=(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}},KY={width:0,height:0,overflow:"visible"},YY={width:0,overflowX:"visible"},ZY={height:0,overflowY:"visible"},QY={},JY=t=>{var e=t.width,n=t.height,r=Rh(e),i=Rh(n);return r&&i?KY:r?YY:i?ZY:QY};function eZ(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 tZ=["aspect","initialDimension","width","height","minWidth","minHeight","maxHeight","children","debounce","id","className","onResize","style"];function yw(){return yw=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n({width:n,height:r}),[n,r]);return fZ(i)?R.createElement(x4.Provider,{value:i},e):null}var GP=()=>R.useContext(x4),hZ=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,E=w===void 0?{}:w,T=uZ(t,tZ),C=R.useRef(null),O=R.useRef();O.current=_,R.useImperativeHandle(e,()=>C.current);var N=R.useState({containerWidth:i.width,containerHeight:i.height}),L=sZ(N,2),F=L[0],V=L[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 Bg;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=qY(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 U=F.containerWidth,H=F.containerHeight;vw(!n||n>0,"The aspect(%s) must be greater than zero.",n);var ne=y4(U,H,{width:s,height:o,aspect:n,maxHeight:d}),te=ne.calculatedWidth,pe=ne.calculatedHeight;return vw(U<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",yw({id:x?"".concat(x):void 0,className:er("recharts-responsive-container",S),style:pk(pk({},E),{},{width:s,height:o,minWidth:l,minHeight:c,maxHeight:d}),ref:C},T),R.createElement("div",{style:JY({width:s,height:o})},R.createElement(b4,{width:te,height:pe},f)))}),pZ=R.forwardRef((t,e)=>{var n=GP();if(kl(n.width)&&kl(n.height))return t.children;var r=eZ({width:t.width,height:t.height,aspect:t.aspect}),i=r.width,s=r.height,o=y4(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(b4,{width:a,height:l},t.children):R.createElement(hZ,yw({},t,{width:i,height:s,ref:e}))});function WP(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 mS=()=>{var t,e=Qs(),n=zt(GY),r=zt(pS),i=(t=zt(hS))===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}},mZ={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},_4=()=>{var t;return(t=zt(Gi))!==null&&t!==void 0?t:mZ},w4=()=>zt(tu),S4=()=>zt(nu),fr=t=>t.layout.layoutType,Hg=()=>zt(fr),$P=()=>{var t=Hg();if(t==="horizontal"||t==="vertical")return t},M4=t=>{var e=t.layout.layoutType;if(e==="centric"||e==="radial")return e},gZ=()=>{var t=Hg();return t!==void 0},q0=t=>{var e=Wr(),n=Qs(),r=t.width,i=t.height,s=GP(),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(gY({width:o,height:a}))},[e,n,o,a]),null},E4=Symbol.for("immer-nothing"),gk=Symbol.for("immer-draftable"),Ao=Symbol.for("immer-state");function ja(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var f0=Object.getPrototypeOf;function Mg(t){return!!t&&!!t[Ao]}function Ih(t){var e;return t?A4(t)||Array.isArray(t)||!!t[gk]||!!((e=t.constructor)!=null&&e[gk])||K0(t)||vS(t):!1}var vZ=Object.prototype.constructor.toString(),vk=new WeakMap;function A4(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=vk.get(n);return r===void 0&&(r=Function.toString.call(n),vk.set(n,r)),r===vZ}function xw(t,e,n=!0){gS(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 gS(t){const e=t[Ao];return e?e.type_:Array.isArray(t)?1:K0(t)?2:vS(t)?3:0}function uC(t,e){return gS(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function T4(t,e,n){const r=gS(t);r===2?t.set(e,n):r===3?t.add(n):t[e]=n}function yZ(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function K0(t){return t instanceof Map}function vS(t){return t instanceof Set}function Wf(t){return t.copy_||t.base_}function dC(t,e){if(K0(t))return new Map(t);if(vS(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=A4(t);if(e===!0||e==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(t);delete r[Ao];let i=Reflect.ownKeys(r);for(let s=0;s1&&Object.defineProperties(t,{set:Tb,add:Tb,clear:Tb,delete:Tb}),Object.freeze(t),e&&Object.values(t).forEach(n=>XP(n,!0))),t}function xZ(){ja(2)}var Tb={value:xZ};function yS(t){return t===null||typeof t!="object"?!0:Object.isFrozen(t)}var bZ={};function kh(t){const e=bZ[t];return e||ja(0,t),e}var h0;function C4(){return h0}function _Z(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function yk(t,e){e&&(kh("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function fC(t){hC(t),t.drafts_.forEach(wZ),t.drafts_=null}function hC(t){t===h0&&(h0=t.parent_)}function xk(t){return h0=_Z(h0,t)}function wZ(t){const e=t[Ao];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function bk(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return t!==void 0&&t!==n?(n[Ao].modified_&&(fC(e),ja(4)),Ih(t)&&(t=bw(e,t),e.parent_||_w(e,t)),e.patches_&&kh("Patches").generateReplacementPatches_(n[Ao].base_,t,e.patches_,e.inversePatches_)):t=bw(e,n,[]),fC(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==E4?t:void 0}function bw(t,e,n){if(yS(e))return e;const r=t.immer_.shouldUseStrictIteration(),i=e[Ao];if(!i)return xw(e,(s,o)=>_k(t,i,e,s,o,n),r),e;if(i.scope_!==t)return e;if(!i.modified_)return _w(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),xw(o,(l,c)=>_k(t,i,s,l,c,n,a),r),_w(t,s,!1),n&&t.patches_&&kh("Patches").generatePatches_(i,n,t.patches_,t.inversePatches_)}return i.copy_}function _k(t,e,n,r,i,s,o){if(i==null||typeof i!="object"&&!o)return;const a=yS(i);if(!(a&&!o)){if(Mg(i)){const l=s&&e&&e.type_!==3&&!uC(e.assigned_,r)?s.concat(r):void 0,c=bw(t,i,l);if(T4(n,r,c),Mg(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;bw(t,i),(!e||!e.scope_.parent_)&&typeof r!="symbol"&&(K0(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&_w(t,i)}}}function _w(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&XP(e,n)}function SZ(t,e){const n=Array.isArray(t),r={type_:n?1:0,scope_:e?e.scope_:C4(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,s=qP;n&&(i=[r],s=p0);const{revoke:o,proxy:a}=Proxy.revocable(i,s);return r.draft_=a,r.revoke_=o,a}var qP={get(t,e){if(e===Ao)return t;const n=Wf(t);if(!uC(n,e))return MZ(t,n,e);const r=n[e];return t.finalized_||!Ih(r)?r:r===_E(t.base_,e)?(wE(t),t.copy_[e]=mC(r,t)):r},has(t,e){return e in Wf(t)},ownKeys(t){return Reflect.ownKeys(Wf(t))},set(t,e,n){const r=P4(Wf(t),e);if(r!=null&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const i=_E(Wf(t),e),s=i==null?void 0:i[Ao];if(s&&s.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(yZ(n,i)&&(n!==void 0||uC(t.base_,e)))return!0;wE(t),pC(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 _E(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,wE(t),pC(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 f0(t.base_)},setPrototypeOf(){ja(12)}},p0={};xw(qP,(t,e)=>{p0[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}});p0.deleteProperty=function(t,e){return p0.set.call(this,t,e,void 0)};p0.set=function(t,e,n){return qP.set.call(this,t[0],e,n,t[0])};function _E(t,e){const n=t[Ao];return(n?Wf(n):t)[e]}function MZ(t,e,n){var i;const r=P4(e,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(t.draft_):void 0}function P4(t,e){if(!(e in t))return;let n=f0(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=f0(n)}}function pC(t){t.modified_||(t.modified_=!0,t.parent_&&pC(t.parent_))}function wE(t){t.copy_||(t.copy_=dC(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var EZ=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=xk(this),o=mC(e,void 0);let a=!0;try{i=n(o),a=!1}finally{a?fC(s):hC(s)}return yk(s,r),bk(i,s)}else if(!e||typeof e!="object"){if(i=n(e),i===void 0&&(i=e),i===E4&&(i=void 0),this.autoFreeze_&&XP(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),Mg(t)&&(t=AZ(t));const e=xk(this),n=mC(t,void 0);return n[Ao].isManual_=!0,hC(e),n}finishDraft(t,e){const n=t&&t[Ao];(!n||!n.isManual_)&&ja(9);const{scope_:r}=n;return yk(r,e),bk(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 Mg(t)?r(t,e):this.produce(t,i=>r(i,e))}};function mC(t,e){const n=K0(t)?kh("MapSet").proxyMap_(t,e):vS(t)?kh("MapSet").proxySet_(t,e):SZ(t,e);return(e?e.scope_:C4()).drafts_.push(n),n}function AZ(t){return Mg(t)||ja(10,t),R4(t)}function R4(t){if(!Ih(t)||yS(t))return t;const e=t[Ao];let n,r=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=dC(t,e.scope_.immer_.useStrictShallowCopy_),r=e.scope_.immer_.shouldUseStrictIteration()}else n=dC(t,!0);return xw(n,(i,s)=>{T4(n,i,R4(s))},r),e&&(e.finalized_=!1),n}var TZ=new EZ;TZ.produce;var CZ={settings:{layout:"horizontal",align:"center",verticalAlign:"bottom",itemSorter:"value"},size:{width:0,height:0},payload:[]},N4=cs({name:"legend",initialState:CZ,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()}}}),Y0=N4.actions;Y0.setLegendSize;Y0.setLegendSettings;var PZ=Y0.addLegendPayload,RZ=Y0.replaceLegendPayload,NZ=Y0.removeLegendPayload,IZ=N4.reducer,SE={exports:{}},ME={};/** + height and width.`,te,pe,s,o,l,c,n),R.createElement("div",yw({id:x?"".concat(x):void 0,className:er("recharts-responsive-container",S),style:pk(pk({},E),{},{width:s,height:o,minWidth:l,minHeight:c,maxHeight:d}),ref:C},T),R.createElement("div",{style:JY({width:s,height:o})},R.createElement(b4,{width:te,height:pe},f)))}),pZ=R.forwardRef((t,e)=>{var n=GP();if(kl(n.width)&&kl(n.height))return t.children;var r=eZ({width:t.width,height:t.height,aspect:t.aspect}),i=r.width,s=r.height,o=y4(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(b4,{width:a,height:l},t.children):R.createElement(hZ,yw({},t,{width:i,height:s,ref:e}))});function WP(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 mS=()=>{var t,e=Qs(),n=zt(GY),r=zt(pS),i=(t=zt(hS))===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}},mZ={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},_4=()=>{var t;return(t=zt(Gi))!==null&&t!==void 0?t:mZ},w4=()=>zt(tu),S4=()=>zt(nu),fr=t=>t.layout.layoutType,Hg=()=>zt(fr),$P=()=>{var t=Hg();if(t==="horizontal"||t==="vertical")return t},M4=t=>{var e=t.layout.layoutType;if(e==="centric"||e==="radial")return e},gZ=()=>{var t=Hg();return t!==void 0},q0=t=>{var e=Wr(),n=Qs(),r=t.width,i=t.height,s=GP(),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(gY({width:o,height:a}))},[e,n,o,a]),null},E4=Symbol.for("immer-nothing"),gk=Symbol.for("immer-draftable"),Ao=Symbol.for("immer-state");function Ua(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var f0=Object.getPrototypeOf;function Mg(t){return!!t&&!!t[Ao]}function Ih(t){var e;return t?A4(t)||Array.isArray(t)||!!t[gk]||!!((e=t.constructor)!=null&&e[gk])||K0(t)||vS(t):!1}var vZ=Object.prototype.constructor.toString(),vk=new WeakMap;function A4(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=vk.get(n);return r===void 0&&(r=Function.toString.call(n),vk.set(n,r)),r===vZ}function xw(t,e,n=!0){gS(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 gS(t){const e=t[Ao];return e?e.type_:Array.isArray(t)?1:K0(t)?2:vS(t)?3:0}function uC(t,e){return gS(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function T4(t,e,n){const r=gS(t);r===2?t.set(e,n):r===3?t.add(n):t[e]=n}function yZ(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function K0(t){return t instanceof Map}function vS(t){return t instanceof Set}function Wf(t){return t.copy_||t.base_}function dC(t,e){if(K0(t))return new Map(t);if(vS(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=A4(t);if(e===!0||e==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(t);delete r[Ao];let i=Reflect.ownKeys(r);for(let s=0;s1&&Object.defineProperties(t,{set:Tb,add:Tb,clear:Tb,delete:Tb}),Object.freeze(t),e&&Object.values(t).forEach(n=>XP(n,!0))),t}function xZ(){Ua(2)}var Tb={value:xZ};function yS(t){return t===null||typeof t!="object"?!0:Object.isFrozen(t)}var bZ={};function kh(t){const e=bZ[t];return e||Ua(0,t),e}var h0;function C4(){return h0}function _Z(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function yk(t,e){e&&(kh("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function fC(t){hC(t),t.drafts_.forEach(wZ),t.drafts_=null}function hC(t){t===h0&&(h0=t.parent_)}function xk(t){return h0=_Z(h0,t)}function wZ(t){const e=t[Ao];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function bk(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return t!==void 0&&t!==n?(n[Ao].modified_&&(fC(e),Ua(4)),Ih(t)&&(t=bw(e,t),e.parent_||_w(e,t)),e.patches_&&kh("Patches").generateReplacementPatches_(n[Ao].base_,t,e.patches_,e.inversePatches_)):t=bw(e,n,[]),fC(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==E4?t:void 0}function bw(t,e,n){if(yS(e))return e;const r=t.immer_.shouldUseStrictIteration(),i=e[Ao];if(!i)return xw(e,(s,o)=>_k(t,i,e,s,o,n),r),e;if(i.scope_!==t)return e;if(!i.modified_)return _w(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),xw(o,(l,c)=>_k(t,i,s,l,c,n,a),r),_w(t,s,!1),n&&t.patches_&&kh("Patches").generatePatches_(i,n,t.patches_,t.inversePatches_)}return i.copy_}function _k(t,e,n,r,i,s,o){if(i==null||typeof i!="object"&&!o)return;const a=yS(i);if(!(a&&!o)){if(Mg(i)){const l=s&&e&&e.type_!==3&&!uC(e.assigned_,r)?s.concat(r):void 0,c=bw(t,i,l);if(T4(n,r,c),Mg(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;bw(t,i),(!e||!e.scope_.parent_)&&typeof r!="symbol"&&(K0(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&_w(t,i)}}}function _w(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&XP(e,n)}function SZ(t,e){const n=Array.isArray(t),r={type_:n?1:0,scope_:e?e.scope_:C4(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,s=qP;n&&(i=[r],s=p0);const{revoke:o,proxy:a}=Proxy.revocable(i,s);return r.draft_=a,r.revoke_=o,a}var qP={get(t,e){if(e===Ao)return t;const n=Wf(t);if(!uC(n,e))return MZ(t,n,e);const r=n[e];return t.finalized_||!Ih(r)?r:r===_E(t.base_,e)?(wE(t),t.copy_[e]=mC(r,t)):r},has(t,e){return e in Wf(t)},ownKeys(t){return Reflect.ownKeys(Wf(t))},set(t,e,n){const r=P4(Wf(t),e);if(r!=null&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const i=_E(Wf(t),e),s=i==null?void 0:i[Ao];if(s&&s.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(yZ(n,i)&&(n!==void 0||uC(t.base_,e)))return!0;wE(t),pC(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 _E(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,wE(t),pC(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(){Ua(11)},getPrototypeOf(t){return f0(t.base_)},setPrototypeOf(){Ua(12)}},p0={};xw(qP,(t,e)=>{p0[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}});p0.deleteProperty=function(t,e){return p0.set.call(this,t,e,void 0)};p0.set=function(t,e,n){return qP.set.call(this,t[0],e,n,t[0])};function _E(t,e){const n=t[Ao];return(n?Wf(n):t)[e]}function MZ(t,e,n){var i;const r=P4(e,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(t.draft_):void 0}function P4(t,e){if(!(e in t))return;let n=f0(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=f0(n)}}function pC(t){t.modified_||(t.modified_=!0,t.parent_&&pC(t.parent_))}function wE(t){t.copy_||(t.copy_=dC(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var EZ=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"&&Ua(6),r!==void 0&&typeof r!="function"&&Ua(7);let i;if(Ih(e)){const s=xk(this),o=mC(e,void 0);let a=!0;try{i=n(o),a=!1}finally{a?fC(s):hC(s)}return yk(s,r),bk(i,s)}else if(!e||typeof e!="object"){if(i=n(e),i===void 0&&(i=e),i===E4&&(i=void 0),this.autoFreeze_&&XP(i,!0),r){const s=[],o=[];kh("Patches").generateReplacementPatches_(e,i,s,o),r(s,o)}return i}else Ua(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)||Ua(8),Mg(t)&&(t=AZ(t));const e=xk(this),n=mC(t,void 0);return n[Ao].isManual_=!0,hC(e),n}finishDraft(t,e){const n=t&&t[Ao];(!n||!n.isManual_)&&Ua(9);const{scope_:r}=n;return yk(r,e),bk(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 Mg(t)?r(t,e):this.produce(t,i=>r(i,e))}};function mC(t,e){const n=K0(t)?kh("MapSet").proxyMap_(t,e):vS(t)?kh("MapSet").proxySet_(t,e):SZ(t,e);return(e?e.scope_:C4()).drafts_.push(n),n}function AZ(t){return Mg(t)||Ua(10,t),R4(t)}function R4(t){if(!Ih(t)||yS(t))return t;const e=t[Ao];let n,r=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=dC(t,e.scope_.immer_.useStrictShallowCopy_),r=e.scope_.immer_.shouldUseStrictIteration()}else n=dC(t,!0);return xw(n,(i,s)=>{T4(n,i,R4(s))},r),e&&(e.finalized_=!1),n}var TZ=new EZ;TZ.produce;var CZ={settings:{layout:"horizontal",align:"center",verticalAlign:"bottom",itemSorter:"value"},size:{width:0,height:0},payload:[]},N4=cs({name:"legend",initialState:CZ,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()}}}),Y0=N4.actions;Y0.setLegendSize;Y0.setLegendSettings;var PZ=Y0.addLegendPayload,RZ=Y0.replaceLegendPayload,NZ=Y0.removeLegendPayload,IZ=N4.reducer,SE={exports:{}},ME={};/** * @license React * use-sync-external-store-with-selector.production.js * @@ -509,19 +509,19 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho */var wk;function kZ(){if(wk)return ME;wk=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 ME.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,E=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(E,O))return N;var L=f(O);return m!==void 0&&m(N,L)?(E=O,N):(E=O,T=L)}var w=!1,E,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},ME}var Sk;function OZ(){return Sk||(Sk=1,SE.exports=kZ()),SE.exports}OZ();function LZ(t){t()}function DZ(){let t=null,e=null;return{clear(){t=null,e=null},notify(){LZ(()=>{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 Mk={notify(){},get:()=>[]};function jZ(t,e){let n,r=Mk,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=DZ())}function f(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=Mk)}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 UZ=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",FZ=UZ(),zZ=()=>typeof navigator<"u"&&navigator.product==="ReactNative",BZ=zZ(),HZ=()=>FZ||BZ?R.useLayoutEffect:R.useEffect,VZ=HZ();function Ek(t,e){return t===e?t!==0||e!==0||1/t===1/e:t!==t&&e!==e}function GZ(t,e){if(Ek(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{const l=jZ(i);return{store:i,subscription:l,getServerState:r?()=>r:void 0}},[i,r]),o=R.useMemo(()=>i.getState(),[i]);VZ(()=>{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||$Z;return R.createElement(a.Provider,{value:s},e)}var qZ=XZ,KZ=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius","throttledEvents"]);function YZ(t,e){return t==null&&e==null?!0:typeof t=="number"&&typeof e=="number"?t===e||t!==t&&e!==e:t===e}function xS(t,e){var n=new Set([...Object.keys(t),...Object.keys(e)]);for(var r of n)if(KZ.has(r)){if(t[r]==null&&e[r]==null)continue;if(!GZ(t[r],e[r]))return!1}else if(!YZ(t[r],e[r]))return!1;return!0}function gC(){return gC=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n{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=oQ(a,c),k=V.map((U,H)=>{if(!U||U.type==="none")return null;var ne=U.formatter||l||sQ,te=U.value,pe=U.name,oe=te,ce=pe;if(ne){var B=ne(te,pe,U,H,a);if(Array.isArray(B)){var K=eQ(B,2);oe=K[0],ce=K[1]}else if(B!=null)oe=B;else return null}var q=iy(iy({},om.itemStyle),{},{color:U.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"},U.unit||""))});return R.createElement("ul",{className:"recharts-tooltip-item-list",style:F},k)}return null},w=iy(iy({},om.contentStyle),r),E=iy({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 L=S?{role:"status","aria-live":"assertive"}:{};return R.createElement("div",gC({className:O,style:w},L),R.createElement("p",{className:N,style:E},R.isValidElement(C)?C:"".concat(C)),_())},sy="recharts-tooltip-wrapper",lQ={visibility:"hidden"};function cQ(t){var e=t.coordinate,n=t.translateX,r=t.translateY;return er(sy,{["".concat(sy,"-right")]:Nt(n)&&e&&Nt(e.x)&&n>=e.x,["".concat(sy,"-left")]:Nt(n)&&e&&Nt(e.x)&&n=e.y,["".concat(sy,"-top")]:Nt(r)&&e&&Nt(e.y)&&r0?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_?Math.max(d,m):Math.max(f,m)}function uQ(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 dQ(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=Ck({allowEscapeViewBox:e,coordinate:n,key:"x",offset:i,position:s,reverseDirection:o,tooltipDimension:a.width,viewBox:c,viewBoxDimension:c.width}),m=Ck({allowEscapeViewBox:e,coordinate:n,key:"y",offset:r,position:s,reverseDirection:o,tooltipDimension:a.height,viewBox:c,viewBoxDimension:c.height}),d=uQ({translateX:f,translateY:m,useTranslate3d:l})):d=lQ,{cssProperties:d,cssClasses:cQ({translateX:f,translateY:m,coordinate:n})}}var fQ=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),Z0={isSsr:fQ()};function hQ(t,e){return vQ(t)||gQ(t,e)||mQ(t,e)||pQ()}function pQ(){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 mQ(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);nZ0.isSsr||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches),e=hQ(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 Rk(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;et.length)&&(e=t.length);for(var n=0,r=Array(e);n({dismissed:!1,dismissedAtCoordinate:{x:0,y:0}})),c=_Q(l,2),d=c[0],f=c[1];R.useEffect(()=>{var w=E=>{if(E.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=dQ({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:AQ({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 CQ=R.memo(TQ),k4=()=>{var t;return(t=zt(e=>e.rootProps.accessibilityLayer))!==null&&t!==void 0?t:!0};function vC(){return vC=Object.assign?Object.assign.bind():function(t){for(var e=1;ewn(t.x)&&wn(t.y),Lk=t=>t.base!=null&&ww(t.base)&&ww(t),oy=t=>t.x,ay=t=>t.y,IQ=(t,e)=>{if(typeof t=="function")return t;var n="curve".concat(OP(t));if((n==="curveMonotone"||n==="curveBump")&&e){var r=Ok["".concat(n).concat(e==="vertical"?"Y":"X")];if(r)return r}return Ok[n]||Q1},Dk={connectNulls:!1,type:"linear"},kQ=t=>{var e=t.type,n=e===void 0?Dk.type:e,r=t.points,i=r===void 0?[]:r,s=t.baseLine,o=t.layout,a=t.connectNulls,l=a===void 0?Dk.connectNulls:a,c=IQ(n,o),d=l?i.filter(ww):i;if(Array.isArray(s)){var f,m=i.map((w,E)=>kk(kk({},w),{},{base:s[E]}));o==="vertical"?f=bb().y(ay).x1(oy).x0(w=>w.base.x):f=bb().x(oy).y1(ay).y0(w=>w.base.y);var y=f.defined(Lk).curve(c),x=l?m.filter(Lk):m;return y(x)}var S;o==="vertical"&&Nt(s)?S=bb().y(ay).x1(oy).x0(s):Nt(s)?S=bb().x(oy).y1(ay).y0(s):S=l5().x(oy).y(ay);var _=S.defined(ww).curve(c);return _(d)},V_=t=>{var e=t.className,n=t.points,r=t.path,i=t.pathRef,s=Hg();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?kQ(o):r;return R.createElement("path",vC({},Fa(t),LP(t),{className:er("recharts-curve",e),d:a===null?void 0:a,ref:i}))},OQ=["x","y","top","left","width","height","className"];function yC(){return yC=Object.assign?Object.assign.bind():function(t){for(var e=1;e"M".concat(t,",").concat(i,"v").concat(r,"M").concat(s,",").concat(e,"h").concat(n),HQ=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=FQ(t,OQ),S=LQ({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",yC({},Ko(S),{className:er("recharts-cross",y),d:BQ(n,i,d,m,o,l)}))};function VQ(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 Sw=1e-4,O4=(t,e)=>[0,3*t,3*e-6*t,3*t-3*e+1],L4=(t,e)=>t.map((n,r)=>n*e**r).reduce((n,r)=>n+r),Uk=(t,e)=>n=>{var r=O4(t,e);return L4(r,n)},GQ=(t,e)=>n=>{var r=O4(t,e),i=[...r.map((s,o)=>s*o).slice(1),0];return L4(i,n)},WQ=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]]},$Q=function(){for(var e=arguments.length,n=new Array(e),r=0;r{var i=Uk(t,n),s=Uk(e,r),o=GQ(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)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{var E,T,C;if(w<=0)return 0;if(w>=1)return l;var O=w*_,N=Math.floor(O),L=O-N;return((E=c[N])!==null&&E!==void 0?E:0)+(((T=c[N+1])!==null&&T!==void 0?T:0)-((C=c[N])!==null&&C!==void 0?C:0))*L}},KQ=t=>{if(typeof t=="string")switch(t){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return Fk(t);case"spring":return qQ();default:if(t.split("(")[0]==="cubic-bezier")return Fk(t)}return typeof t=="function"?t:null},YQ=(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()}},D4=R.createContext(YQ);D4.Provider;function ZQ(t){var e=R.useContext(D4);return R.useMemo(()=>t??e,[t,e])}function QQ(t,e,n){return(e=JQ(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function JQ(t){var e=eJ(t,"string");return typeof e=="symbol"?e:e+""}function eJ(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 zk="init",Bk="pending",Hk="active",tJ="completed";function TE(t){return Math.max(0,t)}class nJ{getAnimationStartedTime(){return this.animationStartedTime}getBeginStartedTime(){return this.beginStartedTime}constructor(e){var n;QQ(this,"state",zk),this.animationId=e.animationId,this.onAnimationEnd=e.onAnimationEnd,this.animationDuration=TE(e.animationDuration),this.animationBegin=TE(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()===zk)return this.state=Bk,this.beginStartedTime=e,this.animationBegin;if(this.getState()===Bk){if(this.beginStartedTime==null)throw new Error;var n=e-this.beginStartedTime;return n>=this.animationBegin?(this.state=Hk,this.animationStartedTime=e,this.nextAnimationUpdate(0)):TE(this.animationBegin-n)}if(this.getState()===Hk){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=tJ}getFrom(){return this.from}getTo(){return this.to}getAnimationId(){return this.animationId}getAnimationBegin(){return this.animationBegin}}class rJ extends nJ{nextAnimationUpdate(){return 0}getInterpolated(){return this.easing(jc(this.getFrom(),this.getTo(),this.getProgress()))}}class iJ{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 sJ(t,e){return cJ(t)||lJ(t,e)||aJ(t,e)||oJ()}function oJ(){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 SQ(t,e){if(t){if(typeof t=="string")return Nk(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)?Nk(t,e):void 0}}function Nk(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n({dismissed:!1,dismissedAtCoordinate:{x:0,y:0}})),c=_Q(l,2),d=c[0],f=c[1];R.useEffect(()=>{var w=E=>{if(E.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=dQ({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:AQ({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 CQ=R.memo(TQ),k4=()=>{var t;return(t=zt(e=>e.rootProps.accessibilityLayer))!==null&&t!==void 0?t:!0};function vC(){return vC=Object.assign?Object.assign.bind():function(t){for(var e=1;ewn(t.x)&&wn(t.y),Lk=t=>t.base!=null&&ww(t.base)&&ww(t),oy=t=>t.x,ay=t=>t.y,IQ=(t,e)=>{if(typeof t=="function")return t;var n="curve".concat(OP(t));if((n==="curveMonotone"||n==="curveBump")&&e){var r=Ok["".concat(n).concat(e==="vertical"?"Y":"X")];if(r)return r}return Ok[n]||Q1},Dk={connectNulls:!1,type:"linear"},kQ=t=>{var e=t.type,n=e===void 0?Dk.type:e,r=t.points,i=r===void 0?[]:r,s=t.baseLine,o=t.layout,a=t.connectNulls,l=a===void 0?Dk.connectNulls:a,c=IQ(n,o),d=l?i.filter(ww):i;if(Array.isArray(s)){var f,m=i.map((w,E)=>kk(kk({},w),{},{base:s[E]}));o==="vertical"?f=bb().y(ay).x1(oy).x0(w=>w.base.x):f=bb().x(oy).y1(ay).y0(w=>w.base.y);var y=f.defined(Lk).curve(c),x=l?m.filter(Lk):m;return y(x)}var S;o==="vertical"&&Nt(s)?S=bb().y(ay).x1(oy).x0(s):Nt(s)?S=bb().x(oy).y1(ay).y0(s):S=l5().x(oy).y(ay);var _=S.defined(ww).curve(c);return _(d)},V_=t=>{var e=t.className,n=t.points,r=t.path,i=t.pathRef,s=Hg();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?kQ(o):r;return R.createElement("path",vC({},za(t),LP(t),{className:er("recharts-curve",e),d:a===null?void 0:a,ref:i}))},OQ=["x","y","top","left","width","height","className"];function yC(){return yC=Object.assign?Object.assign.bind():function(t){for(var e=1;e"M".concat(t,",").concat(i,"v").concat(r,"M").concat(s,",").concat(e,"h").concat(n),HQ=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=FQ(t,OQ),S=LQ({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",yC({},Ko(S),{className:er("recharts-cross",y),d:BQ(n,i,d,m,o,l)}))};function VQ(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 Sw=1e-4,O4=(t,e)=>[0,3*t,3*e-6*t,3*t-3*e+1],L4=(t,e)=>t.map((n,r)=>n*e**r).reduce((n,r)=>n+r),Uk=(t,e)=>n=>{var r=O4(t,e);return L4(r,n)},GQ=(t,e)=>n=>{var r=O4(t,e),i=[...r.map((s,o)=>s*o).slice(1),0];return L4(i,n)},WQ=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]]},$Q=function(){for(var e=arguments.length,n=new Array(e),r=0;r{var i=Uk(t,n),s=Uk(e,r),o=GQ(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)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{var E,T,C;if(w<=0)return 0;if(w>=1)return l;var O=w*_,N=Math.floor(O),L=O-N;return((E=c[N])!==null&&E!==void 0?E:0)+(((T=c[N+1])!==null&&T!==void 0?T:0)-((C=c[N])!==null&&C!==void 0?C:0))*L}},KQ=t=>{if(typeof t=="string")switch(t){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return Fk(t);case"spring":return qQ();default:if(t.split("(")[0]==="cubic-bezier")return Fk(t)}return typeof t=="function"?t:null},YQ=(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()}},D4=R.createContext(YQ);D4.Provider;function ZQ(t){var e=R.useContext(D4);return R.useMemo(()=>t??e,[t,e])}function QQ(t,e,n){return(e=JQ(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function JQ(t){var e=eJ(t,"string");return typeof e=="symbol"?e:e+""}function eJ(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 zk="init",Bk="pending",Hk="active",tJ="completed";function TE(t){return Math.max(0,t)}class nJ{getAnimationStartedTime(){return this.animationStartedTime}getBeginStartedTime(){return this.beginStartedTime}constructor(e){var n;QQ(this,"state",zk),this.animationId=e.animationId,this.onAnimationEnd=e.onAnimationEnd,this.animationDuration=TE(e.animationDuration),this.animationBegin=TE(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()===zk)return this.state=Bk,this.beginStartedTime=e,this.animationBegin;if(this.getState()===Bk){if(this.beginStartedTime==null)throw new Error;var n=e-this.beginStartedTime;return n>=this.animationBegin?(this.state=Hk,this.animationStartedTime=e,this.nextAnimationUpdate(0)):TE(this.animationBegin-n)}if(this.getState()===Hk){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=tJ}getFrom(){return this.from}getTo(){return this.to}getAnimationId(){return this.animationId}getAnimationBegin(){return this.animationBegin}}class rJ extends nJ{nextAnimationUpdate(){return 0}getInterpolated(){return this.easing(jc(this.getFrom(),this.getTo(),this.getProgress()))}}class iJ{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 sJ(t,e){return cJ(t)||lJ(t,e)||aJ(t,e)||oJ()}function oJ(){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 aJ(t,e){if(t){if(typeof t=="string")return Vk(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)?Vk(t,e):void 0}}function Vk(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{},onAnimationStart:()=>{}},Gk=0,CE=1;function j4(t){var e=Jo(t,uJ),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=I4(),m=r==="auto"?!Z0.isSsr&&!f:r,y=ZQ(e.animationController),x=R.useState(m?Gk:CE),S=sJ(x,2),_=S[0],w=S[1];return R.useEffect(()=>{m||w(CE)},[m]),R.useEffect(()=>{var E=KQ(o);if(!m||!i||E==null)return Bg;var T=new iJ,C=new rJ({animationId:n,easing:E,animationDuration:s,animationBegin:a,onAnimationStart:c,onAnimationEnd:l,from:Gk,to:CE});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(l0(e)),r=R.useRef(t);return r.current!==t&&(n.current=l0(e),r.current=t),n.current}var dJ=t=>t.replace(/([A-Z])/g,e=>"-".concat(e.toLowerCase())),fJ=(t,e,n)=>t.map(r=>"".concat(dJ(r)," ").concat(e,"ms ").concat(n)).join(","),hJ=["radius"],pJ=["radius"],Wk,$k,Xk,qk,Kk,Yk,Zk,Qk,Jk,eO;function tO(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 nO(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n{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;ya?a:_}f=Di(Wk||(Wk=dl(["M",",",""])),t,e+l*m[0]),m[0]>0&&(f+=Di($k||($k=dl(["A ",",",",0,0,",",",",",""])),m[0],m[0],d,t+c*m[0],e)),f+=Di(Xk||(Xk=dl(["L ",",",""])),t+n-c*m[1],e),m[1]>0&&(f+=Di(qk||(qk=dl(["A ",",",",0,0,",`, - `,",",""])),m[1],m[1],d,t+n,e+l*m[1])),f+=Di(Kk||(Kk=dl(["L ",",",""])),t+n,e+r-l*m[2]),m[2]>0&&(f+=Di(Yk||(Yk=dl(["A ",",",",0,0,",`, - `,",",""])),m[2],m[2],d,t+n-c*m[2],e+r)),f+=Di(Zk||(Zk=dl(["L ",",",""])),t+c*m[3],e+r),m[3]>0&&(f+=Di(Qk||(Qk=dl(["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(Jk||(Jk=dl(["M ",",",` +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _J(t,e){if(t){if(typeof t=="string")return iO(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)?iO(t,e):void 0}}function iO(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{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;ya?a:_}f=Di(Wk||(Wk=fl(["M",",",""])),t,e+l*m[0]),m[0]>0&&(f+=Di($k||($k=fl(["A ",",",",0,0,",",",",",""])),m[0],m[0],d,t+c*m[0],e)),f+=Di(Xk||(Xk=fl(["L ",",",""])),t+n-c*m[1],e),m[1]>0&&(f+=Di(qk||(qk=fl(["A ",",",",0,0,",`, + `,",",""])),m[1],m[1],d,t+n,e+l*m[1])),f+=Di(Kk||(Kk=fl(["L ",",",""])),t+n,e+r-l*m[2]),m[2]>0&&(f+=Di(Yk||(Yk=fl(["A ",",",",0,0,",`, + `,",",""])),m[2],m[2],d,t+n-c*m[2],e+r)),f+=Di(Zk||(Zk=fl(["L ",",",""])),t+c*m[3],e+r),m[3]>0&&(f+=Di(Qk||(Qk=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(Jk||(Jk=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(eO||(eO=dl(["M ",","," h "," v "," h "," Z"])),t,e,n,r,-n);return f},oO={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},MJ=t=>{var e=Jo(t,oO),n=R.useRef(null),r=R.useState(-1),i=xJ(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,E=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]),L=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=rO(V,hJ);return R.createElement("path",Mw({},k,{x:xd(a),y:xd(l),width:xd(c),height:xd(d),radius:typeof f=="number"?f:void 0,className:F,d:sO(a,l,c,d,f)}))}var U=E.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=fJ(["strokeDasharray"],x,typeof y=="string"?y:oO.animationEasing);return R.createElement(j4,{animationId:L,key:L,canBegin:s>0,duration:x,easing:y,isActive:w,begin:S},B=>{var K=jc(U,c,B),q=jc(H,d,B),$=jc(ne,a,B),Z=jc(te,l,B);n.current&&(E.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=rO(ae,pJ);return R.createElement("path",Mw({},fe,{radius:typeof f=="number"?f:void 0,className:F,d:sO($,Z,K,q,f),ref:n,style:nO(nO({},ge),e.style)}))})};function aO(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 lO(t){for(var e=1;et*180/Math.PI,zi=(t,e,n,r)=>({x:t+Math.cos(-Ew*r)*n,y:e+Math.sin(-Ew*r)*n}),PJ=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},RJ=(t,e)=>{var n=t.x,r=t.y,i=e.x,s=e.y;return Math.sqrt((n-i)**2+(r-s)**2)},NJ=(t,e)=>{var n=t.x,r=t.y,i=e.cx,s=e.cy,o=RJ({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:CJ(l),angleInRadian:l}},IJ=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}},kJ=(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},OJ=(t,e)=>{var n=t.relativeX,r=t.relativeY,i=NJ({x:n,y:r},e),s=i.radius,o=i.angle,a=e.innerRadius,l=e.outerRadius;if(sl||s===0)return null;var c=IJ(e),d=c.startAngle,f=c.endAngle,m=o,y;if(d<=f){for(;m>f;)m-=360;for(;m=d&&m<=f}else{for(;m>d;)m-=360;for(;m=f&&m<=d}return y?lO(lO({},e),{},{radius:s,angle:kJ(m,e)}):null};function F4(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 cO,uO,dO,fO,hO,pO,mO;function xC(){return xC=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var n=Wo(e-t),r=Math.min(Math.abs(e-t),359.999);return n*r},Cb=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)/Ew,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*Ew),x);return{center:m,circleTangency:y,lineTangency:S,theta:d}},z4=t=>{var e=t.cx,n=t.cy,r=t.innerRadius,i=t.outerRadius,s=t.startAngle,o=t.endAngle,a=LJ(s,o),l=s+a,c=zi(e,n,i,s),d=zi(e,n,i,l),f=Di(cO||(cO=eh(["M ",",",` + 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(eO||(eO=fl(["M ",","," h "," v "," h "," Z"])),t,e,n,r,-n);return f},oO={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},MJ=t=>{var e=Jo(t,oO),n=R.useRef(null),r=R.useState(-1),i=xJ(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,E=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]),L=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=rO(V,hJ);return R.createElement("path",Mw({},k,{x:xd(a),y:xd(l),width:xd(c),height:xd(d),radius:typeof f=="number"?f:void 0,className:F,d:sO(a,l,c,d,f)}))}var U=E.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=fJ(["strokeDasharray"],x,typeof y=="string"?y:oO.animationEasing);return R.createElement(j4,{animationId:L,key:L,canBegin:s>0,duration:x,easing:y,isActive:w,begin:S},B=>{var K=jc(U,c,B),q=jc(H,d,B),$=jc(ne,a,B),Z=jc(te,l,B);n.current&&(E.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=rO(ae,pJ);return R.createElement("path",Mw({},fe,{radius:typeof f=="number"?f:void 0,className:F,d:sO($,Z,K,q,f),ref:n,style:nO(nO({},ge),e.style)}))})};function aO(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 lO(t){for(var e=1;et*180/Math.PI,zi=(t,e,n,r)=>({x:t+Math.cos(-Ew*r)*n,y:e+Math.sin(-Ew*r)*n}),PJ=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},RJ=(t,e)=>{var n=t.x,r=t.y,i=e.x,s=e.y;return Math.sqrt((n-i)**2+(r-s)**2)},NJ=(t,e)=>{var n=t.x,r=t.y,i=e.cx,s=e.cy,o=RJ({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:CJ(l),angleInRadian:l}},IJ=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}},kJ=(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},OJ=(t,e)=>{var n=t.relativeX,r=t.relativeY,i=NJ({x:n,y:r},e),s=i.radius,o=i.angle,a=e.innerRadius,l=e.outerRadius;if(sl||s===0)return null;var c=IJ(e),d=c.startAngle,f=c.endAngle,m=o,y;if(d<=f){for(;m>f;)m-=360;for(;m=d&&m<=f}else{for(;m>d;)m-=360;for(;m=f&&m<=d}return y?lO(lO({},e),{},{radius:s,angle:kJ(m,e)}):null};function F4(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 cO,uO,dO,fO,hO,pO,mO;function xC(){return xC=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var n=Wo(e-t),r=Math.min(Math.abs(e-t),359.999);return n*r},Cb=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)/Ew,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*Ew),x);return{center:m,circleTangency:y,lineTangency:S,theta:d}},z4=t=>{var e=t.cx,n=t.cy,r=t.innerRadius,i=t.outerRadius,s=t.startAngle,o=t.endAngle,a=LJ(s,o),l=s+a,c=zi(e,n,i,s),d=zi(e,n,i,l),f=Di(cO||(cO=eh(["M ",",",` A `,",",`,0, `,",",`, `,",",` @@ -538,22 +538,22 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `])),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=Cb({cx:e,cy:n,radius:r,angle:l,sign:d,isExternal:!0,cornerRadius:s,cornerIsExternal:a}),N=O.circleTangency,L=O.lineTangency,F=O.theta,V=Cb({cx:e,cy:n,radius:r,angle:c,sign:-d,isExternal:!0,cornerRadius:s,cornerIsExternal:a}),k=V.circleTangency,U=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(pO||(pO=eh(["L",",",` A`,",",",0,0,",",",",",` A`,",",",0,",",",",",",",` - A`,",",",0,0,",",",",","Z"])),U.x,U.y,s,s,+(d<0),k.x,k.y,r,r,+(ne>180),+(d>0),N.x,N.y,s,s,+(d<0),L.x,L.y)}else C+=Di(mO||(mO=eh(["L",",","Z"])),e,n);return C},jJ={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},UJ=t=>{var e=Jo(t,jJ),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(s0&&Math.abs(c-d)<360?S=DJ({cx:n,cy:r,innerRadius:i,outerRadius:s,cornerRadius:Math.min(x,y/2),forceCornerRadius:a,cornerIsExternal:l,startAngle:c,endAngle:d}):S=z4({cx:n,cy:r,innerRadius:i,outerRadius:s,startAngle:c,endAngle:d}),R.createElement("path",xC({},Ko(e),{className:m,d:S}))};function FJ(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(_5(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 F4(e)}}function zJ(t){return L5(t)?NaN:Number(t)}function PE(t){return t?(t=zJ(t),t===1/0||t===-1/0?(t<0?-1:1)*Number.MAX_VALUE:t===t?t:0):t===0?t:0}function B4(t,e,n){n&&typeof n!="number"&&JT(t,e,n)&&(e=n=void 0),t=PE(t),e===void 0?(e=t,t=0):e=PE(e),n=n===void 0?tt.chartData,KP=Oe([Wa],t=>{var e=t.chartData!=null?t.chartData.length-1:0;return{chartData:t.chartData,computedData:t.computedData,dataEndIndex:e,dataStartIndex:0}}),bS=(t,e,n,r)=>r?KP(t):Wa(t),BJ=(t,e,n)=>n?KP(t):Wa(t),HJ=Oe([bS],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});Oe([KP],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});var VJ=Oe([Wa],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});function YP(t,e){return XJ(t)||$J(t,e)||WJ(t,e)||GJ()}function GJ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. + A`,",",",0,0,",",",",","Z"])),U.x,U.y,s,s,+(d<0),k.x,k.y,r,r,+(ne>180),+(d>0),N.x,N.y,s,s,+(d<0),L.x,L.y)}else C+=Di(mO||(mO=eh(["L",",","Z"])),e,n);return C},jJ={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},UJ=t=>{var e=Jo(t,jJ),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(s0&&Math.abs(c-d)<360?S=DJ({cx:n,cy:r,innerRadius:i,outerRadius:s,cornerRadius:Math.min(x,y/2),forceCornerRadius:a,cornerIsExternal:l,startAngle:c,endAngle:d}):S=z4({cx:n,cy:r,innerRadius:i,outerRadius:s,startAngle:c,endAngle:d}),R.createElement("path",xC({},Ko(e),{className:m,d:S}))};function FJ(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(_5(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 F4(e)}}function zJ(t){return L5(t)?NaN:Number(t)}function PE(t){return t?(t=zJ(t),t===1/0||t===-1/0?(t<0?-1:1)*Number.MAX_VALUE:t===t?t:0):t===0?t:0}function B4(t,e,n){n&&typeof n!="number"&&JT(t,e,n)&&(e=n=void 0),t=PE(t),e===void 0?(e=t,t=0):e=PE(e),n=n===void 0?tt.chartData,KP=Oe([$a],t=>{var e=t.chartData!=null?t.chartData.length-1:0;return{chartData:t.chartData,computedData:t.computedData,dataEndIndex:e,dataStartIndex:0}}),bS=(t,e,n,r)=>r?KP(t):$a(t),BJ=(t,e,n)=>n?KP(t):$a(t),HJ=Oe([bS],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});Oe([KP],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});var VJ=Oe([$a],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});function YP(t,e){return XJ(t)||$J(t,e)||WJ(t,e)||GJ()}function GJ(){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 WJ(t,e){if(t){if(typeof t=="string")return gO(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)?gO(t,e):void 0}}function gO(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);nt.e^s.s<0?1:-1;for(r=s.d.length,i=t.d.length,e=0,n=rt.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(m0(n,s),m0(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?$4(e,t):G4(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 W4(this)};At.naturalLogarithm=At.ln=function(){return m0(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?G4(e,t):$4(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=Gg((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=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,Vg),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,Vg),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,Vg),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)<=V4){for(i=new l(yo),e=Math.ceil(r/or+4),ur=!1;n%2&&(i=i.times(a),xO(i.d,e)),n=Gg(n/2),n!==0;)a=a.times(a),xO(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(m0(a,r+c)),ur=!0,i=W4(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,Vg),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,Vg),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 G4(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||tn)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;eo?1:-1;else for(a=l=0;ai[a]?1:-1;break}return l}function n(r,i,s){for(var o=0;s--;)r[s]-=o,o=r[s]1;)r.shift()}return function(r,i,s,o){var a,l,c,d,f,m,y,x,S,_,w,E,T,C,O,N,L,F,V=r.constructor,k=r.s==i.s?1:-1,U=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,L=H.length,O=U.length,y=new V(k),x=y.d=[],c=0;H[c]==(U[c]||0);)++c;if(H[c]>(U[c]||0)&&--l,s==null?E=s=V.precision:o?E=s+(Vr(r)-Vr(i))+1:E=s,E<0)return new V(0);if(E=E/or+2|0,c=0,L==1)for(d=0,H=H[0],E++;(c1&&(H=t(H,d),U=t(U,d),L=H.length,O=U.length),C=L,S=U.slice(0,L),_=S.length;_=vi/2&&++N;do d=0,a=e(H,S,L,_),a<0?(w=S[0],L!=_&&(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,L16)throw Error(ZP+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 RE(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 m0(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),RE(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=RE(S,c+2,_).times(s+""),y=m0(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(RE(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 yO(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=Gg(n/or),t.d=[],r=(n+1)%or,n<0&&(r+=or),rAw||t.e<-Aw))throw Error(ZP+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=Gg(-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>Aw||t.e<-Aw))throw Error(ZP+Vr(t));return t}function $4(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=i0;--i)l[a++]=0;for(i=f.length;i>o;){if(l[--i]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)0&&(i+1===o&&(s+="."),s+=ad(r))),t.s<0?"-"+s:s}function xO(t,e){if(t.length>e)return t.length=e,!0}function X4(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 yO(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,YJ.test(s))yO(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=X4,i.config=i.set=ZJ,t===void 0&&(t={}),t)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],e=0;e=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 QP=X4(KJ);yo=new QP(1);const Tn=QP;function q4(t){var e;return t===0?e=1:e=Math.floor(new Tn(t).abs().log(10).toNumber())+1,e}function K4(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 g0(t,e){return tee(t)||eee(t,e)||JJ(t,e)||QJ()}function QJ(){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 JJ(t,e){if(t){if(typeof t=="string")return bO(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)?bO(t,e):void 0}}function bO(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{var e=g0(t,2),n=e[0],r=e[1],i=n,s=r;return n>r&&(i=r,s=n),[i,s]},JP=(t,e,n)=>{if(t.lte(0))return new Tn(0);var r=q4(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()))},Z4=(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()))},nee=(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(q4(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;l4&&arguments[4]!==void 0?arguments[4]:0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:JP;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?Q4(e,n,r,i,s+1,o):(f0?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))})},_O=function(e){var n=g0(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=Y4([r,i]),d=g0(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 nee(f,s,o);var x=a==="snap125"?Z4:JP,S=Q4(f,m,l,o,0,x),_=S.step,w=S.tickMin,E=S.tickMax,T=K4(w,E.add(new Tn(.1).mul(_)),_);return r>i?T.reverse():T},wO=function(e,n){var r=g0(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=Y4([i,s]),c=g0(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"?Z4:JP,y=Math.max(n,2),x=m(new Tn(f).sub(d).div(y-1),o,0),S=[...K4(new Tn(d),new Tn(f),x),f];return o===!1&&(S=S.map(_=>Math.round(_))),i>s?S.reverse():S},ree=t=>t.rootProps.barCategoryGap,_S=t=>t.rootProps.stackOffset,J4=t=>t.rootProps.reverseStackOrder,e2=t=>t.options.chartName,t2=t=>t.rootProps.syncId,ez=t=>t.rootProps.syncMethod,n2=t=>t.options.eventEmitter,iee=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"},fl={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,includeHidden:!1,radiusAxisId:0,reversed:!1,scale:"auto",tick:!0,tickCount:5,type:"auto"},wS=(t,e)=>{if(!(!t||!e))return t!=null&&t.reversed?[e[1],e[0]]:e};function SS(t,e,n){if(n!=="auto")return n;if(t!=null)return Fl(t,e)?"category":"number"}function SO(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 Tw(t){for(var e=1;e{if(e!=null)return t.polarAxis.angleAxis[e]},r2=Oe([lee,M4],(t,e)=>{var n;if(t!=null)return t;var r=(n=SS(e,"angleAxis",MO.type))!==null&&n!==void 0?n:"category";return Tw(Tw({},MO),{},{type:r})}),cee=(t,e)=>t.polarAxis.radiusAxis[e],i2=Oe([cee,M4],(t,e)=>{var n;if(t!=null)return t;var r=(n=SS(e,"radiusAxis",EO.type))!==null&&n!==void 0?n:"category";return Tw(Tw({},EO),{},{type:r})}),MS=t=>t.polarOptions,s2=Oe([tu,nu,Gi],PJ),tz=Oe([MS,s2],(t,e)=>{if(t!=null)return Ad(t.innerRadius,e,0)}),nz=Oe([MS,s2],(t,e)=>{if(t!=null)return Ad(t.outerRadius,e,e*.8)}),uee=t=>{if(t==null)return[0,0];var e=t.startAngle,n=t.endAngle;return[e,n]},rz=Oe([MS],uee);Oe([r2,rz],wS);var iz=Oe([s2,tz,nz],(t,e,n)=>{if(!(t==null||e==null||n==null))return[e,n]});Oe([i2,iz],wS);var sz=Oe([fr,MS,tz,nz,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,ES=(t,e,n)=>n;function o2(t){return t==null?void 0:t.id}function oz(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=o2(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 a2(t){return"stackId"in t&&t.stackId!=null&&t.dataKey!=null}var AS=(t,e)=>t===e?!0:t==null||e==null?!1:t[0]===e[0]&&t[1]===e[1];function TS(t,e){return Array.isArray(t)&&Array.isArray(e)&&t.length===0&&e.length===0?!0:t===e}function dee(t,e){if(t.length===e.length){for(var n=0;n{var e=fr(t);return e==="horizontal"?"xAxis":e==="vertical"?"yAxis":e==="centric"?"angleAxis":"radiusAxis"},Wg=t=>t.tooltip.settings.axisId;function l2(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 fee=(t,e)=>{if(e!=null)switch(t){case"linear":{if(!Al(e)){for(var n,r,i=0;ir)&&(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:te?1:t>=e?0:NaN}function hee(t,e){return t==null||e==null?NaN:et?1:e>=t?0:NaN}function c2(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===hee?t:pee,n=t,r=t);function i(a,l,c=0,d=a.length){if(c>>1;n(a[f],l)<0?c=f+1:d=f}while(c>>1;n(a[f],l)<=0?c=f+1:d=f}while(cc&&r(a[f-1],l)>-r(a[f],l)?f-1:f}return{left:i,center:o,right:s}}function pee(){return 0}function az(t){return t===null?NaN:+t}function*mee(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const gee=c2(wd),Q0=gee.right;c2(az).center;class AO extends Map{constructor(e,n=xee){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(TO(this,e))}has(e){return super.has(TO(this,e))}set(e,n){return super.set(vee(this,e),n)}delete(e){return super.delete(yee(this,e))}}function TO({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function vee({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function yee({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function xee(t){return t!==null&&typeof t=="object"?t.valueOf():t}function bee(t=wd){if(t===wd)return lz;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 lz(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(te?1:0)}const _ee=Math.sqrt(50),wee=Math.sqrt(10),See=Math.sqrt(2);function Cw(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>=_ee?10:s>=wee?5:s>=See?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/ce&&--l,c=-c):(c=Math.pow(10,i)*o,a=Math.round(t/c),l=Math.round(e/c),a*ce&&--l),l0))return[];if(t===e)return[t];const r=e=i))return[];const a=s-i+1,l=new Array(a);if(r)if(o<0)for(let c=0;c=r)&&(n=r);return n}function PO(t,e){let n;for(const r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function cz(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?lz:bee(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));cz(t,e,y,x,i)}const s=t[e];let o=n,a=r;for(ly(t,n,e),i(t[r],s)>0&&ly(t,n,r);o0;)--a}i(t[n],s)===0?ly(t,n,a):(++a,ly(t,a,r)),a<=e&&(n=a+1),e<=a&&(r=a-1)}return t}function ly(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function Mee(t,e,n){if(t=Float64Array.from(mee(t)),!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return PO(t);if(e>=1)return CO(t);var r,i=(r-1)*e,s=Math.floor(i),o=CO(cz(t,s).subarray(0,s+1)),a=PO(t.subarray(s+1));return o+(a-o)*(i-s)}}function Eee(t,e,n=az){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 Aee(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>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Pb(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Pb(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=Pee.exec(t))?new Ys(e[1],e[2],e[3],1):(e=Ree.exec(t))?new Ys(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Nee.exec(t))?Pb(e[1],e[2],e[3],e[4]):(e=Iee.exec(t))?Pb(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=kee.exec(t))?DO(e[1],e[2]/100,e[3]/100,1):(e=Oee.exec(t))?DO(e[1],e[2]/100,e[3]/100,e[4]):RO.hasOwnProperty(t)?kO(RO[t]):t==="transparent"?new Ys(NaN,NaN,NaN,0):null}function kO(t){return new Ys(t>>16&255,t>>8&255,t&255,1)}function Pb(t,e,n,r){return r<=0&&(t=e=n=NaN),new Ys(t,e,n,r)}function jee(t){return t instanceof J0||(t=x0(t)),t?(t=t.rgb(),new Ys(t.r,t.g,t.b,t.opacity)):new Ys}function MC(t,e,n,r){return arguments.length===1?jee(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}f2(Ys,MC,dz(J0,{brighter(t){return t=t==null?Pw:Math.pow(Pw,t),new Ys(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?v0:Math.pow(v0,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),Rw(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:OO,formatHex:OO,formatHex8:Uee,formatRgb:LO,toString:LO}));function OO(){return`#${th(this.r)}${th(this.g)}${th(this.b)}`}function Uee(){return`#${th(this.r)}${th(this.g)}${th(this.b)}${th((isNaN(this.opacity)?1:this.opacity)*255)}`}function LO(){const t=Rw(this.opacity);return`${t===1?"rgb(":"rgba("}${wh(this.r)}, ${wh(this.g)}, ${wh(this.b)}${t===1?")":`, ${t})`}`}function Rw(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 DO(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Ua(t,e,n,r)}function fz(t){if(t instanceof Ua)return new Ua(t.h,t.s,t.l,t.opacity);if(t instanceof J0||(t=x0(t)),!t)return new Ua;if(t instanceof Ua)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+(n0&&l<1?0:o,new Ua(o,a,l,t.opacity)}function Fee(t,e,n,r){return arguments.length===1?fz(t):new Ua(t,e,n,r??1)}function Ua(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}f2(Ua,Fee,dz(J0,{brighter(t){return t=t==null?Pw:Math.pow(Pw,t),new Ua(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?v0:Math.pow(v0,t),new Ua(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(NE(t>=240?t-240:t+120,i,r),NE(t,i,r),NE(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Ua(jO(this.h),Rb(this.s),Rb(this.l),Rw(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=Rw(this.opacity);return`${t===1?"hsl(":"hsla("}${jO(this.h)}, ${Rb(this.s)*100}%, ${Rb(this.l)*100}%${t===1?")":`, ${t})`}`}}));function jO(t){return t=(t||0)%360,t<0?t+360:t}function Rb(t){return Math.max(0,Math.min(1,t||0))}function NE(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 h2=t=>()=>t;function zee(t,e){return function(n){return t+n*e}}function Bee(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 Hee(t){return(t=+t)==1?hz:function(e,n){return n-e?Bee(e,n,t):h2(isNaN(e)?n:e)}}function hz(t,e){var n=e-t;return n?zee(t,n):h2(isNaN(t)?e:t)}const UO=(function t(e){var n=Hee(e);function r(i,s){var o=n((i=MC(i)).r,(s=MC(s)).r),a=n(i.g,s.g),l=n(i.b,s.b),c=hz(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 Vee(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),i;return function(s){for(i=0;in&&(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:Nw(r,i)})),n=IE.lastIndex;return ne&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function ete(t,e,n){var r=t[0],i=t[1],s=e[0],o=e[1];return i2?tte:ete,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),Nw)))(m)))},f.domain=function(m){return arguments.length?(t=Array.from(m,Iw),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=p2,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 m2(){return CS()(Es,Es)}function nte(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function kw(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 Eg(t){return t=kw(Math.abs(t)),t?t[1]:NaN}function rte(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 ite(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var ste=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function b0(t){if(!(e=ste.exec(t)))throw new Error("invalid format: "+t);var e;return new g2({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]})}b0.prototype=g2.prototype;function g2(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+""}g2.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 ote(t){e:for(var e=t.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(i+1):t}var Ow;function ate(t,e){var n=kw(t,e);if(!n)return Ow=void 0,t.toPrecision(e);var r=n[0],i=n[1],s=i-(Ow=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")+kw(t,Math.max(0,e+s-1))[0]}function zO(t,e){var n=kw(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 BO={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:nte,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)=>zO(t*100,e),r:zO,s:ate,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function HO(t){return t}var VO=Array.prototype.map,GO=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function lte(t){var e=t.grouping===void 0||t.thousands===void 0?HO:rte(VO.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?HO:ite(VO.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=b0(f);var y=f.fill,x=f.align,S=f.sign,_=f.symbol,w=f.zero,E=f.width,T=f.comma,C=f.precision,O=f.trim,N=f.type;N==="n"?(T=!0,N="g"):BO[N]||(C===void 0&&(C=12),O=!0,N="g"),(w||y==="0"&&x==="=")&&(w=!0,y="0",x="=");var L=(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=BO[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 U(H){var ne=L,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=ote(H)),B&&+H==0&&S!=="+"&&(B=!1),ne=(B?S==="("?S:a:S==="-"||S==="("?"":S)+ne,te=(N==="s"&&!isNaN(H)&&Ow!==void 0?GO[8+Ow/3]:"")+te+(B&&S==="("?")":""),k){for(pe=-1,oe=H.length;++pece||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>1)+ne+H+te+q.slice(K);break;default:H=q+ne+H+te;break}return s(H)}return U.toString=function(){return f+""},U}function d(f,m){var y=Math.max(-8,Math.min(8,Math.floor(Eg(m)/3)))*3,x=Math.pow(10,-y),S=c((f=b0(f),f.type="f",f),{suffix:GO[8+y/3]});return function(_){return S(x*_)}}return{format:c,formatPrefix:d}}var Nb,v2,pz;cte({thousands:",",grouping:[3],currency:["$",""]});function cte(t){return Nb=lte(t),v2=Nb.format,pz=Nb.formatPrefix,Nb}function ute(t){return Math.max(0,-Eg(Math.abs(t)))}function dte(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Eg(e)/3)))*3-Eg(Math.abs(t)))}function fte(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Eg(e)-Eg(t))+1}function mz(t,e,n,r){var i=wC(t,e,n),s;switch(r=b0(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(s=dte(i,o))&&(r.precision=s),pz(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(s=fte(i,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=s-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(s=ute(i))&&(r.precision=s-(r.type==="%")*2);break}}return v2(r)}function Rd(t){var e=t.domain;return t.ticks=function(n){var r=e();return bC(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var i=e();return mz(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(a0;){if(c=_C(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 gz(){var t=m2();return t.copy=function(){return ex(t,gz())},ea.apply(t,arguments),Rd(t)}function vz(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,Iw),n):t.slice()},n.unknown=function(r){return arguments.length?(e=r,n):e},n.copy=function(){return vz(t).unknown(e)},t=arguments.length?Array.from(t,Iw):[0,1],Rd(n)}function yz(t,e){t=t.slice();var n=0,r=t.length-1,i=t[n],s=t[r],o;return sMath.pow(t,e)}function vte(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 XO(t){return(e,n)=>-t(-e,n)}function y2(t){const e=t(WO,$O),n=e.domain;let r=10,i,s;function o(){return i=vte(r),s=gte(r),n()[0]<0?(i=XO(i),s=XO(s),t(hte,pte)):t(WO,$O),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=d0){for(;m<=y;++m)for(x=1;xd)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),!(Sd)break;w.push(S)}w.length*2<_&&(w=bC(c,d,_))}else w=bC(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=b0(l)).precision==null&&(l.trim=!0),l=v2(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*rn(yz(n(),{floor:a=>s(Math.floor(i(a))),ceil:a=>s(Math.ceil(i(a)))})),e}function xz(){const t=y2(CS()).domain([1,10]);return t.copy=()=>ex(t,xz()).base(t.base()),ea.apply(t,arguments),t}function qO(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function KO(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function x2(t){var e=1,n=t(qO(e),KO(e));return n.constant=function(r){return arguments.length?t(qO(e=+r),KO(e)):e},Rd(n)}function bz(){var t=x2(CS());return t.copy=function(){return ex(t,bz()).constant(t.constant())},ea.apply(t,arguments)}function YO(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function yte(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function xte(t){return t<0?-t*t:t*t}function b2(t){var e=t(Es,Es),n=1;function r(){return n===1?t(Es,Es):n===.5?t(yte,xte):t(YO(n),YO(1/n))}return e.exponent=function(i){return arguments.length?(n=+i,r()):n},Rd(e)}function _2(){var t=b2(CS());return t.copy=function(){return ex(t,_2()).exponent(t.exponent())},ea.apply(t,arguments),t}function bte(){return _2.apply(null,arguments).exponent(.5)}function ZO(t){return Math.sign(t)*t*t}function _te(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function _z(){var t=m2(),e=[0,1],n=!1,r;function i(s){var o=_te(t(s));return isNaN(o)?r:n?Math.round(o):o}return i.invert=function(s){return t.invert(ZO(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,Iw)).map(ZO)),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 _z(t.domain(),e).round(n).clamp(t.clamp()).unknown(r)},ea.apply(i,arguments),Rd(i)}function wz(){var t=[],e=[],n=[],r;function i(){var o=0,a=Math.max(1,e.length);for(n=new Array(a-1);++o0?n[a-1]:t[0],a=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 Sz().domain([t,e]).range(i).unknown(s)},ea.apply(Rd(o),arguments)}function Mz(){var t=[.5],e=[0,1],n,r=1;function i(s){return s!=null&&s<=s?e[Q0(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 Mz().domain(t).range(e).unknown(n)},ea.apply(i,arguments)}const kE=new Date,OE=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(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),!(s0))return l;let c;do l.push(c=new Date(+s)),e(s,a),t(s);while(coi(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)=>(kE.setTime(+s),OE.setTime(+o),t(kE),t(OE),Math.floor(n(kE,OE))),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 Lw=oi(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Lw.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):Lw);Lw.range;const Uc=1e3,Xo=Uc*60,Fc=Xo*60,Yc=Fc*24,w2=Yc*7,QO=Yc*30,LE=Yc*365,nh=oi(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*Uc)},(t,e)=>(e-t)/Uc,t=>t.getUTCSeconds());nh.range;const S2=oi(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Uc)},(t,e)=>{t.setTime(+t+e*Xo)},(t,e)=>(e-t)/Xo,t=>t.getMinutes());S2.range;const M2=oi(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*Xo)},(t,e)=>(e-t)/Xo,t=>t.getUTCMinutes());M2.range;const E2=oi(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Uc-t.getMinutes()*Xo)},(t,e)=>{t.setTime(+t+e*Fc)},(t,e)=>(e-t)/Fc,t=>t.getHours());E2.range;const A2=oi(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*Fc)},(t,e)=>(e-t)/Fc,t=>t.getUTCHours());A2.range;const tx=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);tx.range;const PS=oi(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Yc,t=>t.getUTCDate()-1);PS.range;const Ez=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));Ez.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)/w2)}const RS=Yh(0),Dw=Yh(1),wte=Yh(2),Ste=Yh(3),Ag=Yh(4),Mte=Yh(5),Ete=Yh(6);RS.range;Dw.range;wte.range;Ste.range;Ag.range;Mte.range;Ete.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)/w2)}const NS=Zh(0),jw=Zh(1),Ate=Zh(2),Tte=Zh(3),Tg=Zh(4),Cte=Zh(5),Pte=Zh(6);NS.range;jw.range;Ate.range;Tte.range;Tg.range;Cte.range;Pte.range;const T2=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());T2.range;const C2=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());C2.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 Az(t,e,n,r,i,s){const o=[[nh,1,Uc],[nh,5,5*Uc],[nh,15,15*Uc],[nh,30,30*Uc],[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,w2],[e,1,QO],[e,3,3*QO],[t,1,LE]];function a(c,d,f){const m=d_).right(o,m);if(y===o.length)return t.every(wC(c/LE,d/LE,f));if(y===0)return Lw.every(Math.max(wC(c,d,f),1));const[x,S]=o[m/o[y-1][2]53)return null;"w"in ue||(ue.w=1),"Z"in ue?(Ge=jE(cy(ue.y,0,1)),je=Ge.getUTCDay(),Ge=je>4||je===0?jw.ceil(Ge):jw(Ge),Ge=PS.offset(Ge,(ue.V-1)*7),ue.y=Ge.getUTCFullYear(),ue.m=Ge.getUTCMonth(),ue.d=Ge.getUTCDate()+(ue.w+6)%7):(Ge=DE(cy(ue.y,0,1)),je=Ge.getDay(),Ge=je>4||je===0?Dw.ceil(Ge):Dw(Ge),Ge=tx.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),je="Z"in ue?jE(cy(ue.y,0,1)).getUTCDay():DE(cy(ue.y,0,1)).getDay(),ue.m=0,ue.d="W"in ue?(ue.w+6)%7+ue.W*7-(je+5)%7:ue.w+ue.U*7-(je+6)%7);return"Z"in ue?(ue.H+=ue.Z/100|0,ue.M+=ue.Z%100,jE(ue)):DE(ue)}}function F(Me,He,Xe,ue){for(var Q=0,Ge=He.length,je=Xe.length,We,Qe;Q=je)return-1;if(We=He.charCodeAt(Q++),We===37){if(We=He.charAt(Q++),Qe=O[We in JO?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 U(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=E.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=L(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=L(Me+="",!0);return He.toString=function(){return Me},He}}}var JO={"-":"",_:" ",0:"0"},wi=/^\s*\d+/,Lte=/^%/,Dte=/[\\^$*+?|[\]().{}]/g;function Un(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",s=i.length;return r+(s[e.toLowerCase(),n]))}function Ute(t,e,n){var r=wi.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function Fte(t,e,n){var r=wi.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function zte(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function Bte(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Hte(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function eL(t,e,n){var r=wi.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function tL(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 Vte(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 Gte(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 Wte(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 nL(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function $te(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 rL(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function Xte(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function qte(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Kte(t,e,n){var r=wi.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Yte(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 Zte(t,e,n){var r=Lte.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Qte(t,e,n){var r=wi.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Jte(t,e,n){var r=wi.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function iL(t,e){return Un(t.getDate(),e,2)}function ene(t,e){return Un(t.getHours(),e,2)}function tne(t,e){return Un(t.getHours()%12||12,e,2)}function nne(t,e){return Un(1+tx.count(Zc(t),t),e,3)}function Tz(t,e){return Un(t.getMilliseconds(),e,3)}function rne(t,e){return Tz(t,e)+"000"}function ine(t,e){return Un(t.getMonth()+1,e,2)}function sne(t,e){return Un(t.getMinutes(),e,2)}function one(t,e){return Un(t.getSeconds(),e,2)}function ane(t){var e=t.getDay();return e===0?7:e}function lne(t,e){return Un(RS.count(Zc(t)-1,t),e,2)}function Cz(t){var e=t.getDay();return e>=4||e===0?Ag(t):Ag.ceil(t)}function cne(t,e){return t=Cz(t),Un(Ag.count(Zc(t),t)+(Zc(t).getDay()===4),e,2)}function une(t){return t.getDay()}function dne(t,e){return Un(Dw.count(Zc(t)-1,t),e,2)}function fne(t,e){return Un(t.getFullYear()%100,e,2)}function hne(t,e){return t=Cz(t),Un(t.getFullYear()%100,e,2)}function pne(t,e){return Un(t.getFullYear()%1e4,e,4)}function mne(t,e){var n=t.getDay();return t=n>=4||n===0?Ag(t):Ag.ceil(t),Un(t.getFullYear()%1e4,e,4)}function gne(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Un(e/60|0,"0",2)+Un(e%60,"0",2)}function sL(t,e){return Un(t.getUTCDate(),e,2)}function vne(t,e){return Un(t.getUTCHours(),e,2)}function yne(t,e){return Un(t.getUTCHours()%12||12,e,2)}function xne(t,e){return Un(1+PS.count(Qc(t),t),e,3)}function Pz(t,e){return Un(t.getUTCMilliseconds(),e,3)}function bne(t,e){return Pz(t,e)+"000"}function _ne(t,e){return Un(t.getUTCMonth()+1,e,2)}function wne(t,e){return Un(t.getUTCMinutes(),e,2)}function Sne(t,e){return Un(t.getUTCSeconds(),e,2)}function Mne(t){var e=t.getUTCDay();return e===0?7:e}function Ene(t,e){return Un(NS.count(Qc(t)-1,t),e,2)}function Rz(t){var e=t.getUTCDay();return e>=4||e===0?Tg(t):Tg.ceil(t)}function Ane(t,e){return t=Rz(t),Un(Tg.count(Qc(t),t)+(Qc(t).getUTCDay()===4),e,2)}function Tne(t){return t.getUTCDay()}function Cne(t,e){return Un(jw.count(Qc(t)-1,t),e,2)}function Pne(t,e){return Un(t.getUTCFullYear()%100,e,2)}function Rne(t,e){return t=Rz(t),Un(t.getUTCFullYear()%100,e,2)}function Nne(t,e){return Un(t.getUTCFullYear()%1e4,e,4)}function Ine(t,e){var n=t.getUTCDay();return t=n>=4||n===0?Tg(t):Tg.ceil(t),Un(t.getUTCFullYear()%1e4,e,4)}function kne(){return"+0000"}function oL(){return"%"}function aL(t){return+t}function lL(t){return Math.floor(+t/1e3)}var lm,Nz,Iz;One({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 One(t){return lm=Ote(t),Nz=lm.format,lm.parse,Iz=lm.utcFormat,lm.utcParse,lm}function Lne(t){return new Date(t)}function Dne(t){return t instanceof Date?+t:+new Date(+t)}function P2(t,e,n,r,i,s,o,a,l,c){var d=m2(),f=d.invert,m=d.domain,y=c(".%L"),x=c(":%S"),S=c("%I:%M"),_=c("%I %p"),w=c("%a %d"),E=c("%b %d"),T=c("%B"),C=c("%Y");function O(N){return(l(N)e(i/(t.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(i,s)=>Mee(t,s/r))},n.copy=function(){return Dz(e).domain(t)},ru.apply(n,arguments)}function kS(){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{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 Vne(r)?r:"point"}};function Gne(t,e){for(var n=0,r=t.length,i=t[0]e)?n=s+1:r=s}return n}function Hz(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=Gne(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 Wne(t){if(t!=null)return"invert"in t&&typeof t.invert=="function"?t.invert.bind(t):Hz(t,void 0)}function uL(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;et.length)&&(e=t.length);for(var n=0,r=Array(e);nt.cartesianAxis.xAxis[e],iu=(t,e)=>{var n=Gz(t,e);return n??ti},ni={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:TC,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:X0},Wz=(t,e)=>t.cartesianAxis.yAxis[e],su=(t,e)=>{var n=Wz(t,e);return n??ni},Jne={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:""},k2=(t,e)=>{var n=t.cartesianAxis.zAxis[e];return n??Jne},Ps=(t,e,n)=>{switch(e){case"xAxis":return iu(t,n);case"yAxis":return su(t,n);case"zAxis":return k2(t,n);case"angleAxis":return r2(t,n);case"radiusAxis":return i2(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},ere=(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))}},nx=(t,e,n)=>{switch(e){case"xAxis":return iu(t,n);case"yAxis":return su(t,n);case"angleAxis":return r2(t,n);case"radiusAxis":return i2(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},$z=t=>t.graphicalItems.cartesianItems.some(e=>e.type==="bar")||t.graphicalItems.polarItems.some(e=>e.type==="radialBar");function Xz(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 qz=t=>t.graphicalItems.cartesianItems,tre=Oe([bi,ES],Xz),Kz=(t,e,n)=>t.filter(n).filter(r=>(e==null?void 0:e.includeHidden)===!0?!0:!r.hide),Xg=Oe([qz,Ps,tre],Kz,{memoizeOptions:{resultEqualityCheck:TS}}),Yz=Oe([Xg],t=>t.filter(e=>e.type==="area"||e.type==="bar").filter(a2)),Zz=t=>t.filter(e=>!("stackId"in e)||e.stackId===void 0),nre=Oe([Xg],Zz),Qz=t=>t.map(e=>e.data).filter(Boolean).flat(1),rre=Oe([Xg],t=>t.some(e=>!e.data)),Jz=Oe([Xg],Qz,{memoizeOptions:{resultEqualityCheck:TS}}),eB=(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)},O2=Oe([Jz,bS],eB),ire=(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})),tB=(t,e,n,r,i,s)=>{var o=r.chartData,a=o===void 0?[]:o,l=r.dataStartIndex,c=r.dataEndIndex,d=ire(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},rx=Oe([O2,Ps,Xg,bS,rre,Jz],tB);function eg(t){if(Il(t)||t instanceof Date){var e=Number(t);if(wn(e))return e}}function fL(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 sre(t,e){var n=eg(t),r=eg(e);return n==null&&r==null?0:n==null?-1:r==null?1:n-r}var ore=Oe([rx],t=>t==null?void 0:t.map(e=>e.value).sort(sre));function nB(t,e){switch(t){case"xAxis":return e.direction==="x";case"yAxis":return e.direction==="y";default:return!1}}function are(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=Vz(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=Wg(t);return nx(t,e,n)},Cg=Oe([ai],t=>t==null?void 0:t.dataKey),lre=Oe([Yz,bS,ai],oz),rB=(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=Vz(o,2),l=a[0],c=a[1],d=r?[...c].reverse():c,f=d.map(o2);return[l,{stackedData:AY(t,f,n),graphicalItems:d}]}))},iB=Oe([lre,Yz,_S,J4],rB),sB=(t,e,n,r)=>{var i=e.dataStartIndex,s=e.dataEndIndex;if(r==null&&n!=="zAxis")return RY(t,i,s)},cre=Oe([Ps],t=>t.allowDataOverflow),L2=t=>{var e;if(t==null||!("domain"in t))return TC;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:TC},oB=Oe([Ps],L2),aB=Oe([oB,cre],H4),ure=Oe([iB,Wa,bi,aB],sB,{memoizeOptions:{resultEqualityCheck:AS}}),D2=t=>t.errorBars,dre=(t,e,n)=>t.flatMap(r=>e[r.id]).filter(Boolean).filter(r=>nB(n,r)),Fw=function(){for(var e=arguments.length,n=new Array(e),r=0;r5&&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=>nB(s,y));f.forEach(y=>{var x,S=yi(y,(x=n.dataKey)!==null&&x!==void 0?x:c.dataKey),_=are(y,S,m);if(_.length>=2){var w=Math.min(..._),E=Math.max(..._);(a==null||wl)&&(l=E)}var T=fL(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=fL(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]},fre=Oe([O2,Ps,nre,D2,bi,HJ],lB,{memoizeOptions:{resultEqualityCheck:AS}});function hre(t){var e=t.value;if(Il(e)||e instanceof Date)return e}var pre=(t,e,n)=>{var r=t.map(hre).filter(i=>i!=null);return n&&(e.dataKey==null||e.allowDuplicatedCategory&&x5(r))?B4(0,t.length):e.allowDuplicatedCategory?r:Array.from(new Set(r))},cB=t=>t.referenceElements.dots,qg=(t,e,n)=>t.filter(r=>r.ifOverflow==="extendDomain").filter(r=>e==="xAxis"?r.xAxisId===n:r.yAxisId===n),mre=Oe([cB,bi,ES],qg),uB=t=>t.referenceElements.areas,gre=Oe([uB,bi,ES],qg),dB=t=>t.referenceElements.lines,vre=Oe([dB,bi,ES],qg),fB=(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)]}},yre=Oe(mre,bi,fB),hB=(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)]}},xre=Oe([gre,bi],hB);function bre(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 _re(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 pB=(t,e)=>{if(t!=null){var n=t.flatMap(r=>e==="xAxis"?bre(r):_re(r));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},wre=Oe([vre,bi],pB),Sre=Oe(yre,wre,xre,(t,e,n)=>Fw(t,n,e)),mB=(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?Fw(r,s,i):Fw(s,i);return qJ(e,c,t.allowDataOverflow)},Mre=Oe([Ps,oB,aB,ure,fre,Sre,fr,bi],mB,{memoizeOptions:{resultEqualityCheck:AS}}),Ere=[0,1],gB=(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 B4(0,(d=n==null?void 0:n.length)!==null&&d!==void 0?d:0)}return l==="category"?pre(r,t,c):i==="expand"&&!c?Ere:o}},j2=Oe([Ps,fr,O2,rx,_S,bi,Mre],gB),Kg=Oe([Ps,$z,e2],Bz),vB=(t,e,n)=>{var r=e.niceTicks;if(r!=="none"){var i=L2(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 _O(t,e.tickCount,e.allowDecimals,r);if(e.type==="number")return wO(t,e.tickCount,e.allowDecimals,r)}if(r==="auto"&&n==="linear"&&e!=null&&e.tickCount){if(s&&Al(t))return _O(t,e.tickCount,e.allowDecimals,"adaptive");if(e.type==="number"&&Al(t))return wO(t,e.tickCount,e.allowDecimals,"adaptive")}}},U2=Oe([j2,nx,Kg],vB),yB=(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},Are=Oe([Ps,j2,U2,bi],yB),Tre=Oe(rx,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;ai,(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}),Cre=(t,e,n)=>{var r=iu(t,e);return r==null||typeof r.padding!="string"?0:xB(t,"xAxis",e,n,r.padding)},Pre=(t,e,n)=>{var r=su(t,e);return r==null||typeof r.padding!="string"?0:xB(t,"yAxis",e,n,r.padding)},Rre=Oe(iu,Cre,(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}}),Nre=Oe(su,Pre,(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}}),bB=Oe([Gi,Rre,pS,hS,(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]}),_B=Oe([Gi,fr,Nre,pS,hS,(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]}),ix=(t,e,n,r)=>{var i;switch(e){case"xAxis":return bB(t,n,r);case"yAxis":return _B(t,n,r);case"zAxis":return(i=k2(t,n))===null||i===void 0?void 0:i.range;case"angleAxis":return rz(t);case"radiusAxis":return iz(t,n);default:return}},wB=Oe([Ps,ix],wS),Ire=Oe([Kg,Are],fee),F2=Oe([Ps,Kg,Ire,wB],I2),SB=(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)}},z2=Oe([fr,rx,nx,bi],SB),OS=Oe([F2],l2);Oe([F2],Wne);Oe([F2,ore],Hz);Oe([Xg,D2,bi],dre);function MB(t,e){return t.ide.id?1:0}var LS=(t,e)=>e,DS=(t,e,n)=>n,kre=Oe(dS,LS,DS,(t,e,n)=>t.filter(r=>r.orientation===e).filter(r=>r.mirror===n).sort(MB)),Ore=Oe(fS,LS,DS,(t,e,n)=>t.filter(r=>r.orientation===e).filter(r=>r.mirror===n).sort(MB)),EB=(t,e)=>({width:t.width,height:e.height}),Lre=(t,e)=>{var n=typeof e.width=="number"?e.width:X0;return{width:n,height:t.height}},Dre=Oe(Gi,iu,EB),jre=(t,e,n)=>{switch(e){case"top":return t.top;case"bottom":return n-t.bottom;default:return 0}},Ure=(t,e,n)=>{switch(e){case"left":return t.left;case"right":return n-t.right;default:return 0}},Fre=Oe(nu,Gi,kre,LS,DS,(t,e,n,r,i)=>{var s={},o;return n.forEach(a=>{var l=EB(e,a);o==null&&(o=jre(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}),zre=Oe(tu,Gi,Ore,LS,DS,(t,e,n,r,i)=>{var s={},o;return n.forEach(a=>{var l=Lre(e,a);o==null&&(o=Ure(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}),Bre=(t,e)=>{var n=iu(t,e);if(n!=null)return Fre(t,n.orientation,n.mirror)},Hre=Oe([Gi,iu,Bre,(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}}}),Vre=(t,e)=>{var n=su(t,e);if(n!=null)return zre(t,n.orientation,n.mirror)},Gre=Oe([Gi,su,Vre,(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}}}),Wre=Oe(Gi,su,(t,e)=>{var n=typeof e.width=="number"?e.width:X0;return{width:n,height:t.height}}),AB=(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&&x5(c))return l}},B2=Oe([fr,rx,Ps,bi],AB),hL=Oe([fr,ere,Kg,OS,B2,z2,ix,U2,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}}}),$re=(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 E=o?o.indexOf(_):_,T=r.map(E);return wn(T)?{index:w,coordinate:T+x,value:_,offset:x}:null}).filter(Ks):c&&a?a.map((_,w)=>{var E=r.map(_);return wn(E)?{coordinate:E+x,value:_,index:w,offset:x}:null}).filter(Ks):r.ticks?r.ticks(m).map((_,w)=>{var E=r.map(_);return wn(E)?{coordinate:E+x,value:_,index:w,offset:x}:null}).filter(Ks):r.domain().map((_,w)=>{var E=r.map(_);return wn(E)?{coordinate:E+x,value:o?o[_]:_,index:w,offset:x}:null}).filter(Ks)}},TB=Oe([fr,nx,Kg,OS,U2,ix,B2,z2,bi],$re),Xre=(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)}},CB=Oe([fr,nx,OS,ix,B2,z2,bi],Xre),PB=Oe(Ps,OS,(t,e)=>{if(!(t==null||e==null))return Uw(Uw({},t),{},{scale:e})}),qre=Oe([Ps,Kg,j2,wB],I2),Kre=Oe([qre],l2);Oe((t,e,n)=>k2(t,n),Kre,(t,e)=>{if(!(t==null||e==null))return Uw(Uw({},t),{},{scale:e})});var Yre=Oe([fr,dS,fS],(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}}),Zre=(t,e,n)=>{var r;return(r=t.renderedTicks[e])===null||r===void 0?void 0:r[n]};Oe([Zre],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);ot.options.defaultTooltipEventType,NB=t=>t.options.validateTooltipEventTypes;function IB(t,e,n){if(t==null)return e;var r=t?"axis":"item";return n==null?e:n.includes(r)?r:e}function sx(t,e){var n=RB(t),r=NB(t);return IB(e,n,r)}function Qre(t){return zt(e=>sx(e,t))}var kB=(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},Jre=t=>t.tooltip.settings,cd={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},eie={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}},OB=cs({name:"tooltip",initialState:eie,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=OB.actions,tie=ta.addTooltipEntrySettings,nie=ta.replaceTooltipEntrySettings,rie=ta.removeTooltipEntrySettings,iie=ta.setTooltipSettingsState,sie=ta.setActiveMouseOverItemIndex;ta.mouseLeaveItem;var LB=ta.mouseLeaveChart;ta.setActiveClickItemIndex;var DB=ta.setMouseOverAxisIndex,oie=ta.setMouseClickAxisIndex,jy=ta.setSyncInteraction,zw=ta.setKeyboardInteraction,aie=OB.reducer;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 Ib(t){for(var e=1;e{if(e==null)return cd;var i=die(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(fie(i)){if(s)return Ib(Ib({},i),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return Ib(Ib({},cd),{},{coordinate:i.coordinate})};function hie(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 pie(t,e){var n=hie(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 mie(t,e,n){if(n==null||e==null)return!0;var r=yi(t,e);return r==null||!Al(n)?!0:pie(r,n)}var Vy=(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||mie(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}}}},FB=(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})},zB=t=>t.options.tooltipPayloadSearcher,Yg=t=>t.tooltip;function mL(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 gL(t){for(var e=1;et(e)}function vL(t){if(typeof t=="string")return t}function wie(t){if(!(t==null||typeof t!="object")){var e="name"in t?xie(t.name):void 0,n="unit"in t?bie(t.unit):void 0,r="dataKey"in t?_ie(t.dataKey):void 0,i="payload"in t?t.payload:void 0,s="color"in t?vL(t.color):void 0,o="fill"in t?vL(t.fill):void 0;return{name:e,unit:n,dataKey:r,payload:i,color:s,fill:o}}}function Sie(t,e){return t??e}var BB=(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=Sie(S,a),E=Array.isArray(w)?f4(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(E)&&!Array.isArray(E[0])&&o==="axis"?O=b5(E,r,i):O=s(E,e,l,C),Array.isArray(O))O.forEach(L=>{var F,V,k=wie(L),U=k==null?void 0:k.name,H=k==null?void 0:k.dataKey,ne=k==null?void 0:k.payload,te=gL(gL({},_),{},{name:U,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(dk({tooltipEntrySettings:te,dataKey:H,payload:ne,value:yi(ne,H),name:U==null?void 0:String(U)}))});else{var N;m.push(dk({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)}},H2=Oe([ai,$z,e2],Bz),Mie=Oe([t=>t.graphicalItems.cartesianItems,t=>t.graphicalItems.polarItems],(t,e)=>[...t,...e]),Eie=Oe([_i,Wg],Xz),Qh=Oe([Mie,ai,Eie],Kz,{memoizeOptions:{resultEqualityCheck:TS}}),Aie=Oe([Qh],t=>t.filter(a2)),HB=Oe([Qh],Qz,{memoizeOptions:{resultEqualityCheck:TS}}),Tie=Oe([Qh],t=>t.some(e=>!e.data)),Lh=Oe([HB,Wa],eB),Cie=Oe([Aie,Wa,ai],oz),V2=Oe([Lh,ai,Qh,Wa,Tie,HB],tB),VB=Oe([ai],L2),Pie=Oe([ai],t=>t.allowDataOverflow),GB=Oe([VB,Pie],H4),Rie=Oe([Qh],t=>t.filter(a2)),Nie=Oe([Cie,Rie,_S,J4],rB),Iie=Oe([Nie,Wa,_i,GB],sB),kie=Oe([Qh],Zz),Oie=Oe([Lh,ai,kie,D2,_i,VJ],lB,{memoizeOptions:{resultEqualityCheck:AS}}),Lie=Oe([cB,_i,Wg],qg),Die=Oe([Lie,_i],fB),jie=Oe([uB,_i,Wg],qg),Uie=Oe([jie,_i],hB),Fie=Oe([dB,_i,Wg],qg),zie=Oe([Fie,_i],pB),Bie=Oe([Die,zie,Uie],Fw),Hie=Oe([ai,VB,GB,Iie,Oie,Bie,fr,_i],mB),Pg=Oe([ai,fr,Lh,V2,_S,_i,Hie],gB),Vie=Oe([Pg,ai,H2],vB),Gie=Oe([ai,Pg,Vie,_i],yB),WB=t=>{var e=_i(t),n=Wg(t),r=!1;return ix(t,e,n,r)},$B=Oe([ai,WB],wS),Wie=Oe([ai,H2,Gie,$B],I2),XB=Oe([Wie],l2),$ie=Oe([fr,V2,ai,_i],AB),Xie=Oe([fr,V2,ai,_i],SB),qie=(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,H2,XB,WB,$ie,Xie,_i],qie),G2=Oe([RB,NB,Jre],(t,e,n)=>IB(n.shared,t,e)),qB=t=>t.tooltip.settings.trigger,W2=t=>t.tooltip.settings.defaultIndex,ox=Oe([Yg,G2,qB,W2],jB),_0=Oe([ox,Lh,Cg,Pg],Vy),KB=Oe([ou,_0],kB),Kie=Oe([ox],t=>{if(t)return t.dataKey}),Yie=Oe([ox],t=>{if(t)return t.graphicalItemId}),YB=Oe([Yg,G2,qB,W2],FB),Zie=Oe([tu,nu,fr,Gi,ou,W2,YB],UB),Qie=Oe([ox,Zie],(t,e)=>t!=null&&t.coordinate?t.coordinate:e),Jie=Oe([ox],t=>{var e;return(e=t==null?void 0:t.active)!==null&&e!==void 0?e:!1}),ese=Oe([YB,_0,Wa,Cg,KB,zB,G2],BB),tse=Oe([ese],t=>{if(t!=null){var e=t.map(n=>n.payload).filter(n=>n!=null);return Array.from(new Set(e))}});function yL(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 xL(t){for(var e=1;ezt(ai),ose=()=>{var t=sse(),e=zt(ou),n=zt(XB);return gw(!t||!n?void 0:xL(xL({},t),{},{scale:n}),e)};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 cm(t){for(var e=1;e{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}},dse=(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 fse(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 ZB=(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;a0?(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 E=x+i[1]-i[0];w[0]=Math.min(E,(E+y)/2),w[1]=Math.max(E,(E+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),L=Math.max(y,S);if(t>(N+x)/2&&t<=(L+x)/2){var F;return(F=n[a])===null||F===void 0?void 0:F.index}}}else if(e)for(var V=0;V(k.coordinate+H.coordinate)/2||V>0&&V(k.coordinate+H.coordinate)/2&&t<=(k.coordinate+U.coordinate)/2)return k.index}}return-1},QB=()=>zt(e2),$2=(t,e)=>e,JB=(t,e,n)=>n,X2=(t,e,n,r)=>r,hse=Oe(ou,t=>eS(t,e=>e.coordinate)),q2=Oe([Yg,$2,JB,X2],jB),K2=Oe([q2,Lh,Cg,Pg],Vy),pse=(t,e,n)=>{if(e!=null){var r=Yg(t);return e==="axis"?n==="hover"?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n==="hover"?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},eH=Oe([Yg,$2,JB,X2],FB),Bw=Oe([tu,nu,fr,Gi,ou,X2,eH],UB),mse=Oe([q2,Bw],(t,e)=>{var n;return(n=t.coordinate)!==null&&n!==void 0?n:e}),tH=Oe([ou,K2],kB),gse=Oe([eH,K2,Wa,Cg,tH,zB,$2],BB),vse=Oe([q2,K2],(t,e)=>({isActive:t.active&&e!=null,activeIndex:e})),yse=(t,e,n,r,i,s,o)=>{if(!(!t||!n||!r||!i)&&fse(t,o)){var a=NY(t,e),l=ZB(a,s,i,n,r),c=use(e,i,l,t);return{activeIndex:String(l),activeCoordinate:c}}},xse=(t,e,n,r,i,s,o)=>{if(!(!t||!r||!i||!s||!n)){var a=OJ(t,n);if(a){var l=IY(a,e),c=ZB(l,o,s,r,i),d=dse(e,s,c,a);return{activeIndex:String(c),activeCoordinate:d}}}},bse=(t,e,n,r,i,s,o,a)=>{if(!(!t||!e||!r||!i||!s))return e==="horizontal"||e==="vertical"?yse(t,e,r,i,s,o,a):xse(t,e,n,r,i,s,o)},_se=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}}),wse=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:dee}});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 wL(t){for(var e=1;ewL(wL({},t),{},{[e]:{element:void 0,panoramaElement:void 0,consumers:0}}),Ase)},Cse=new Set(Object.values(Ms));function Pse(t){return Cse.has(t)}var nH=cs({name:"zIndex",initialState:Tse,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&&!Pse(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()}}}),jS=nH.actions,Rse=jS.registerZIndexPortal,UE=jS.unregisterZIndexPortal,Nse=jS.registerZIndexPortalElement,Ise=jS.unregisterZIndexPortalElement,kse=nH.reducer;function au(t){var e=t.zIndex,n=t.children,r=gZ(),i=r&&e!==void 0&&e!==0,s=Qs(),o=R.useRef(void 0),a=R.useRef(new Set),l=Wr(),c=zt(f=>_se(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(Rse({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?W1.createPortal(n,d):null}function CC(){return CC=Object.assign?Object.assign.bind():function(t){for(var e=1;eR.useContext(rH),FE={exports:{}},ML;function Bse(){return ML||(ML=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{if(e&&Array.isArray(t)){var n=Number.parseInt(e,10);if(!Nl(n))return t[n]}},Wse={chartName:"",tooltipPayloadSearcher:()=>{},eventEmitter:void 0,defaultTooltipEventType:"axis"},iH=cs({name:"options",initialState:Wse,reducers:{createEventEmitter:t=>{t.eventEmitter==null&&(t.eventEmitter=Symbol("rechartsEventEmitter"))}}}),$se=iH.reducer,Xse=iH.actions.createEventEmitter;function qse(t){return t.tooltip.syncInteraction}var Kse={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},sH=cs({name:"chartData",initialState:Kse,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)}}}),Y2=sH.actions,AL=Y2.setChartData,Yse=Y2.setDataStartEndIndexes;Y2.setComputedData;var Zse=sH.reducer,Qse=["x","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 um(t){for(var e=1;el.rootProps.className);R.useEffect(()=>{if(t==null)return Bg;var l=(c,d,f)=>{if(e!==f&&t===c){if(d.payload.active===!1){n(jy({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,_=noe(y,Qse),w=d.payload.sourceViewBox,E=w.x,T=w.y,C=w.width,O=w.height,N=um(um({},_),{},{x:o.x+(C?(x-E)/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 L;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);L=i[V]}else r==="value"&&(L=i.find(ce=>String(ce.value)===d.payload.label));var k=d.payload.coordinate;if(k==null||o==null){n(jy({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(L==null){n(jy({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:void 0}));return}var U=k.x,H=k.y,ne=Math.min(U,o.x+o.width),te=Math.min(H,o.y+o.height),pe={x:s==="horizontal"?L.coordinate:ne,y:s==="horizontal"?te:L.coordinate},oe=jy({active:d.payload.active,coordinate:pe,dataKey:d.payload.dataKey,index:String(L.index),label:d.payload.label,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:d.payload.graphicalItemId});n(oe)}}};return w0.on(PC,l),()=>{w0.off(PC,l)}},[a,n,e,t,r,i,s,o])}function soe(){var t=zt(t2),e=zt(n2),n=Wr();R.useEffect(()=>{if(t==null)return Bg;var r=(i,s,o)=>{e!==o&&t===i&&n(Yse(s))};return w0.on(EL,r),()=>{w0.off(EL,r)}},[n,e,t])}function ooe(){var t=Wr();R.useEffect(()=>{t(Xse())},[t]),ioe(),soe()}function aoe(t,e,n,r,i,s){var o=zt(x=>pse(x,t,e)),a=zt(Yie),l=zt(n2),c=zt(t2),d=zt(ez),f=zt(qse),m=(f==null?void 0:f.sourceViewBox)!=null,y=mS();R.useEffect(()=>{if(!m&&c!=null&&l!=null){var x=jy({active:s,coordinate:n,dataKey:o,index:i,label:typeof r=="number"?String(r):r,sourceViewBox:y,graphicalItemId:a});w0.emit(PC,c,x,l)}},[m,n,o,a,i,r,l,c,d,s,y])}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 PL(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n{var e=g0(t,2),n=e[0],r=e[1],i=n,s=r;return n>r&&(i=r,s=n),[i,s]},JP=(t,e,n)=>{if(t.lte(0))return new Tn(0);var r=q4(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()))},Z4=(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()))},nee=(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(q4(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;l4&&arguments[4]!==void 0?arguments[4]:0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:JP;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?Q4(e,n,r,i,s+1,o):(f0?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))})},_O=function(e){var n=g0(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=Y4([r,i]),d=g0(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 nee(f,s,o);var x=a==="snap125"?Z4:JP,S=Q4(f,m,l,o,0,x),_=S.step,w=S.tickMin,E=S.tickMax,T=K4(w,E.add(new Tn(.1).mul(_)),_);return r>i?T.reverse():T},wO=function(e,n){var r=g0(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=Y4([i,s]),c=g0(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"?Z4:JP,y=Math.max(n,2),x=m(new Tn(f).sub(d).div(y-1),o,0),S=[...K4(new Tn(d),new Tn(f),x),f];return o===!1&&(S=S.map(_=>Math.round(_))),i>s?S.reverse():S},ree=t=>t.rootProps.barCategoryGap,_S=t=>t.rootProps.stackOffset,J4=t=>t.rootProps.reverseStackOrder,e2=t=>t.options.chartName,t2=t=>t.rootProps.syncId,ez=t=>t.rootProps.syncMethod,n2=t=>t.options.eventEmitter,iee=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"},wS=(t,e)=>{if(!(!t||!e))return t!=null&&t.reversed?[e[1],e[0]]:e};function SS(t,e,n){if(n!=="auto")return n;if(t!=null)return Fl(t,e)?"category":"number"}function SO(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 Tw(t){for(var e=1;e{if(e!=null)return t.polarAxis.angleAxis[e]},r2=Oe([lee,M4],(t,e)=>{var n;if(t!=null)return t;var r=(n=SS(e,"angleAxis",MO.type))!==null&&n!==void 0?n:"category";return Tw(Tw({},MO),{},{type:r})}),cee=(t,e)=>t.polarAxis.radiusAxis[e],i2=Oe([cee,M4],(t,e)=>{var n;if(t!=null)return t;var r=(n=SS(e,"radiusAxis",EO.type))!==null&&n!==void 0?n:"category";return Tw(Tw({},EO),{},{type:r})}),MS=t=>t.polarOptions,s2=Oe([tu,nu,Gi],PJ),tz=Oe([MS,s2],(t,e)=>{if(t!=null)return Ad(t.innerRadius,e,0)}),nz=Oe([MS,s2],(t,e)=>{if(t!=null)return Ad(t.outerRadius,e,e*.8)}),uee=t=>{if(t==null)return[0,0];var e=t.startAngle,n=t.endAngle;return[e,n]},rz=Oe([MS],uee);Oe([r2,rz],wS);var iz=Oe([s2,tz,nz],(t,e,n)=>{if(!(t==null||e==null||n==null))return[e,n]});Oe([i2,iz],wS);var sz=Oe([fr,MS,tz,nz,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,ES=(t,e,n)=>n;function o2(t){return t==null?void 0:t.id}function oz(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=o2(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 a2(t){return"stackId"in t&&t.stackId!=null&&t.dataKey!=null}var AS=(t,e)=>t===e?!0:t==null||e==null?!1:t[0]===e[0]&&t[1]===e[1];function TS(t,e){return Array.isArray(t)&&Array.isArray(e)&&t.length===0&&e.length===0?!0:t===e}function dee(t,e){if(t.length===e.length){for(var n=0;n{var e=fr(t);return e==="horizontal"?"xAxis":e==="vertical"?"yAxis":e==="centric"?"angleAxis":"radiusAxis"},Wg=t=>t.tooltip.settings.axisId;function l2(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 fee=(t,e)=>{if(e!=null)switch(t){case"linear":{if(!Al(e)){for(var n,r,i=0;ir)&&(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:te?1:t>=e?0:NaN}function hee(t,e){return t==null||e==null?NaN:et?1:e>=t?0:NaN}function c2(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===hee?t:pee,n=t,r=t);function i(a,l,c=0,d=a.length){if(c>>1;n(a[f],l)<0?c=f+1:d=f}while(c>>1;n(a[f],l)<=0?c=f+1:d=f}while(cc&&r(a[f-1],l)>-r(a[f],l)?f-1:f}return{left:i,center:o,right:s}}function pee(){return 0}function az(t){return t===null?NaN:+t}function*mee(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const gee=c2(wd),Q0=gee.right;c2(az).center;class AO extends Map{constructor(e,n=xee){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(TO(this,e))}has(e){return super.has(TO(this,e))}set(e,n){return super.set(vee(this,e),n)}delete(e){return super.delete(yee(this,e))}}function TO({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function vee({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function yee({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function xee(t){return t!==null&&typeof t=="object"?t.valueOf():t}function bee(t=wd){if(t===wd)return lz;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 lz(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(te?1:0)}const _ee=Math.sqrt(50),wee=Math.sqrt(10),See=Math.sqrt(2);function Cw(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>=_ee?10:s>=wee?5:s>=See?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/ce&&--l,c=-c):(c=Math.pow(10,i)*o,a=Math.round(t/c),l=Math.round(e/c),a*ce&&--l),l0))return[];if(t===e)return[t];const r=e=i))return[];const a=s-i+1,l=new Array(a);if(r)if(o<0)for(let c=0;c=r)&&(n=r);return n}function PO(t,e){let n;for(const r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function cz(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?lz:bee(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));cz(t,e,y,x,i)}const s=t[e];let o=n,a=r;for(ly(t,n,e),i(t[r],s)>0&&ly(t,n,r);o0;)--a}i(t[n],s)===0?ly(t,n,a):(++a,ly(t,a,r)),a<=e&&(n=a+1),e<=a&&(r=a-1)}return t}function ly(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function Mee(t,e,n){if(t=Float64Array.from(mee(t)),!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return PO(t);if(e>=1)return CO(t);var r,i=(r-1)*e,s=Math.floor(i),o=CO(cz(t,s).subarray(0,s+1)),a=PO(t.subarray(s+1));return o+(a-o)*(i-s)}}function Eee(t,e,n=az){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 Aee(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>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Pb(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Pb(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=Pee.exec(t))?new Ys(e[1],e[2],e[3],1):(e=Ree.exec(t))?new Ys(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Nee.exec(t))?Pb(e[1],e[2],e[3],e[4]):(e=Iee.exec(t))?Pb(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=kee.exec(t))?DO(e[1],e[2]/100,e[3]/100,1):(e=Oee.exec(t))?DO(e[1],e[2]/100,e[3]/100,e[4]):RO.hasOwnProperty(t)?kO(RO[t]):t==="transparent"?new Ys(NaN,NaN,NaN,0):null}function kO(t){return new Ys(t>>16&255,t>>8&255,t&255,1)}function Pb(t,e,n,r){return r<=0&&(t=e=n=NaN),new Ys(t,e,n,r)}function jee(t){return t instanceof J0||(t=x0(t)),t?(t=t.rgb(),new Ys(t.r,t.g,t.b,t.opacity)):new Ys}function MC(t,e,n,r){return arguments.length===1?jee(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}f2(Ys,MC,dz(J0,{brighter(t){return t=t==null?Pw:Math.pow(Pw,t),new Ys(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?v0:Math.pow(v0,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),Rw(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:OO,formatHex:OO,formatHex8:Uee,formatRgb:LO,toString:LO}));function OO(){return`#${th(this.r)}${th(this.g)}${th(this.b)}`}function Uee(){return`#${th(this.r)}${th(this.g)}${th(this.b)}${th((isNaN(this.opacity)?1:this.opacity)*255)}`}function LO(){const t=Rw(this.opacity);return`${t===1?"rgb(":"rgba("}${wh(this.r)}, ${wh(this.g)}, ${wh(this.b)}${t===1?")":`, ${t})`}`}function Rw(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 DO(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 fz(t){if(t instanceof Fa)return new Fa(t.h,t.s,t.l,t.opacity);if(t instanceof J0||(t=x0(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+(n0&&l<1?0:o,new Fa(o,a,l,t.opacity)}function Fee(t,e,n,r){return arguments.length===1?fz(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}f2(Fa,Fee,dz(J0,{brighter(t){return t=t==null?Pw:Math.pow(Pw,t),new Fa(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?v0:Math.pow(v0,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(NE(t>=240?t-240:t+120,i,r),NE(t,i,r),NE(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Fa(jO(this.h),Rb(this.s),Rb(this.l),Rw(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=Rw(this.opacity);return`${t===1?"hsl(":"hsla("}${jO(this.h)}, ${Rb(this.s)*100}%, ${Rb(this.l)*100}%${t===1?")":`, ${t})`}`}}));function jO(t){return t=(t||0)%360,t<0?t+360:t}function Rb(t){return Math.max(0,Math.min(1,t||0))}function NE(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 h2=t=>()=>t;function zee(t,e){return function(n){return t+n*e}}function Bee(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 Hee(t){return(t=+t)==1?hz:function(e,n){return n-e?Bee(e,n,t):h2(isNaN(e)?n:e)}}function hz(t,e){var n=e-t;return n?zee(t,n):h2(isNaN(t)?e:t)}const UO=(function t(e){var n=Hee(e);function r(i,s){var o=n((i=MC(i)).r,(s=MC(s)).r),a=n(i.g,s.g),l=n(i.b,s.b),c=hz(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 Vee(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),i;return function(s){for(i=0;in&&(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:Nw(r,i)})),n=IE.lastIndex;return ne&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function ete(t,e,n){var r=t[0],i=t[1],s=e[0],o=e[1];return i2?tte:ete,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),Nw)))(m)))},f.domain=function(m){return arguments.length?(t=Array.from(m,Iw),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=p2,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 m2(){return CS()(Es,Es)}function nte(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function kw(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 Eg(t){return t=kw(Math.abs(t)),t?t[1]:NaN}function rte(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 ite(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var ste=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function b0(t){if(!(e=ste.exec(t)))throw new Error("invalid format: "+t);var e;return new g2({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]})}b0.prototype=g2.prototype;function g2(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+""}g2.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 ote(t){e:for(var e=t.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(i+1):t}var Ow;function ate(t,e){var n=kw(t,e);if(!n)return Ow=void 0,t.toPrecision(e);var r=n[0],i=n[1],s=i-(Ow=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")+kw(t,Math.max(0,e+s-1))[0]}function zO(t,e){var n=kw(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 BO={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:nte,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)=>zO(t*100,e),r:zO,s:ate,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function HO(t){return t}var VO=Array.prototype.map,GO=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function lte(t){var e=t.grouping===void 0||t.thousands===void 0?HO:rte(VO.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?HO:ite(VO.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=b0(f);var y=f.fill,x=f.align,S=f.sign,_=f.symbol,w=f.zero,E=f.width,T=f.comma,C=f.precision,O=f.trim,N=f.type;N==="n"?(T=!0,N="g"):BO[N]||(C===void 0&&(C=12),O=!0,N="g"),(w||y==="0"&&x==="=")&&(w=!0,y="0",x="=");var L=(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=BO[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 U(H){var ne=L,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=ote(H)),B&&+H==0&&S!=="+"&&(B=!1),ne=(B?S==="("?S:a:S==="-"||S==="("?"":S)+ne,te=(N==="s"&&!isNaN(H)&&Ow!==void 0?GO[8+Ow/3]:"")+te+(B&&S==="("?")":""),k){for(pe=-1,oe=H.length;++pece||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>1)+ne+H+te+q.slice(K);break;default:H=q+ne+H+te;break}return s(H)}return U.toString=function(){return f+""},U}function d(f,m){var y=Math.max(-8,Math.min(8,Math.floor(Eg(m)/3)))*3,x=Math.pow(10,-y),S=c((f=b0(f),f.type="f",f),{suffix:GO[8+y/3]});return function(_){return S(x*_)}}return{format:c,formatPrefix:d}}var Nb,v2,pz;cte({thousands:",",grouping:[3],currency:["$",""]});function cte(t){return Nb=lte(t),v2=Nb.format,pz=Nb.formatPrefix,Nb}function ute(t){return Math.max(0,-Eg(Math.abs(t)))}function dte(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Eg(e)/3)))*3-Eg(Math.abs(t)))}function fte(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Eg(e)-Eg(t))+1}function mz(t,e,n,r){var i=wC(t,e,n),s;switch(r=b0(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(s=dte(i,o))&&(r.precision=s),pz(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(s=fte(i,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=s-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(s=ute(i))&&(r.precision=s-(r.type==="%")*2);break}}return v2(r)}function Rd(t){var e=t.domain;return t.ticks=function(n){var r=e();return bC(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var i=e();return mz(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(a0;){if(c=_C(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 gz(){var t=m2();return t.copy=function(){return ex(t,gz())},ea.apply(t,arguments),Rd(t)}function vz(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,Iw),n):t.slice()},n.unknown=function(r){return arguments.length?(e=r,n):e},n.copy=function(){return vz(t).unknown(e)},t=arguments.length?Array.from(t,Iw):[0,1],Rd(n)}function yz(t,e){t=t.slice();var n=0,r=t.length-1,i=t[n],s=t[r],o;return sMath.pow(t,e)}function vte(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 XO(t){return(e,n)=>-t(-e,n)}function y2(t){const e=t(WO,$O),n=e.domain;let r=10,i,s;function o(){return i=vte(r),s=gte(r),n()[0]<0?(i=XO(i),s=XO(s),t(hte,pte)):t(WO,$O),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=d0){for(;m<=y;++m)for(x=1;xd)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),!(Sd)break;w.push(S)}w.length*2<_&&(w=bC(c,d,_))}else w=bC(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=b0(l)).precision==null&&(l.trim=!0),l=v2(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*rn(yz(n(),{floor:a=>s(Math.floor(i(a))),ceil:a=>s(Math.ceil(i(a)))})),e}function xz(){const t=y2(CS()).domain([1,10]);return t.copy=()=>ex(t,xz()).base(t.base()),ea.apply(t,arguments),t}function qO(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function KO(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function x2(t){var e=1,n=t(qO(e),KO(e));return n.constant=function(r){return arguments.length?t(qO(e=+r),KO(e)):e},Rd(n)}function bz(){var t=x2(CS());return t.copy=function(){return ex(t,bz()).constant(t.constant())},ea.apply(t,arguments)}function YO(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function yte(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function xte(t){return t<0?-t*t:t*t}function b2(t){var e=t(Es,Es),n=1;function r(){return n===1?t(Es,Es):n===.5?t(yte,xte):t(YO(n),YO(1/n))}return e.exponent=function(i){return arguments.length?(n=+i,r()):n},Rd(e)}function _2(){var t=b2(CS());return t.copy=function(){return ex(t,_2()).exponent(t.exponent())},ea.apply(t,arguments),t}function bte(){return _2.apply(null,arguments).exponent(.5)}function ZO(t){return Math.sign(t)*t*t}function _te(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function _z(){var t=m2(),e=[0,1],n=!1,r;function i(s){var o=_te(t(s));return isNaN(o)?r:n?Math.round(o):o}return i.invert=function(s){return t.invert(ZO(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,Iw)).map(ZO)),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 _z(t.domain(),e).round(n).clamp(t.clamp()).unknown(r)},ea.apply(i,arguments),Rd(i)}function wz(){var t=[],e=[],n=[],r;function i(){var o=0,a=Math.max(1,e.length);for(n=new Array(a-1);++o0?n[a-1]:t[0],a=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 Sz().domain([t,e]).range(i).unknown(s)},ea.apply(Rd(o),arguments)}function Mz(){var t=[.5],e=[0,1],n,r=1;function i(s){return s!=null&&s<=s?e[Q0(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 Mz().domain(t).range(e).unknown(n)},ea.apply(i,arguments)}const kE=new Date,OE=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(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),!(s0))return l;let c;do l.push(c=new Date(+s)),e(s,a),t(s);while(coi(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)=>(kE.setTime(+s),OE.setTime(+o),t(kE),t(OE),Math.floor(n(kE,OE))),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 Lw=oi(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Lw.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):Lw);Lw.range;const Uc=1e3,Xo=Uc*60,Fc=Xo*60,Yc=Fc*24,w2=Yc*7,QO=Yc*30,LE=Yc*365,nh=oi(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*Uc)},(t,e)=>(e-t)/Uc,t=>t.getUTCSeconds());nh.range;const S2=oi(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Uc)},(t,e)=>{t.setTime(+t+e*Xo)},(t,e)=>(e-t)/Xo,t=>t.getMinutes());S2.range;const M2=oi(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*Xo)},(t,e)=>(e-t)/Xo,t=>t.getUTCMinutes());M2.range;const E2=oi(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Uc-t.getMinutes()*Xo)},(t,e)=>{t.setTime(+t+e*Fc)},(t,e)=>(e-t)/Fc,t=>t.getHours());E2.range;const A2=oi(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*Fc)},(t,e)=>(e-t)/Fc,t=>t.getUTCHours());A2.range;const tx=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);tx.range;const PS=oi(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Yc,t=>t.getUTCDate()-1);PS.range;const Ez=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));Ez.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)/w2)}const RS=Yh(0),Dw=Yh(1),wte=Yh(2),Ste=Yh(3),Ag=Yh(4),Mte=Yh(5),Ete=Yh(6);RS.range;Dw.range;wte.range;Ste.range;Ag.range;Mte.range;Ete.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)/w2)}const NS=Zh(0),jw=Zh(1),Ate=Zh(2),Tte=Zh(3),Tg=Zh(4),Cte=Zh(5),Pte=Zh(6);NS.range;jw.range;Ate.range;Tte.range;Tg.range;Cte.range;Pte.range;const T2=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());T2.range;const C2=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());C2.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 Az(t,e,n,r,i,s){const o=[[nh,1,Uc],[nh,5,5*Uc],[nh,15,15*Uc],[nh,30,30*Uc],[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,w2],[e,1,QO],[e,3,3*QO],[t,1,LE]];function a(c,d,f){const m=d_).right(o,m);if(y===o.length)return t.every(wC(c/LE,d/LE,f));if(y===0)return Lw.every(Math.max(wC(c,d,f),1));const[x,S]=o[m/o[y-1][2]53)return null;"w"in ue||(ue.w=1),"Z"in ue?(Ge=jE(cy(ue.y,0,1)),je=Ge.getUTCDay(),Ge=je>4||je===0?jw.ceil(Ge):jw(Ge),Ge=PS.offset(Ge,(ue.V-1)*7),ue.y=Ge.getUTCFullYear(),ue.m=Ge.getUTCMonth(),ue.d=Ge.getUTCDate()+(ue.w+6)%7):(Ge=DE(cy(ue.y,0,1)),je=Ge.getDay(),Ge=je>4||je===0?Dw.ceil(Ge):Dw(Ge),Ge=tx.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),je="Z"in ue?jE(cy(ue.y,0,1)).getUTCDay():DE(cy(ue.y,0,1)).getDay(),ue.m=0,ue.d="W"in ue?(ue.w+6)%7+ue.W*7-(je+5)%7:ue.w+ue.U*7-(je+6)%7);return"Z"in ue?(ue.H+=ue.Z/100|0,ue.M+=ue.Z%100,jE(ue)):DE(ue)}}function F(Me,He,Xe,ue){for(var Q=0,Ge=He.length,je=Xe.length,We,Qe;Q=je)return-1;if(We=He.charCodeAt(Q++),We===37){if(We=He.charAt(Q++),Qe=O[We in JO?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 U(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=E.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=L(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=L(Me+="",!0);return He.toString=function(){return Me},He}}}var JO={"-":"",_:" ",0:"0"},wi=/^\s*\d+/,Lte=/^%/,Dte=/[\\^$*+?|[\]().{}]/g;function Un(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",s=i.length;return r+(s[e.toLowerCase(),n]))}function Ute(t,e,n){var r=wi.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function Fte(t,e,n){var r=wi.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function zte(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function Bte(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Hte(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function eL(t,e,n){var r=wi.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function tL(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 Vte(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 Gte(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 Wte(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 nL(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function $te(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 rL(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function Xte(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function qte(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Kte(t,e,n){var r=wi.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Yte(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 Zte(t,e,n){var r=Lte.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Qte(t,e,n){var r=wi.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Jte(t,e,n){var r=wi.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function iL(t,e){return Un(t.getDate(),e,2)}function ene(t,e){return Un(t.getHours(),e,2)}function tne(t,e){return Un(t.getHours()%12||12,e,2)}function nne(t,e){return Un(1+tx.count(Zc(t),t),e,3)}function Tz(t,e){return Un(t.getMilliseconds(),e,3)}function rne(t,e){return Tz(t,e)+"000"}function ine(t,e){return Un(t.getMonth()+1,e,2)}function sne(t,e){return Un(t.getMinutes(),e,2)}function one(t,e){return Un(t.getSeconds(),e,2)}function ane(t){var e=t.getDay();return e===0?7:e}function lne(t,e){return Un(RS.count(Zc(t)-1,t),e,2)}function Cz(t){var e=t.getDay();return e>=4||e===0?Ag(t):Ag.ceil(t)}function cne(t,e){return t=Cz(t),Un(Ag.count(Zc(t),t)+(Zc(t).getDay()===4),e,2)}function une(t){return t.getDay()}function dne(t,e){return Un(Dw.count(Zc(t)-1,t),e,2)}function fne(t,e){return Un(t.getFullYear()%100,e,2)}function hne(t,e){return t=Cz(t),Un(t.getFullYear()%100,e,2)}function pne(t,e){return Un(t.getFullYear()%1e4,e,4)}function mne(t,e){var n=t.getDay();return t=n>=4||n===0?Ag(t):Ag.ceil(t),Un(t.getFullYear()%1e4,e,4)}function gne(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Un(e/60|0,"0",2)+Un(e%60,"0",2)}function sL(t,e){return Un(t.getUTCDate(),e,2)}function vne(t,e){return Un(t.getUTCHours(),e,2)}function yne(t,e){return Un(t.getUTCHours()%12||12,e,2)}function xne(t,e){return Un(1+PS.count(Qc(t),t),e,3)}function Pz(t,e){return Un(t.getUTCMilliseconds(),e,3)}function bne(t,e){return Pz(t,e)+"000"}function _ne(t,e){return Un(t.getUTCMonth()+1,e,2)}function wne(t,e){return Un(t.getUTCMinutes(),e,2)}function Sne(t,e){return Un(t.getUTCSeconds(),e,2)}function Mne(t){var e=t.getUTCDay();return e===0?7:e}function Ene(t,e){return Un(NS.count(Qc(t)-1,t),e,2)}function Rz(t){var e=t.getUTCDay();return e>=4||e===0?Tg(t):Tg.ceil(t)}function Ane(t,e){return t=Rz(t),Un(Tg.count(Qc(t),t)+(Qc(t).getUTCDay()===4),e,2)}function Tne(t){return t.getUTCDay()}function Cne(t,e){return Un(jw.count(Qc(t)-1,t),e,2)}function Pne(t,e){return Un(t.getUTCFullYear()%100,e,2)}function Rne(t,e){return t=Rz(t),Un(t.getUTCFullYear()%100,e,2)}function Nne(t,e){return Un(t.getUTCFullYear()%1e4,e,4)}function Ine(t,e){var n=t.getUTCDay();return t=n>=4||n===0?Tg(t):Tg.ceil(t),Un(t.getUTCFullYear()%1e4,e,4)}function kne(){return"+0000"}function oL(){return"%"}function aL(t){return+t}function lL(t){return Math.floor(+t/1e3)}var lm,Nz,Iz;One({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 One(t){return lm=Ote(t),Nz=lm.format,lm.parse,Iz=lm.utcFormat,lm.utcParse,lm}function Lne(t){return new Date(t)}function Dne(t){return t instanceof Date?+t:+new Date(+t)}function P2(t,e,n,r,i,s,o,a,l,c){var d=m2(),f=d.invert,m=d.domain,y=c(".%L"),x=c(":%S"),S=c("%I:%M"),_=c("%I %p"),w=c("%a %d"),E=c("%b %d"),T=c("%B"),C=c("%Y");function O(N){return(l(N)e(i/(t.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(i,s)=>Mee(t,s/r))},n.copy=function(){return Dz(e).domain(t)},ru.apply(n,arguments)}function kS(){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{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 Vne(r)?r:"point"}};function Gne(t,e){for(var n=0,r=t.length,i=t[0]e)?n=s+1:r=s}return n}function Hz(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=Gne(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 Wne(t){if(t!=null)return"invert"in t&&typeof t.invert=="function"?t.invert.bind(t):Hz(t,void 0)}function uL(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;et.length)&&(e=t.length);for(var n=0,r=Array(e);nt.cartesianAxis.xAxis[e],iu=(t,e)=>{var n=Gz(t,e);return n??ti},ni={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:TC,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:X0},Wz=(t,e)=>t.cartesianAxis.yAxis[e],su=(t,e)=>{var n=Wz(t,e);return n??ni},Jne={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:""},k2=(t,e)=>{var n=t.cartesianAxis.zAxis[e];return n??Jne},Ps=(t,e,n)=>{switch(e){case"xAxis":return iu(t,n);case"yAxis":return su(t,n);case"zAxis":return k2(t,n);case"angleAxis":return r2(t,n);case"radiusAxis":return i2(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},ere=(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))}},nx=(t,e,n)=>{switch(e){case"xAxis":return iu(t,n);case"yAxis":return su(t,n);case"angleAxis":return r2(t,n);case"radiusAxis":return i2(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},$z=t=>t.graphicalItems.cartesianItems.some(e=>e.type==="bar")||t.graphicalItems.polarItems.some(e=>e.type==="radialBar");function Xz(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 qz=t=>t.graphicalItems.cartesianItems,tre=Oe([bi,ES],Xz),Kz=(t,e,n)=>t.filter(n).filter(r=>(e==null?void 0:e.includeHidden)===!0?!0:!r.hide),Xg=Oe([qz,Ps,tre],Kz,{memoizeOptions:{resultEqualityCheck:TS}}),Yz=Oe([Xg],t=>t.filter(e=>e.type==="area"||e.type==="bar").filter(a2)),Zz=t=>t.filter(e=>!("stackId"in e)||e.stackId===void 0),nre=Oe([Xg],Zz),Qz=t=>t.map(e=>e.data).filter(Boolean).flat(1),rre=Oe([Xg],t=>t.some(e=>!e.data)),Jz=Oe([Xg],Qz,{memoizeOptions:{resultEqualityCheck:TS}}),eB=(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)},O2=Oe([Jz,bS],eB),ire=(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})),tB=(t,e,n,r,i,s)=>{var o=r.chartData,a=o===void 0?[]:o,l=r.dataStartIndex,c=r.dataEndIndex,d=ire(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},rx=Oe([O2,Ps,Xg,bS,rre,Jz],tB);function eg(t){if(Il(t)||t instanceof Date){var e=Number(t);if(wn(e))return e}}function fL(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 sre(t,e){var n=eg(t),r=eg(e);return n==null&&r==null?0:n==null?-1:r==null?1:n-r}var ore=Oe([rx],t=>t==null?void 0:t.map(e=>e.value).sort(sre));function nB(t,e){switch(t){case"xAxis":return e.direction==="x";case"yAxis":return e.direction==="y";default:return!1}}function are(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=Vz(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=Wg(t);return nx(t,e,n)},Cg=Oe([ai],t=>t==null?void 0:t.dataKey),lre=Oe([Yz,bS,ai],oz),rB=(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=Vz(o,2),l=a[0],c=a[1],d=r?[...c].reverse():c,f=d.map(o2);return[l,{stackedData:AY(t,f,n),graphicalItems:d}]}))},iB=Oe([lre,Yz,_S,J4],rB),sB=(t,e,n,r)=>{var i=e.dataStartIndex,s=e.dataEndIndex;if(r==null&&n!=="zAxis")return RY(t,i,s)},cre=Oe([Ps],t=>t.allowDataOverflow),L2=t=>{var e;if(t==null||!("domain"in t))return TC;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:TC},oB=Oe([Ps],L2),aB=Oe([oB,cre],H4),ure=Oe([iB,$a,bi,aB],sB,{memoizeOptions:{resultEqualityCheck:AS}}),D2=t=>t.errorBars,dre=(t,e,n)=>t.flatMap(r=>e[r.id]).filter(Boolean).filter(r=>nB(n,r)),Fw=function(){for(var e=arguments.length,n=new Array(e),r=0;r5&&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=>nB(s,y));f.forEach(y=>{var x,S=yi(y,(x=n.dataKey)!==null&&x!==void 0?x:c.dataKey),_=are(y,S,m);if(_.length>=2){var w=Math.min(..._),E=Math.max(..._);(a==null||wl)&&(l=E)}var T=fL(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=fL(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]},fre=Oe([O2,Ps,nre,D2,bi,HJ],lB,{memoizeOptions:{resultEqualityCheck:AS}});function hre(t){var e=t.value;if(Il(e)||e instanceof Date)return e}var pre=(t,e,n)=>{var r=t.map(hre).filter(i=>i!=null);return n&&(e.dataKey==null||e.allowDuplicatedCategory&&x5(r))?B4(0,t.length):e.allowDuplicatedCategory?r:Array.from(new Set(r))},cB=t=>t.referenceElements.dots,qg=(t,e,n)=>t.filter(r=>r.ifOverflow==="extendDomain").filter(r=>e==="xAxis"?r.xAxisId===n:r.yAxisId===n),mre=Oe([cB,bi,ES],qg),uB=t=>t.referenceElements.areas,gre=Oe([uB,bi,ES],qg),dB=t=>t.referenceElements.lines,vre=Oe([dB,bi,ES],qg),fB=(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)]}},yre=Oe(mre,bi,fB),hB=(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)]}},xre=Oe([gre,bi],hB);function bre(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 _re(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 pB=(t,e)=>{if(t!=null){var n=t.flatMap(r=>e==="xAxis"?bre(r):_re(r));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},wre=Oe([vre,bi],pB),Sre=Oe(yre,wre,xre,(t,e,n)=>Fw(t,n,e)),mB=(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?Fw(r,s,i):Fw(s,i);return qJ(e,c,t.allowDataOverflow)},Mre=Oe([Ps,oB,aB,ure,fre,Sre,fr,bi],mB,{memoizeOptions:{resultEqualityCheck:AS}}),Ere=[0,1],gB=(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 B4(0,(d=n==null?void 0:n.length)!==null&&d!==void 0?d:0)}return l==="category"?pre(r,t,c):i==="expand"&&!c?Ere:o}},j2=Oe([Ps,fr,O2,rx,_S,bi,Mre],gB),Kg=Oe([Ps,$z,e2],Bz),vB=(t,e,n)=>{var r=e.niceTicks;if(r!=="none"){var i=L2(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 _O(t,e.tickCount,e.allowDecimals,r);if(e.type==="number")return wO(t,e.tickCount,e.allowDecimals,r)}if(r==="auto"&&n==="linear"&&e!=null&&e.tickCount){if(s&&Al(t))return _O(t,e.tickCount,e.allowDecimals,"adaptive");if(e.type==="number"&&Al(t))return wO(t,e.tickCount,e.allowDecimals,"adaptive")}}},U2=Oe([j2,nx,Kg],vB),yB=(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},Are=Oe([Ps,j2,U2,bi],yB),Tre=Oe(rx,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;ai,(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}),Cre=(t,e,n)=>{var r=iu(t,e);return r==null||typeof r.padding!="string"?0:xB(t,"xAxis",e,n,r.padding)},Pre=(t,e,n)=>{var r=su(t,e);return r==null||typeof r.padding!="string"?0:xB(t,"yAxis",e,n,r.padding)},Rre=Oe(iu,Cre,(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}}),Nre=Oe(su,Pre,(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}}),bB=Oe([Gi,Rre,pS,hS,(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]}),_B=Oe([Gi,fr,Nre,pS,hS,(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]}),ix=(t,e,n,r)=>{var i;switch(e){case"xAxis":return bB(t,n,r);case"yAxis":return _B(t,n,r);case"zAxis":return(i=k2(t,n))===null||i===void 0?void 0:i.range;case"angleAxis":return rz(t);case"radiusAxis":return iz(t,n);default:return}},wB=Oe([Ps,ix],wS),Ire=Oe([Kg,Are],fee),F2=Oe([Ps,Kg,Ire,wB],I2),SB=(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)}},z2=Oe([fr,rx,nx,bi],SB),OS=Oe([F2],l2);Oe([F2],Wne);Oe([F2,ore],Hz);Oe([Xg,D2,bi],dre);function MB(t,e){return t.ide.id?1:0}var LS=(t,e)=>e,DS=(t,e,n)=>n,kre=Oe(dS,LS,DS,(t,e,n)=>t.filter(r=>r.orientation===e).filter(r=>r.mirror===n).sort(MB)),Ore=Oe(fS,LS,DS,(t,e,n)=>t.filter(r=>r.orientation===e).filter(r=>r.mirror===n).sort(MB)),EB=(t,e)=>({width:t.width,height:e.height}),Lre=(t,e)=>{var n=typeof e.width=="number"?e.width:X0;return{width:n,height:t.height}},Dre=Oe(Gi,iu,EB),jre=(t,e,n)=>{switch(e){case"top":return t.top;case"bottom":return n-t.bottom;default:return 0}},Ure=(t,e,n)=>{switch(e){case"left":return t.left;case"right":return n-t.right;default:return 0}},Fre=Oe(nu,Gi,kre,LS,DS,(t,e,n,r,i)=>{var s={},o;return n.forEach(a=>{var l=EB(e,a);o==null&&(o=jre(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}),zre=Oe(tu,Gi,Ore,LS,DS,(t,e,n,r,i)=>{var s={},o;return n.forEach(a=>{var l=Lre(e,a);o==null&&(o=Ure(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}),Bre=(t,e)=>{var n=iu(t,e);if(n!=null)return Fre(t,n.orientation,n.mirror)},Hre=Oe([Gi,iu,Bre,(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}}}),Vre=(t,e)=>{var n=su(t,e);if(n!=null)return zre(t,n.orientation,n.mirror)},Gre=Oe([Gi,su,Vre,(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}}}),Wre=Oe(Gi,su,(t,e)=>{var n=typeof e.width=="number"?e.width:X0;return{width:n,height:t.height}}),AB=(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&&x5(c))return l}},B2=Oe([fr,rx,Ps,bi],AB),hL=Oe([fr,ere,Kg,OS,B2,z2,ix,U2,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}}}),$re=(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 E=o?o.indexOf(_):_,T=r.map(E);return wn(T)?{index:w,coordinate:T+x,value:_,offset:x}:null}).filter(Ks):c&&a?a.map((_,w)=>{var E=r.map(_);return wn(E)?{coordinate:E+x,value:_,index:w,offset:x}:null}).filter(Ks):r.ticks?r.ticks(m).map((_,w)=>{var E=r.map(_);return wn(E)?{coordinate:E+x,value:_,index:w,offset:x}:null}).filter(Ks):r.domain().map((_,w)=>{var E=r.map(_);return wn(E)?{coordinate:E+x,value:o?o[_]:_,index:w,offset:x}:null}).filter(Ks)}},TB=Oe([fr,nx,Kg,OS,U2,ix,B2,z2,bi],$re),Xre=(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)}},CB=Oe([fr,nx,OS,ix,B2,z2,bi],Xre),PB=Oe(Ps,OS,(t,e)=>{if(!(t==null||e==null))return Uw(Uw({},t),{},{scale:e})}),qre=Oe([Ps,Kg,j2,wB],I2),Kre=Oe([qre],l2);Oe((t,e,n)=>k2(t,n),Kre,(t,e)=>{if(!(t==null||e==null))return Uw(Uw({},t),{},{scale:e})});var Yre=Oe([fr,dS,fS],(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}}),Zre=(t,e,n)=>{var r;return(r=t.renderedTicks[e])===null||r===void 0?void 0:r[n]};Oe([Zre],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);ot.options.defaultTooltipEventType,NB=t=>t.options.validateTooltipEventTypes;function IB(t,e,n){if(t==null)return e;var r=t?"axis":"item";return n==null?e:n.includes(r)?r:e}function sx(t,e){var n=RB(t),r=NB(t);return IB(e,n,r)}function Qre(t){return zt(e=>sx(e,t))}var kB=(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},Jre=t=>t.tooltip.settings,cd={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},eie={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}},OB=cs({name:"tooltip",initialState:eie,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=OB.actions,tie=ta.addTooltipEntrySettings,nie=ta.replaceTooltipEntrySettings,rie=ta.removeTooltipEntrySettings,iie=ta.setTooltipSettingsState,sie=ta.setActiveMouseOverItemIndex;ta.mouseLeaveItem;var LB=ta.mouseLeaveChart;ta.setActiveClickItemIndex;var DB=ta.setMouseOverAxisIndex,oie=ta.setMouseClickAxisIndex,jy=ta.setSyncInteraction,zw=ta.setKeyboardInteraction,aie=OB.reducer;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 Ib(t){for(var e=1;e{if(e==null)return cd;var i=die(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(fie(i)){if(s)return Ib(Ib({},i),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return Ib(Ib({},cd),{},{coordinate:i.coordinate})};function hie(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 pie(t,e){var n=hie(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 mie(t,e,n){if(n==null||e==null)return!0;var r=yi(t,e);return r==null||!Al(n)?!0:pie(r,n)}var Vy=(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||mie(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}}}},FB=(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})},zB=t=>t.options.tooltipPayloadSearcher,Yg=t=>t.tooltip;function mL(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 gL(t){for(var e=1;et(e)}function vL(t){if(typeof t=="string")return t}function wie(t){if(!(t==null||typeof t!="object")){var e="name"in t?xie(t.name):void 0,n="unit"in t?bie(t.unit):void 0,r="dataKey"in t?_ie(t.dataKey):void 0,i="payload"in t?t.payload:void 0,s="color"in t?vL(t.color):void 0,o="fill"in t?vL(t.fill):void 0;return{name:e,unit:n,dataKey:r,payload:i,color:s,fill:o}}}function Sie(t,e){return t??e}var BB=(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=Sie(S,a),E=Array.isArray(w)?f4(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(E)&&!Array.isArray(E[0])&&o==="axis"?O=b5(E,r,i):O=s(E,e,l,C),Array.isArray(O))O.forEach(L=>{var F,V,k=wie(L),U=k==null?void 0:k.name,H=k==null?void 0:k.dataKey,ne=k==null?void 0:k.payload,te=gL(gL({},_),{},{name:U,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(dk({tooltipEntrySettings:te,dataKey:H,payload:ne,value:yi(ne,H),name:U==null?void 0:String(U)}))});else{var N;m.push(dk({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)}},H2=Oe([ai,$z,e2],Bz),Mie=Oe([t=>t.graphicalItems.cartesianItems,t=>t.graphicalItems.polarItems],(t,e)=>[...t,...e]),Eie=Oe([_i,Wg],Xz),Qh=Oe([Mie,ai,Eie],Kz,{memoizeOptions:{resultEqualityCheck:TS}}),Aie=Oe([Qh],t=>t.filter(a2)),HB=Oe([Qh],Qz,{memoizeOptions:{resultEqualityCheck:TS}}),Tie=Oe([Qh],t=>t.some(e=>!e.data)),Lh=Oe([HB,$a],eB),Cie=Oe([Aie,$a,ai],oz),V2=Oe([Lh,ai,Qh,$a,Tie,HB],tB),VB=Oe([ai],L2),Pie=Oe([ai],t=>t.allowDataOverflow),GB=Oe([VB,Pie],H4),Rie=Oe([Qh],t=>t.filter(a2)),Nie=Oe([Cie,Rie,_S,J4],rB),Iie=Oe([Nie,$a,_i,GB],sB),kie=Oe([Qh],Zz),Oie=Oe([Lh,ai,kie,D2,_i,VJ],lB,{memoizeOptions:{resultEqualityCheck:AS}}),Lie=Oe([cB,_i,Wg],qg),Die=Oe([Lie,_i],fB),jie=Oe([uB,_i,Wg],qg),Uie=Oe([jie,_i],hB),Fie=Oe([dB,_i,Wg],qg),zie=Oe([Fie,_i],pB),Bie=Oe([Die,zie,Uie],Fw),Hie=Oe([ai,VB,GB,Iie,Oie,Bie,fr,_i],mB),Pg=Oe([ai,fr,Lh,V2,_S,_i,Hie],gB),Vie=Oe([Pg,ai,H2],vB),Gie=Oe([ai,Pg,Vie,_i],yB),WB=t=>{var e=_i(t),n=Wg(t),r=!1;return ix(t,e,n,r)},$B=Oe([ai,WB],wS),Wie=Oe([ai,H2,Gie,$B],I2),XB=Oe([Wie],l2),$ie=Oe([fr,V2,ai,_i],AB),Xie=Oe([fr,V2,ai,_i],SB),qie=(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,H2,XB,WB,$ie,Xie,_i],qie),G2=Oe([RB,NB,Jre],(t,e,n)=>IB(n.shared,t,e)),qB=t=>t.tooltip.settings.trigger,W2=t=>t.tooltip.settings.defaultIndex,ox=Oe([Yg,G2,qB,W2],jB),_0=Oe([ox,Lh,Cg,Pg],Vy),KB=Oe([ou,_0],kB),Kie=Oe([ox],t=>{if(t)return t.dataKey}),Yie=Oe([ox],t=>{if(t)return t.graphicalItemId}),YB=Oe([Yg,G2,qB,W2],FB),Zie=Oe([tu,nu,fr,Gi,ou,W2,YB],UB),Qie=Oe([ox,Zie],(t,e)=>t!=null&&t.coordinate?t.coordinate:e),Jie=Oe([ox],t=>{var e;return(e=t==null?void 0:t.active)!==null&&e!==void 0?e:!1}),ese=Oe([YB,_0,$a,Cg,KB,zB,G2],BB),tse=Oe([ese],t=>{if(t!=null){var e=t.map(n=>n.payload).filter(n=>n!=null);return Array.from(new Set(e))}});function yL(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 xL(t){for(var e=1;ezt(ai),ose=()=>{var t=sse(),e=zt(ou),n=zt(XB);return gw(!t||!n?void 0:xL(xL({},t),{},{scale:n}),e)};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 cm(t){for(var e=1;e{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}},dse=(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 fse(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 ZB=(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;a0?(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 E=x+i[1]-i[0];w[0]=Math.min(E,(E+y)/2),w[1]=Math.max(E,(E+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),L=Math.max(y,S);if(t>(N+x)/2&&t<=(L+x)/2){var F;return(F=n[a])===null||F===void 0?void 0:F.index}}}else if(e)for(var V=0;V(k.coordinate+H.coordinate)/2||V>0&&V(k.coordinate+H.coordinate)/2&&t<=(k.coordinate+U.coordinate)/2)return k.index}}return-1},QB=()=>zt(e2),$2=(t,e)=>e,JB=(t,e,n)=>n,X2=(t,e,n,r)=>r,hse=Oe(ou,t=>eS(t,e=>e.coordinate)),q2=Oe([Yg,$2,JB,X2],jB),K2=Oe([q2,Lh,Cg,Pg],Vy),pse=(t,e,n)=>{if(e!=null){var r=Yg(t);return e==="axis"?n==="hover"?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n==="hover"?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},eH=Oe([Yg,$2,JB,X2],FB),Bw=Oe([tu,nu,fr,Gi,ou,X2,eH],UB),mse=Oe([q2,Bw],(t,e)=>{var n;return(n=t.coordinate)!==null&&n!==void 0?n:e}),tH=Oe([ou,K2],kB),gse=Oe([eH,K2,$a,Cg,tH,zB,$2],BB),vse=Oe([q2,K2],(t,e)=>({isActive:t.active&&e!=null,activeIndex:e})),yse=(t,e,n,r,i,s,o)=>{if(!(!t||!n||!r||!i)&&fse(t,o)){var a=NY(t,e),l=ZB(a,s,i,n,r),c=use(e,i,l,t);return{activeIndex:String(l),activeCoordinate:c}}},xse=(t,e,n,r,i,s,o)=>{if(!(!t||!r||!i||!s||!n)){var a=OJ(t,n);if(a){var l=IY(a,e),c=ZB(l,o,s,r,i),d=dse(e,s,c,a);return{activeIndex:String(c),activeCoordinate:d}}}},bse=(t,e,n,r,i,s,o,a)=>{if(!(!t||!e||!r||!i||!s))return e==="horizontal"||e==="vertical"?yse(t,e,r,i,s,o,a):xse(t,e,n,r,i,s,o)},_se=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}}),wse=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:dee}});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 wL(t){for(var e=1;ewL(wL({},t),{},{[e]:{element:void 0,panoramaElement:void 0,consumers:0}}),Ase)},Cse=new Set(Object.values(Ms));function Pse(t){return Cse.has(t)}var nH=cs({name:"zIndex",initialState:Tse,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&&!Pse(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()}}}),jS=nH.actions,Rse=jS.registerZIndexPortal,UE=jS.unregisterZIndexPortal,Nse=jS.registerZIndexPortalElement,Ise=jS.unregisterZIndexPortalElement,kse=nH.reducer;function au(t){var e=t.zIndex,n=t.children,r=gZ(),i=r&&e!==void 0&&e!==0,s=Qs(),o=R.useRef(void 0),a=R.useRef(new Set),l=Wr(),c=zt(f=>_se(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(Rse({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?W1.createPortal(n,d):null}function CC(){return CC=Object.assign?Object.assign.bind():function(t){for(var e=1;eR.useContext(rH),FE={exports:{}},ML;function Bse(){return ML||(ML=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{if(e&&Array.isArray(t)){var n=Number.parseInt(e,10);if(!Nl(n))return t[n]}},Wse={chartName:"",tooltipPayloadSearcher:()=>{},eventEmitter:void 0,defaultTooltipEventType:"axis"},iH=cs({name:"options",initialState:Wse,reducers:{createEventEmitter:t=>{t.eventEmitter==null&&(t.eventEmitter=Symbol("rechartsEventEmitter"))}}}),$se=iH.reducer,Xse=iH.actions.createEventEmitter;function qse(t){return t.tooltip.syncInteraction}var Kse={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},sH=cs({name:"chartData",initialState:Kse,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)}}}),Y2=sH.actions,AL=Y2.setChartData,Yse=Y2.setDataStartEndIndexes;Y2.setComputedData;var Zse=sH.reducer,Qse=["x","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 um(t){for(var e=1;el.rootProps.className);R.useEffect(()=>{if(t==null)return Bg;var l=(c,d,f)=>{if(e!==f&&t===c){if(d.payload.active===!1){n(jy({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,_=noe(y,Qse),w=d.payload.sourceViewBox,E=w.x,T=w.y,C=w.width,O=w.height,N=um(um({},_),{},{x:o.x+(C?(x-E)/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 L;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);L=i[V]}else r==="value"&&(L=i.find(ce=>String(ce.value)===d.payload.label));var k=d.payload.coordinate;if(k==null||o==null){n(jy({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(L==null){n(jy({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:void 0}));return}var U=k.x,H=k.y,ne=Math.min(U,o.x+o.width),te=Math.min(H,o.y+o.height),pe={x:s==="horizontal"?L.coordinate:ne,y:s==="horizontal"?te:L.coordinate},oe=jy({active:d.payload.active,coordinate:pe,dataKey:d.payload.dataKey,index:String(L.index),label:d.payload.label,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:d.payload.graphicalItemId});n(oe)}}};return w0.on(PC,l),()=>{w0.off(PC,l)}},[a,n,e,t,r,i,s,o])}function soe(){var t=zt(t2),e=zt(n2),n=Wr();R.useEffect(()=>{if(t==null)return Bg;var r=(i,s,o)=>{e!==o&&t===i&&n(Yse(s))};return w0.on(EL,r),()=>{w0.off(EL,r)}},[n,e,t])}function ooe(){var t=Wr();R.useEffect(()=>{t(Xse())},[t]),ioe(),soe()}function aoe(t,e,n,r,i,s){var o=zt(x=>pse(x,t,e)),a=zt(Yie),l=zt(n2),c=zt(t2),d=zt(ez),f=zt(qse),m=(f==null?void 0:f.sourceViewBox)!=null,y=mS();R.useEffect(()=>{if(!m&&c!=null&&l!=null){var x=jy({active:s,coordinate:n,dataKey:o,index:i,label:typeof r=="number"?String(r):r,sourceViewBox:y,graphicalItemId:a});w0.emit(PC,c,x,l)}},[m,n,o,a,i,r,l,c,d,s,y])}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 PL(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n{L(iie({shared:E,trigger:T,axisId:N,active:i,defaultIndex:F}))},[L,E,T,N,i,F]);var V=mS(),k=k4(),U=Qre(E),H=(e=zt(Xe=>vse(Xe,U,T,F)))!==null&&e!==void 0?e:{},ne=H.activeIndex,te=H.isActive,pe=zt(Xe=>gse(Xe,U,T,F)),oe=zt(Xe=>tH(Xe,U,T,F)),ce=zt(Xe=>mse(Xe,U,T,F)),B=pe,K=zse(),q=(n=i??te)!==null&&n!==void 0?n:!1,$=vK([B,q]),Z=doe($,2),ge=Z[0],ae=Z[1],fe=U==="axis"?oe:void 0;aoe(U,T,ce,fe,ne,q);var _e=O??K;if(_e==null||V==null||U==null)return null;var Se=B??NL;q||(Se=NL),c&&Se.length&&(Se=zq(Se.filter(Xe=>Xe.value!=null&&(Xe.hide!==!0||r.includeHidden)),m,goe));var $e=Se.length>0,Me=PL(PL({},r),{},{payload:Se,label:fe,active:q,activeIndex:ne,coordinate:ce,accessibilityLayer:k}),He=R.createElement(CQ,{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},voe(l,Me));return R.createElement(R.Fragment,null,W1.createPortal(He,_e),q&&R.createElement(Fse,{cursor:w,tooltipEventType:U,coordinate:ce,payload:Se,index:ne}))}function boe(t,e,n){return(e=_oe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _oe(t){var e=woe(t,"string");return typeof e=="symbol"?e:e+""}function woe(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 Soe{constructor(e){boe(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 IL(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 Moe(t){for(var e=1;e{try{var n=document.getElementById(OL);n||(n=document.createElement("span"),n.setAttribute("id",OL),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,Poe,e),n.textContent="".concat(t);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},Gy=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||Z0.isSsr)return{width:0,height:0};if(!oH.enableCache)return LL(e,n);var r=Roe(e,n),i=kL.get(r);if(i)return i;var s=LL(e,n);return kL.set(r,s),s},aH;function Hw(t,e){return Ooe(t)||koe(t,e)||Ioe(t,e)||Noe()}function Noe(){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 Ioe(t,e){if(t){if(typeof t=="string")return DL(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)?DL(t,e):void 0}}function DL(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);nt.length)&&(e=t.length);for(var n=0,r=Array(e);n{var e=t.children,n=t.breakAll,r=t.style;try{var i=[];Hi(e)||(n?i=e.toString().split(""):i=e.toString().split(cH));var s=i.map(a=>({word:a,width:Gy(a,r).width})),o=n?0:Gy(" ",r).width;return{wordsWithComputedWidth:s,spaceWidth:o}}catch{return null}};function dH(t){return t==="start"||t==="middle"||t==="end"||t==="inherit"}function eae(t){return Hi(t)||typeof t=="string"||typeof t=="number"||typeof t=="boolean"}var fH=(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+nt.reduce((e,n)=>e.width>n.width?e:n),tae="…",VL=(t,e,n,r,i,s,o,a)=>{var l=t.slice(0,e),c=uH({breakAll:n,style:r,children:l+tae});if(!c)return[!1,[]];var d=fH(c.wordsWithComputedWidth,s,o,a),f=d.length>i||hH(d).width>Number(s);return[f,d]},nae=(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=fH(e,r,n,i);if(!c||i)return f;var m=f.length>s||hH(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),E=w-1,T=VL(d,E,l,a,s,r,n,i),C=BL(T,2),O=C[0],N=C[1],L=VL(d,w,l,a,s,r,n,i),F=BL(L,1),V=F[0];if(!O&&!V&&(y=w+1),O&&V&&(x=w-1),!O&&V){_=N;break}S++}return _||f},GL=t=>{var e=Hi(t)?[]:t.toString().split(cH);return[{words:e,width:void 0}]},rae=t=>{var e=t.width,n=t.scaleToFit,r=t.children,i=t.style,s=t.breakAll,o=t.maxLines;if((e||n)&&!Z0.isSsr){var a,l,c=uH({breakAll:s,children:r,style:i});if(c){var d=c.wordsWithComputedWidth,f=c.spaceWidth;a=d,l=f}else return GL(r);return nae({breakAll:s,children:r,maxLines:o,style:i},a,l,e,!!n)}return GL(r)},pH="#808080",iae={angle:0,breakAll:!1,capHeight:"0.71em",fill:pH,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},Z2=R.forwardRef((t,e)=>{var n=Jo(t,iae),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=zL(n,Xoe),m=R.useMemo(()=>rae({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,E=zL(f,qoe);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=zE("calc(".concat(o,")"));break;case"middle":O=zE("calc(".concat((m.length-1)/2," * -").concat(s," + (").concat(o," / 2))"));break;default:O=zE("calc(".concat(m.length-1," * -").concat(s,")"));break}var N=[],L=m[0];if(l&&L!=null){var F=L.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&&(E.transform=N.join(" ")),R.createElement("text",RC({},Ko(E),{ref:e,x:T,y:C,className:er("recharts-text",_),textAnchor:c,fill:a.includes("url")?pH:a}),m.map((k,U)=>{var H=k.words.join(w?"":" ");return R.createElement("tspan",{x:T,dy:U===0?O:s,key:"".concat(H,"-").concat(U)},H)}))});Z2.displayName="Text";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 hl(t){for(var e=1;e{var e=t.viewBox,n=t.position,r=t.offset,i=r===void 0?0:r,s=t.parentViewBox,o=WP(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,E=w*i,T=w>0?"end":"start",C=w>0?"start":"end",O=d>=0?1:-1,N=O*i,L=O>0?"end":"start",F=O>0?"start":"end",V=s;if(n==="top"){var k={x:m+d/2,y:l-E,horizontalAnchor:"middle",verticalAnchor:T};return V&&(k.height=Math.max(l-V.y,0),k.width=d),k}if(n==="bottom"){var U={x:y+f/2,y:l+c+E,horizontalAnchor:"middle",verticalAnchor:C};return V&&(U.height=Math.max(V.y+V.height-(l+c),0),U.width=f),U}if(n==="left"){var H={x:x-N,y:l+c/2,horizontalAnchor:L,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"?hl({x:x+N,y:l+c/2,horizontalAnchor:F,verticalAnchor:"middle"},te):n==="insideRight"?hl({x:x+S-N,y:l+c/2,horizontalAnchor:L,verticalAnchor:"middle"},te):n==="insideTop"?hl({x:m+d/2,y:l+E,horizontalAnchor:"middle",verticalAnchor:C},te):n==="insideBottom"?hl({x:y+f/2,y:l+c-E,horizontalAnchor:"middle",verticalAnchor:T},te):n==="insideTopLeft"?hl({x:m+N,y:l+E,horizontalAnchor:F,verticalAnchor:C},te):n==="insideTopRight"?hl({x:m+d-N,y:l+E,horizontalAnchor:L,verticalAnchor:C},te):n==="insideBottomLeft"?hl({x:y+N,y:l+c-E,horizontalAnchor:F,verticalAnchor:T},te):n==="insideBottomRight"?hl({x:y+f-N,y:l+c-E,horizontalAnchor:L,verticalAnchor:T},te):n&&typeof n=="object"&&(Nt(n.x)||Rh(n.x))&&(Nt(n.y)||Rh(n.y))?hl({x:a+Ad(n.x,S),y:l+Ad(n.y,c),horizontalAnchor:"end",verticalAnchor:"end"},te):hl({x:_,y:l+c/2,horizontalAnchor:"middle",verticalAnchor:"middle"},te)},cae=["labelRef"],uae=["content"];function $L(t,e){if(t==null)return{};var n,r,i=dae(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r{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(mH.Provider,{value:l},a)},gH=()=>{var t=R.useContext(mH),e=mS();return t||(e?WP(e):void 0)},gae=R.createContext(null),vae=()=>{var t=R.useContext(gae),e=zt(sz);return t||e},yae=t=>{var e=t.value,n=t.formatter,r=Hi(t.children)?e:t.children;return typeof n=="function"?n(r):r},Q2=t=>t!=null&&typeof t=="function",xae=(t,e)=>{var n=Wo(e-t),r=Math.min(Math.abs(e-t),360);return n*r},bae=(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=xae(f,m),_=S>=0?1:-1,w,E;switch(e){case"insideStart":w=f+_*s,E=y;break;case"insideEnd":w=m-_*s,E=!y;break;case"end":w=m+_*s,E=y;break;default:throw new Error("Unsupported position ".concat(e))}E=S<=0?E:!E;var T=zi(a,l,x,w),C=zi(a,l,x,w+(E?1:-1)*359),O="M".concat(T.x,",").concat(T.y,` +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Zoe(t,e){if(t){if(typeof t=="string")return HL(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)?HL(t,e):void 0}}function HL(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{var e=t.children,n=t.breakAll,r=t.style;try{var i=[];Hi(e)||(n?i=e.toString().split(""):i=e.toString().split(cH));var s=i.map(a=>({word:a,width:Gy(a,r).width})),o=n?0:Gy(" ",r).width;return{wordsWithComputedWidth:s,spaceWidth:o}}catch{return null}};function dH(t){return t==="start"||t==="middle"||t==="end"||t==="inherit"}function eae(t){return Hi(t)||typeof t=="string"||typeof t=="number"||typeof t=="boolean"}var fH=(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+nt.reduce((e,n)=>e.width>n.width?e:n),tae="…",VL=(t,e,n,r,i,s,o,a)=>{var l=t.slice(0,e),c=uH({breakAll:n,style:r,children:l+tae});if(!c)return[!1,[]];var d=fH(c.wordsWithComputedWidth,s,o,a),f=d.length>i||hH(d).width>Number(s);return[f,d]},nae=(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=fH(e,r,n,i);if(!c||i)return f;var m=f.length>s||hH(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),E=w-1,T=VL(d,E,l,a,s,r,n,i),C=BL(T,2),O=C[0],N=C[1],L=VL(d,w,l,a,s,r,n,i),F=BL(L,1),V=F[0];if(!O&&!V&&(y=w+1),O&&V&&(x=w-1),!O&&V){_=N;break}S++}return _||f},GL=t=>{var e=Hi(t)?[]:t.toString().split(cH);return[{words:e,width:void 0}]},rae=t=>{var e=t.width,n=t.scaleToFit,r=t.children,i=t.style,s=t.breakAll,o=t.maxLines;if((e||n)&&!Z0.isSsr){var a,l,c=uH({breakAll:s,children:r,style:i});if(c){var d=c.wordsWithComputedWidth,f=c.spaceWidth;a=d,l=f}else return GL(r);return nae({breakAll:s,children:r,maxLines:o,style:i},a,l,e,!!n)}return GL(r)},pH="#808080",iae={angle:0,breakAll:!1,capHeight:"0.71em",fill:pH,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},Z2=R.forwardRef((t,e)=>{var n=Jo(t,iae),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=zL(n,Xoe),m=R.useMemo(()=>rae({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,E=zL(f,qoe);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=zE("calc(".concat(o,")"));break;case"middle":O=zE("calc(".concat((m.length-1)/2," * -").concat(s," + (").concat(o," / 2))"));break;default:O=zE("calc(".concat(m.length-1," * -").concat(s,")"));break}var N=[],L=m[0];if(l&&L!=null){var F=L.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&&(E.transform=N.join(" ")),R.createElement("text",RC({},Ko(E),{ref:e,x:T,y:C,className:er("recharts-text",_),textAnchor:c,fill:a.includes("url")?pH:a}),m.map((k,U)=>{var H=k.words.join(w?"":" ");return R.createElement("tspan",{x:T,dy:U===0?O:s,key:"".concat(H,"-").concat(U)},H)}))});Z2.displayName="Text";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 pl(t){for(var e=1;e{var e=t.viewBox,n=t.position,r=t.offset,i=r===void 0?0:r,s=t.parentViewBox,o=WP(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,E=w*i,T=w>0?"end":"start",C=w>0?"start":"end",O=d>=0?1:-1,N=O*i,L=O>0?"end":"start",F=O>0?"start":"end",V=s;if(n==="top"){var k={x:m+d/2,y:l-E,horizontalAnchor:"middle",verticalAnchor:T};return V&&(k.height=Math.max(l-V.y,0),k.width=d),k}if(n==="bottom"){var U={x:y+f/2,y:l+c+E,horizontalAnchor:"middle",verticalAnchor:C};return V&&(U.height=Math.max(V.y+V.height-(l+c),0),U.width=f),U}if(n==="left"){var H={x:x-N,y:l+c/2,horizontalAnchor:L,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:L,verticalAnchor:"middle"},te):n==="insideTop"?pl({x:m+d/2,y:l+E,horizontalAnchor:"middle",verticalAnchor:C},te):n==="insideBottom"?pl({x:y+f/2,y:l+c-E,horizontalAnchor:"middle",verticalAnchor:T},te):n==="insideTopLeft"?pl({x:m+N,y:l+E,horizontalAnchor:F,verticalAnchor:C},te):n==="insideTopRight"?pl({x:m+d-N,y:l+E,horizontalAnchor:L,verticalAnchor:C},te):n==="insideBottomLeft"?pl({x:y+N,y:l+c-E,horizontalAnchor:F,verticalAnchor:T},te):n==="insideBottomRight"?pl({x:y+f-N,y:l+c-E,horizontalAnchor:L,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)},cae=["labelRef"],uae=["content"];function $L(t,e){if(t==null)return{};var n,r,i=dae(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r{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(mH.Provider,{value:l},a)},gH=()=>{var t=R.useContext(mH),e=mS();return t||(e?WP(e):void 0)},gae=R.createContext(null),vae=()=>{var t=R.useContext(gae),e=zt(sz);return t||e},yae=t=>{var e=t.value,n=t.formatter,r=Hi(t.children)?e:t.children;return typeof n=="function"?n(r):r},Q2=t=>t!=null&&typeof t=="function",xae=(t,e)=>{var n=Wo(e-t),r=Math.min(Math.abs(e-t),360);return n*r},bae=(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=xae(f,m),_=S>=0?1:-1,w,E;switch(e){case"insideStart":w=f+_*s,E=y;break;case"insideEnd":w=m-_*s,E=!y;break;case"end":w=m+_*s,E=y;break;default:throw new Error("Unsupported position ".concat(e))}E=S<=0?E:!E;var T=zi(a,l,x,w),C=zi(a,l,x,w+(E?1:-1)*359),O="M".concat(T.x,",").concat(T.y,` A`).concat(x,",").concat(x,",0,1,").concat(E?0:1,`, - `).concat(C.x,",").concat(C.y),N=Hi(t.id)?l0("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))},_ae=(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"}},G_=t=>t!=null&&"cx"in t&&Nt(t.cx),wae={angle:0,offset:5,zIndex:Ms.label,position:"middle",textBreakAll:!1};function Sae(t){if(!G_(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,wae),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=vae(),y=gH(),x=i==="center"?y:m??y,S,_,w;n==null?S=x:G_(n)?S=n:S=WP(n);var E=Sae(S);if(!S||Hi(s)&&Hi(o)&&!R.isValidElement(a)&&typeof a!="function")return null;var T=Uy(Uy({},e),{},{viewBox:S});if(R.isValidElement(a)){T.labelRef;var C=$L(T,cae);return R.cloneElement(a,C)}if(typeof a=="function"){T.content;var O=$L(T,uae);if(_=R.createElement(a,O),R.isValidElement(_))return _}else _=yae(e);var N=Ko(e);if(G_(S)){if(i==="insideStart"||i==="insideEnd"||i==="end")return bae(e,i,_,N,S);w=_ae(S,e.offset,e.position)}else{if(!E)return null;var L=lae({viewBox:E,position:i,offset:e.offset,parentViewBox:G_(r)?void 0:r});w=Uy(Uy({x:L.x,y:L.y,textAnchor:L.horizontalAnchor,verticalAnchor:L.verticalAnchor},L.width!==void 0?{width:L.width}:{}),L.height!==void 0?{height:L.height}:{})}return R.createElement(au,{zIndex:e.zIndex},R.createElement(Z2,Oc({ref:f,className:er("recharts-label",c)},N,w,{textAnchor:dH(N.textAnchor)?N.textAnchor:w.textAnchor,breakAll:d}),_))}ld.displayName="Label";var Mae=(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,Uy({key:"label-implicit"},r)):R.createElement(ld,Oc({key:"label-implicit",content:t},r)):Q2(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 Eae(t){var e=t.label,n=t.labelRef,r=gH();return Mae(e,r,n)||null}var Aae=["valueAccessor"],Tae=["dataKey","clockWise","id","textBreakAll","zIndex"];function Vw(){return Vw=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var e=Array.isArray(t.value)?t.value[t.value.length-1]:t.value;if(eae(e))return e},vH=R.createContext(void 0),Rae=vH.Provider,yH=R.createContext(void 0);yH.Provider;function Nae(){return R.useContext(vH)}function Iae(){return R.useContext(yH)}function W_(t){var e=t.valueAccessor,n=e===void 0?Pae:e,r=qL(t,Aae),i=r.dataKey;r.clockWise;var s=r.id,o=r.textBreakAll,a=r.zIndex,l=qL(r,Tae),c=Nae(),d=Iae(),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,Vw({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}))})))}W_.displayName="LabelList";function kae(t){var e=t.label;return e?e===!0?R.createElement(W_,{key:"labelList-implicit"}):R.isValidElement(e)||Q2(e)?R.createElement(W_,{key:"labelList-implicit",content:e}):typeof e=="object"?R.createElement(W_,Vw({key:"labelList-implicit"},e,{type:String(e.type)})):null:null}function NC(){return NC=Object.assign?Object.assign.bind():function(t){for(var e=1;e{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",NC({},Fa(t),LP(t),{className:s,cx:e,cy:n,r})):null},Oae={radiusAxis:{},angleAxis:{}},bH=cs({name:"polarAxis",initialState:Oae,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=bH.actions;US.addRadiusAxis;US.removeRadiusAxis;US.addAngleAxis;US.removeAngleAxis;var Lae=bH.reducer;function Dae(t){return t&&typeof t=="object"&&"className"in t&&typeof t.className=="string"?t.className:""}var _H=t=>t&&typeof t=="object"&&"clipDot"in t?!!t.clipDot:!0;function KL(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{r||(i.current===null?n(tie(e)):i.current!==e&&n(nie({prev:i.current,next:e})),i.current=e)},[e,n,r]),R.useLayoutEffect(()=>()=>{i.current&&(n(rie(i.current)),i.current=null)},[n]),null}function $ae(t){var e=t.legendPayload,n=Wr(),r=Qs(),i=R.useRef(null);return R.useLayoutEffect(()=>{r||(i.current===null?n(PZ(e)):i.current!==e&&n(RZ({prev:i.current,next:e})),i.current=e)},[n,r,e]),R.useLayoutEffect(()=>()=>{i.current&&(n(NZ(i.current)),i.current=null)},[n]),null}function Xae(t,e){return Zae(t)||Yae(t,e)||Kae(t,e)||qae()}function qae(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. + `).concat(C.x,",").concat(C.y),N=Hi(t.id)?l0("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))},_ae=(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"}},G_=t=>t!=null&&"cx"in t&&Nt(t.cx),wae={angle:0,offset:5,zIndex:Ms.label,position:"middle",textBreakAll:!1};function Sae(t){if(!G_(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,wae),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=vae(),y=gH(),x=i==="center"?y:m??y,S,_,w;n==null?S=x:G_(n)?S=n:S=WP(n);var E=Sae(S);if(!S||Hi(s)&&Hi(o)&&!R.isValidElement(a)&&typeof a!="function")return null;var T=Uy(Uy({},e),{},{viewBox:S});if(R.isValidElement(a)){T.labelRef;var C=$L(T,cae);return R.cloneElement(a,C)}if(typeof a=="function"){T.content;var O=$L(T,uae);if(_=R.createElement(a,O),R.isValidElement(_))return _}else _=yae(e);var N=Ko(e);if(G_(S)){if(i==="insideStart"||i==="insideEnd"||i==="end")return bae(e,i,_,N,S);w=_ae(S,e.offset,e.position)}else{if(!E)return null;var L=lae({viewBox:E,position:i,offset:e.offset,parentViewBox:G_(r)?void 0:r});w=Uy(Uy({x:L.x,y:L.y,textAnchor:L.horizontalAnchor,verticalAnchor:L.verticalAnchor},L.width!==void 0?{width:L.width}:{}),L.height!==void 0?{height:L.height}:{})}return R.createElement(au,{zIndex:e.zIndex},R.createElement(Z2,Oc({ref:f,className:er("recharts-label",c)},N,w,{textAnchor:dH(N.textAnchor)?N.textAnchor:w.textAnchor,breakAll:d}),_))}ld.displayName="Label";var Mae=(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,Uy({key:"label-implicit"},r)):R.createElement(ld,Oc({key:"label-implicit",content:t},r)):Q2(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 Eae(t){var e=t.label,n=t.labelRef,r=gH();return Mae(e,r,n)||null}var Aae=["valueAccessor"],Tae=["dataKey","clockWise","id","textBreakAll","zIndex"];function Vw(){return Vw=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var e=Array.isArray(t.value)?t.value[t.value.length-1]:t.value;if(eae(e))return e},vH=R.createContext(void 0),Rae=vH.Provider,yH=R.createContext(void 0);yH.Provider;function Nae(){return R.useContext(vH)}function Iae(){return R.useContext(yH)}function W_(t){var e=t.valueAccessor,n=e===void 0?Pae:e,r=qL(t,Aae),i=r.dataKey;r.clockWise;var s=r.id,o=r.textBreakAll,a=r.zIndex,l=qL(r,Tae),c=Nae(),d=Iae(),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,Vw({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}))})))}W_.displayName="LabelList";function kae(t){var e=t.label;return e?e===!0?R.createElement(W_,{key:"labelList-implicit"}):R.isValidElement(e)||Q2(e)?R.createElement(W_,{key:"labelList-implicit",content:e}):typeof e=="object"?R.createElement(W_,Vw({key:"labelList-implicit"},e,{type:String(e.type)})):null:null}function NC(){return NC=Object.assign?Object.assign.bind():function(t){for(var e=1;e{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",NC({},za(t),LP(t),{className:s,cx:e,cy:n,r})):null},Oae={radiusAxis:{},angleAxis:{}},bH=cs({name:"polarAxis",initialState:Oae,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=bH.actions;US.addRadiusAxis;US.removeRadiusAxis;US.addAngleAxis;US.removeAngleAxis;var Lae=bH.reducer;function Dae(t){return t&&typeof t=="object"&&"className"in t&&typeof t.className=="string"?t.className:""}var _H=t=>t&&typeof t=="object"&&"clipDot"in t?!!t.clipDot:!0;function KL(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{r||(i.current===null?n(tie(e)):i.current!==e&&n(nie({prev:i.current,next:e})),i.current=e)},[e,n,r]),R.useLayoutEffect(()=>()=>{i.current&&(n(rie(i.current)),i.current=null)},[n]),null}function $ae(t){var e=t.legendPayload,n=Wr(),r=Qs(),i=R.useRef(null);return R.useLayoutEffect(()=>{r||(i.current===null?n(PZ(e)):i.current!==e&&n(RZ({prev:i.current,next:e})),i.current=e)},[n,r,e]),R.useLayoutEffect(()=>()=>{i.current&&(n(NZ(i.current)),i.current=null)},[n]),null}function Xae(t,e){return Zae(t)||Yae(t,e)||Kae(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 Kae(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);n2&&arguments[2]!==void 0?arguments[2]:[],r=[];for(var i of n)r.push({status:"removed",prev:i});for(var s=0;st[Math.floor(s*n)]);return eR(r,e)}function ele(t,e){var n=e.map((r,i)=>t[i]);return eR(n,e)}function tle(t,e){for(var n=new Map,r=0;r{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=Xae(a,2),c=l[0],d=l[1];i.has(c)||o.push(d)}return eR(s,e,o)}function IC(t,e,n){return e==null?null:t==null?e.map(r=>({status:"added",next:r})):n===J2?Jae(t,e):n===Qae?ele(t,e):nle(t,e,n)}function SH(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 rle(t,e){return ale(t)||ole(t,e)||sle(t,e)||ile()}function ile(){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 sle(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{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 cle(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),E=SH(w,s),T=(e=E.startValue)!==null&&e!==void 0?e:null,C=IC(T,i,y??J2);return R.createElement(j4,{animationId:w,begin:a,duration:l,isActive:o,easing:c,onAnimationEnd:f,onAnimationStart:d,key:w},O=>{var N=T==null,L=i==null?i:m(C,O,_),F=x?x(O):O>0;return E.syncStepValue(L,O,F),L==null?null:S(L,O,N)})}var BE;function ule(t,e){return ple(t)||hle(t,e)||fle(t,e)||dle()}function dle(){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 fle(t,e){if(t){if(typeof t=="string")return JL(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)?JL(t,e):void 0}}function JL(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{var t=R.useState(()=>l0("uid-")),e=ule(t,1),n=e[0];return n},MH=(BE=H1.useId)!==null&&BE!==void 0?BE:mle;function gle(t,e){var n=MH();return e||(t?"".concat(t,"-").concat(n):n)}var vle=R.createContext(void 0),yle=t=>{var e=t.id,n=t.type,r=t.children,i=gle("recharts-".concat(n),e);return R.createElement(vle.Provider,{value:i},r(i))},xle={cartesianItems:[],polarItems:[]},EH=cs({name:"graphicalItems",initialState:xle,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()}}}),Zg=EH.actions,ble=Zg.addCartesianGraphicalItem,_le=Zg.replaceCartesianGraphicalItem,wle=Zg.removeCartesianGraphicalItem;Zg.addPolarGraphicalItem;Zg.removePolarGraphicalItem;Zg.replacePolarGraphicalItem;var Sle=EH.reducer,Mle=t=>{var e=Wr(),n=R.useRef(null);return R.useLayoutEffect(()=>{n.current===null?e(ble(t)):n.current!==t&&e(_le({prev:n.current,next:t})),n.current=t},[e,t]),R.useLayoutEffect(()=>()=>{n.current&&(e(wle(n.current)),n.current=null)},[e]),null},Ele=R.memo(Mle),Ale=["points"];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 HE(t){for(var e=1;e{var w,E,T=HE(HE(HE({r:3},o),m),{},{index:_,cx:(w=S.x)!==null&&w!==void 0?w:void 0,cy:(E=S.y)!==null&&E!==void 0?E:void 0,dataKey:s,value:S.value,payload:S.payload,points:e});return R.createElement(Ile,{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,Gw({className:r},x),y))}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 n3(t){for(var e=1;e({top:t.top,bottom:t.bottom,left:t.left,right:t.right})),qle=Oe([Xle,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)}}),tR=()=>zt(qle),Kle=()=>zt(tse);function r3(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 VE(t){for(var e=1;e{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=VE(VE(VE({},a),Z1(i)),LP(i)),c;return R.isValidElement(i)?c=R.cloneElement(i,l):typeof i=="function"?c=i(l):c=R.createElement(xH,l),R.createElement(Yo,{className:"recharts-active-dot",clipPath:o},c)};function i3(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(_0),c=Kle();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(Jle,{point:d,childIndex:Number(l),mainColor:n,dataKey:i,activeDot:r,clipPath:s}))}var ece=t=>{var e=t.chartData,n=Wr(),r=Qs();return R.useEffect(()=>r?()=>{}:(n(AL(e)),()=>{n(AL(void 0))}),[e,n,r]),null},s3={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},CH=cs({name:"brush",initialState:s3,reducers:{setBrushSettings(t,e){return e.payload==null?s3:e.payload}}});CH.actions.setBrushSettings;var tce=CH.reducer;function nce(t){return(t%180+180)%180}var rce=function(e){var n=e.width,r=e.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=nce(i),o=s*Math.PI/180,a=Math.atan(r/n),l=o>a&&o{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)}}}),Qg=PH.actions;Qg.addDot;Qg.removeDot;Qg.addArea;Qg.removeArea;Qg.addLine;Qg.removeLine;var sce=PH.reducer;function oce(t,e){return uce(t)||cce(t,e)||lce(t,e)||ace()}function ace(){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 lce(t,e){if(t){if(typeof t=="string")return o3(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)?o3(t,e):void 0}}function o3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{var e=t.children,n=R.useState("".concat(l0("recharts"),"-clip")),r=oce(n,1),i=r[0],s=tR();if(s==null)return null;var o=s.x,a=s.y,l=s.width,c=s.height;return R.createElement(dce.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 RH(t,e){if(e<1)return[];if(e===1)return t;for(var n=[],r=0;rt*i)return!1;var s=n();return t*(e-t*s/2-r)>=0&&t*(e+t*s/2-i)<=0}function mce(t,e){return RH(t,e+1)}function gce(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:RH(r,c)};var S=l,_,w=()=>(_===void 0&&(_=n(x,S)),_),E=x.coordinate,T=l===0||S0(t,E,w,d,a);T||(l=0,d=o,c+=1),T&&(d=E+t*(w()/2+i),l+=c)},m;c<=s.length;)if(m=f(),m)return m.v;return[]}function vce(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,L=()=>(N===void 0&&(N=n(C,O)),N),F=C.coordinate,V=S===d||S0(t,F,L,f,l);if(!V)return m=!1,1;V&&(f=F+t*(L()/2+i))},x,S=d;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 E=S0(t,x.tickCoord,_,a,l);E&&(l=x.tickCoord-t*(_()/2+i),s[m]=ns(ns({},x),{},{isShow:!0}))}},d=o-1;d>=0;d--)c(d);return s}function wce(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=S0(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(E){var T=o[E];if(T==null)return 1;var C=T,O,N=()=>(O===void 0&&(O=n(T,E)),O);if(E===0){var L=t*(C.coordinate-t*N()/2-l);o[E]=C=ns(ns({},C),{},{tickCoord:L<0?C.coordinate-L*t:C.coordinate})}else o[E]=C=ns(ns({},C),{},{tickCoord:C.coordinate});if(C.tickCoord!=null){var F=S0(t,C.tickCoord,N,l,c);F&&(l=C.tickCoord+t*(N()/2+i),o[E]=ns(ns({},C),{},{isShow:!0}))}},_=0;_{var L=typeof c=="function"?c(O.value,N):O.value;return x==="width"?hce(Gy(L,{fontSize:e,letterSpacing:n}),S,f):Gy(L,{fontSize:e,letterSpacing:n})[x]},w=i[0],E=i[1],T=i.length>=2&&w!=null&&E!=null?Wo(E.coordinate-w.coordinate):1,C=pce(s,T,x);return l==="equidistantPreserveStart"?gce(T,C,_,i,o):l==="equidistantPreserveEnd"?vce(T,C,_,i,o):(l==="preserveStart"||l==="preserveStartEnd"?y=wce(T,C,_,i,o,l==="preserveStartEnd"):y=_ce(T,C,_,i,o),y.filter(O=>O.isShow))}var Sce=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},Mce={xAxis:{},yAxis:{}},NH=cs({name:"renderedTicks",initialState:Mce,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]}}}),IH=NH.actions,Ece=IH.setRenderedTicks,Ace=IH.removeRenderedTicks,Tce=NH.reducer,Cce=["axisLine","width","height","className","hide","ticks","axisType","axisId"];function l3(t,e){return Ice(t)||Nce(t,e)||Rce(t,e)||Pce()}function Pce(){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 Rce(t,e){if(t){if(typeof t=="string")return c3(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)?c3(t,e):void 0}}function c3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{if(r==null||n==null)return Bg;var s=e.map(o=>({value:o.value,coordinate:o.coordinate,offset:o.offset,index:o.index}));return i(Ece({ticks:s,axisId:r,axisType:n})),()=>{i(Ace({axisId:r,axisType:n}))}},[i,e,r,n]),null}var Gce=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,E=t.tickMargin,T=t.fontSize,C=t.letterSpacing,O=t.getTicksConfig,N=t.events,L=t.axisType,F=t.axisId,V=nR(Er(Er({},O),{},{ticks:r}),T,C),k=Fa(O),U=Z1(i),H=dH(k.textAnchor)?k.textAnchor:zce(f,m),ne=Bce(f,m),te={};typeof s=="object"&&(te=s);var pe=Er(Er({},k),{},{fill:"none"},te),oe=V.map(K=>Er({entry:K},Fce(K,y,x,S,_,f,w,m,E))),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),U);return R.createElement(Yo,Dh({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(ge.value,"-").concat(ge.coordinate,"-").concat(ge.tickCoord)},qX(N,ge,q)),i&&R.createElement(Hce,{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(L,"-ticks")},R.createElement(Vce,{ticks:V,axisId:F,axisType:L}),B.length>0&&R.createElement(au,{zIndex:Ms.label},R.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(L,"-tick-labels"),ref:e},B)),ce.length>0&&R.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(L,"-tick-lines")},ce))}),Wce=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=kce(t,Cce),f=R.useState(""),m=l3(f,2),y=m[0],x=m[1],S=R.useState(""),_=l3(S,2),w=_[0],E=_[1],T=R.useRef(null);R.useImperativeHandle(e,()=>({getCalculatedWidth:()=>{var O;return Sce({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 L=N[0];if(L){var F=window.getComputedStyle(L),V=F.fontSize,k=F.letterSpacing;(V!==y||k!==w)&&(x(V),E(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(Uce,{x:t.x,y:t.y,width:r,height:i,orientation:t.orientation,mirror:t.mirror,axisLine:n,otherSvgProps:Fa(t)}),R.createElement(Gce,{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(mae,{x:t.x,y:t.y,width:t.width,height:t.height,lowerWidth:t.width,upperWidth:t.width},R.createElement(Eae,{label:t.label,labelRef:t.labelRef}),t.children)))}),rR=R.forwardRef((t,e)=>{var n=Jo(t,Gc);return R.createElement(Wce,Dh({},n,{ref:e}))});rR.displayName="CartesianAxis";var $ce=["x1","y1","x2","y2","key"],Xce=["offset"],qce=["xAxisId","yAxisId"],Kce=["xAxisId","yAxisId"];function d3(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{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 kH(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=Ww(n,$ce),f=(i=Fa(d))!==null&&i!==void 0?i:{};f.offset;var m=Ww(f,Xce);r=R.createElement("line",rh({},m,{x1:s,y1:o,x2:a,y2:l,fill:"none",key:c}))}return r}function tue(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=Ww(t,qce),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(kH,{key:"line-".concat(c),option:i,lineItemProps:d})});return R.createElement("g",{className:"recharts-cartesian-grid-horizontal"},a)}function nue(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=Ww(t,Kce),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(kH,{option:i,lineItemProps:d,key:"line-".concat(c)})});return R.createElement("g",{className:"recharts-cartesian-grid-vertical"},a)}function rue(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 iue(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 sue=(t,e)=>{var n=t.xAxis,r=t.width,i=t.height,s=t.offset;return h4(nR(rs(rs(rs({},Gc),n),{},{ticks:p4(n),viewBox:{x:0,y:0,width:r,height:i}})),s.left,s.left+s.width,e)},oue=(t,e)=>{var n=t.yAxis,r=t.width,i=t.height,s=t.offset;return h4(nR(rs(rs(rs({},Gc),n),{},{ticks:p4(n),viewBox:{x:0,y:0,width:r,height:i}})),s.top,s.top+s.height,e)},aue={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:Ms.grid};function OH(t){var e=w4(),n=S4(),r=_4(),i=rs(rs({},Jo(t,aue)),{},{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=>hL(V,"xAxis",s,x)),_=zt(V=>hL(V,"yAxis",o,x));if(!kl(c)||!kl(d)||!Nt(a)||!Nt(l))return null;var w=i.verticalCoordinatesGenerator||sue,E=i.horizontalCoordinatesGenerator||oue,T=i.horizontalPoints,C=i.verticalPoints;if((!T||!T.length)&&typeof E=="function"){var O=m&&m.length,N=E({yAxis:_?rs(rs({},_),{},{ticks:O?m:_.ticks}):void 0,width:e??c,height:n??d,offset:r},O?!0:f);vw(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 L=y&&y.length,F=w({xAxis:S?rs(rs({},S),{},{ticks:L?y:S.ticks}):void 0,width:e??c,height:n??d,offset:r},L?!0:f);vw(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(eue,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),R.createElement(rue,rh({},i,{horizontalPoints:T})),R.createElement(iue,rh({},i,{verticalPoints:C})),R.createElement(tue,rh({},i,{offset:r,horizontalPoints:T,xAxis:S,yAxis:_})),R.createElement(nue,rh({},i,{offset:r,verticalPoints:C,xAxis:S,yAxis:_}))))}OH.displayName="CartesianGrid";var lue={},LH=cs({name:"errorBars",initialState:lue,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))}}}),iR=LH.actions;iR.addErrorBar;iR.replaceErrorBar;iR.removeErrorBar;var cue=LH.reducer;function DH(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 uue(t){var e=t.xAxisId,n=t.yAxisId,r=t.clipPathId,i=tR(),s=DH(e,n),o=s.needClipX,a=s.needClipY,l=s.needClip,c=zt(T=>bB(T,e,!1)),d=zt(T=>_B(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,E=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:E}))}function due(t){var e=Z1(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 sR(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:AH}function oR(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:AH}var jH=(t,e,n)=>PB(t,"xAxis",sR(t,e),n),UH=(t,e,n)=>CB(t,"xAxis",sR(t,e),n),FH=(t,e,n)=>PB(t,"yAxis",oR(t,e),n),zH=(t,e,n)=>CB(t,"yAxis",oR(t,e),n),fue=Oe([fr,jH,FH,UH,zH],(t,e,n,r,i)=>Fl(t,"xAxis")?gw(e,r,!1):gw(n,i,!1)),hue=(t,e)=>e,BH=Oe([qz,hue],(t,e)=>t.filter(n=>n.type==="area").find(n=>n.id===e)),HH=t=>{var e=fr(t),n=Fl(e,"xAxis");return n?"yAxis":"xAxis"},pue=(t,e)=>{var n=HH(t);return n==="yAxis"?oR(t,e):sR(t,e)},mue=(t,e,n)=>iB(t,HH(t),pue(t,e),n),gue=Oe([BH,mue],(t,e)=>{var n;if(!(t==null||e==null)){var r=t.stackId,i=o2(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]])}}}),vue=Oe([fr,jH,FH,UH,zH,gue,BJ,fue,BH,iee],(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 Vue({layout:t,xAxis:e,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:f,areaSettings:l,stackedData:s,displayedData:x,chartBaseValue:c,bandSize:a})}}),yue=["animationElapsedTime","isAnimating","isEntrance","layout","isRange","stroke","connectNulls"],xue=["id","baseLine"];function Wy(){return Wy=Object.assign?Object.assign.bind():function(t){for(var e=1;ef.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:af.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:at==null?[]:e===1?t.flatMap(n=>n.status==="removed"?[]:[n.next]):t.flatMap(n=>n.status==="matched"?[Rg(Rg({},n.next),{},{x:jc(n.prev.x,n.next.x,e),y:jc(n.prev.y,n.next.y,e)})]:n.status==="added"?[n.next]:[]),GH={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",animationMatchBy:J2,animationInterpolateFn:Nue,connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,shape:Mue,xAxisId:0,yAxisId:0,zIndex:Ms.area};function Xw(t,e){return t&&t!=="none"?t:e}var Iue=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:Xw(r,i),value:m4(n,e),payload:t}]},kue=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:Bg,settings:{stroke:r,strokeWidth:i,fill:s,dataKey:e,nameKey:void 0,name:m4(o,e),hide:a,type:c,color:Xw(r,s),unit:l,graphicalItemId:d}};return R.createElement(Wae,{tooltipEntrySettings:f})});function Oue(t){var e=t.clipPathId,n=t.points,r=t.props,i=r.needClip,s=r.dot,o=r.dataKey,a=Fa(r);return R.createElement(Ole,{points:n,dot:s,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:o,baseProps:a,needClip:i,clipPathId:e})}function Lue(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 Rg(Rg({},l),{},{value:s.value,payload:s.payload,parentViewBox:void 0,viewBox:l,fill:void 0})});return R.createElement(Rae,{value:e?i:void 0},n)}function Due(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,_=VH(s,Eue),w=Ko(_),E=Rg(Rg({},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(Gae,{option:x,DefaultShape:GH.shape,shapeProps:E})),R.createElement(Oue,{points:e,props:_,clipPathId:i}))}function jue(t,e,n){if(Nt(t)){var r=Nt(e)?e:void 0;return jc(r,t,n)}if(Hi(t)||Nl(t)){var i=Nt(e)?e:void 0;return jc(i,0,n)}return t}function Uue(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=SH(x,s),_=$P(),w=lle(r.onAnimationStart,r.onAnimationEnd),E=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=IC(O,a,m):Array.isArray(a)?N=IC(null,a,m):N=null,R.createElement(cle,{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:_},(L,F,V)=>{var k;return F===1?k=a:Array.isArray(a)?k=y(N,F,_):k=V?a:jue(a,O,F),S.syncStepValue(k,F),R.createElement(Lue,{showLabels:!E,points:o},r.children,R.createElement(Due,{points:L,baseLine:k,needClip:e,clipPathId:n,props:r,animationElapsedTime:F,isAnimating:E||F<1,isEntrance:V}),R.createElement(kae,{label:r.label}))})}function Fue(t){var e=t.needClip,n=t.clipPathId,r=t.props,i=R.useRef(null),s=R.useRef();return R.createElement(Uue,{needClip:e,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:s})}class zue 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,E=due(r),T=E.r,C=E.strokeWidth,O=_H(r),N=T*2+C,L=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(uue,{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(Fue,{needClip:l,clipPathId:w,props:this.props})),R.createElement(i3,{points:i,mainColor:Xw(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:L}),this.props.isRange&&Array.isArray(x)&&R.createElement(i3,{points:x,mainColor:Xw(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:L}))}}function Bue(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,_=VH(t,Aue),w=Hg(),E=QB(),T=DH(x,S),C=T.needClip,O=Qs(),N=(e=zt(pe=>vue(pe,t.id,O)))!==null&&e!==void 0?e:{},L=N.points,F=N.isRange,V=N.baseLine,k=tR();if(w!=="horizontal"&&w!=="vertical"||k==null||E!=="AreaChart"&&E!=="ComposedChart")return null;var U=k.height,H=k.width,ne=k.x,te=k.y;return!L||!L.length?null:R.createElement(zue,$w({},_,{activeDot:n,animationBegin:r,animationDuration:i,animationEasing:s,baseLine:V,connectNulls:o,dot:a,fill:l,fillOpacity:c,height:U,hide:d,layout:w,isAnimationActive:f,isRange:F,legendType:m,needClip:C,points:L,stroke:y,width:H,left:ne,top:te,xAxisId:x,yAxisId:S}))}var Hue=(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 Vue(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,_=Hue(o,a,r,l,c),w=o==="horizontal",E=!1,T=d.map((O,N)=>{var L,F,V,k;if(S)k=s[f+N];else{var U=yi(O,i);Array.isArray(U)?(k=U,E=!0):k=[_,U]}var H=(L=(F=k)===null||F===void 0?void 0:F[1])!==null&&L!==void 0?L:null,ne=H==null||S&&!n&&yi(O,i)==null;if(w){var te;return{x:lk({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:lk({axis:c,ticks:y,bandSize:x,entry:O,index:N}),value:k,payload:O}}),C;return S||E?C=T.map(O=>{var N,L=Array.isArray(O.value)?O.value[0]:null;if(w){var F;return{x:O.x,y:L!=null&&O.y!=null&&(F=c.scale.map(L))!==null&&F!==void 0?F:null,payload:O.payload}}return{x:L!=null&&(N=l.scale.map(L))!==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:E}}function Gue(t){var e=Jo(t,GH),n=Qs();return R.createElement(yle,{id:e.id,type:"area"},r=>R.createElement(R.Fragment,null,R.createElement($ae,{legendPayload:Iue(e)}),R.createElement(kue,{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(Ele,{type:"area",id:r,data:e.data,dataKey:e.dataKey,xAxisId:e.xAxisId,yAxisId:e.yAxisId,zAxisId:0,stackId:TY(e.stackId),hide:e.hide,barSize:void 0,baseValue:e.baseValue,isPanorama:n,connectNulls:e.connectNulls}),R.createElement(Bue,$w({},e,{id:r}))))}var WH=R.memo(Gue,xS);WH.displayName="Area";var Wue=["domain","range"],$ue=["domain","range"];function p3(t,e){if(t==null)return{};var n,r,i=Xue(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r{if(o!=null)return v3(v3({},s),{},{type:o})},[s,o]);return R.useLayoutEffect(()=>{a!=null&&(n.current===null?e(Fle(a)):n.current!==a&&e(zle({prev:n.current,next:a})),n.current=a)},[a,e]),R.useLayoutEffect(()=>()=>{n.current&&(e(Ble(n.current)),n.current=null)},[e]),null}var nde=t=>{var e=t.xAxisId,n=t.className,r=zt(v4),i=Qs(),s="xAxis",o=zt(m=>TB(m,s,e,i)),a=zt(m=>Dre(m,e)),l=zt(m=>Hre(m,e)),c=zt(m=>Gz(m,e));if(a==null||l==null||c==null)return null;t.dangerouslySetInnerHTML,t.ticks,t.scale;var d=OC(t,Kue);c.id,c.scale;var f=OC(c,Yue);return R.createElement(rR,kC({},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}))},rde={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},ide=t=>{var e=Jo(t,rde);return R.createElement(R.Fragment,null,R.createElement(tde,{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(nde,e))},XH=R.memo(ide,$H);XH.displayName="XAxis";var sde=["type"],ode=["dangerouslySetInnerHTML","ticks","scale"],ade=["id","scale"];function LC(){return LC=Object.assign?Object.assign.bind():function(t){for(var e=1;e{if(o!=null)return x3(x3({},s),{},{type:o})},[o,s]);return R.useLayoutEffect(()=>{a!=null&&(n.current===null?e(Hle(a)):n.current!==a&&e(Vle({prev:n.current,next:a})),n.current=a)},[a,e]),R.useLayoutEffect(()=>()=>{n.current&&(e(Gle(n.current)),n.current=null)},[e]),null}function hde(t){var e=t.yAxisId,n=t.className,r=t.width,i=t.label,s=R.useRef(null),o=R.useRef(null),a=zt(v4),l=Qs(),c=Wr(),d="yAxis",f=zt(w=>Wre(w,e)),m=zt(w=>Gre(w,e)),y=zt(w=>TB(w,d,e,l)),x=zt(w=>Wz(w,e));if(R.useLayoutEffect(()=>{if(!(r!=="auto"||!f||Q2(i)||R.isValidElement(i)||x==null)){var w=s.current;if(w){var E=w.getCalculatedWidth();Math.round(f.width)!==Math.round(E)&&c(Wle({id:e,width:E}))}}},[y,f,c,i,e,r,x]),f==null||m==null||x==null)return null;t.dangerouslySetInnerHTML,t.ticks,t.scale;var S=DC(t,ode);x.id,x.scale;var _=DC(x,ade);return R.createElement(rR,LC({},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 pde={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},mde=t=>{var e=Jo(t,pde);return R.createElement(R.Fragment,null,R.createElement(fde,{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(hde,e))},qH=R.memo(mde,$H);qH.displayName="YAxis";var gde=(t,e)=>e,aR=Oe([gde,fr,sz,_i,$B,ou,hse,Gi],bse);function vde(t){return"getBBox"in t.currentTarget&&typeof t.currentTarget.getBBox=="function"}function lR(t){var e=t.currentTarget.getBoundingClientRect(),n,r;if(vde(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 KH=Eo("mouseClick"),YH=$0();YH.startListening({actionCreator:KH,effect:(t,e)=>{var n=t.payload,r=aR(e.getState(),lR(n));(r==null?void 0:r.activeIndex)!=null&&e.dispatch(oie({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var jC=Eo("mouseMove"),ZH=$0(),dm=null,Sf=null,GE=null;ZH.startListening({actionCreator:jC,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),GE=lR(n);var l=()=>{var c=e.getState(),d=sx(c,c.tooltip.settings.shared);if(!GE){dm=null,Sf=null;return}if(d==="axis"){var f=aR(c,GE);(f==null?void 0:f.activeIndex)!=null?e.dispatch(DB({activeIndex:f.activeIndex,activeDataKey:void 0,activeCoordinate:f.activeCoordinate})):e.dispatch(LB())}dm=null,Sf=null};if(!a){l();return}s==="raf"?dm=requestAnimationFrame(l):typeof s=="number"&&Sf===null&&(Sf=setTimeout(l,s))}});function yde(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?"<>":e}var b3={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},QH=cs({name:"rootProps",initialState:b3,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:b3.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}}}),xde=QH.reducer,bde=QH.actions.updateOptions,_de=null,wde={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)},JH=cs({name:"polarOptions",initialState:_de,reducers:wde});JH.actions.updatePolarOptions;var Sde=JH.reducer,eV=Eo("keyDown"),tV=Eo("focus"),nV=Eo("blur"),FS=$0(),fm=null,Mf=null,Ob=null;FS.startListening({actionCreator:eV,effect:(t,e)=>{Ob=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=Ob;if(f!=="ArrowRight"&&f!=="ArrowLeft"&&f!=="Enter")return;var m=Vy(d,Lh(l),Cg(l),Pg(l)),y=m==null?-1:Number(m),x=!Number.isFinite(y)||y<0,S=ou(l),_=Lh(l),w=sx(l,l.tooltip.settings.shared);if(f==="Enter"){if(x)return;var E=Bw(l,w,"hover",String(d.index));e.dispatch(zw({active:!d.active,activeIndex:d.index,activeCoordinate:E}));return}var T=Yre(l),C=T==="left-to-right"?1:-1,O=f==="ArrowRight"?1:-1,N;if(x){var L=Cg(l),F=Pg(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 U=0;U<_.length;U++)if(Vy(k(U),_,L,F)!=null){N=U;break}}else for(var H=_.length-1;H>=0;H--)if(Vy(k(H),_,L,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=Bw(l,w,"hover",String(N));e.dispatch(zw({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(),Ob=null,Mf=setTimeout(()=>{Ob?a():(Mf=null,fm=null)},i))}});FS.startListening({actionCreator:tV,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=sx(n,n.tooltip.settings.shared),a=Bw(n,o,"hover",String(s));e.dispatch(zw({active:!0,activeIndex:s,activeCoordinate:a}))}}}});FS.startListening({actionCreator:nV,effect:(t,e)=>{var n=e.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var i=n.tooltip.keyboardInteraction;i.active&&e.dispatch(zw({active:!1,activeIndex:i.index,activeCoordinate:i.coordinate}))}}});function rV(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 Bo=Eo("externalEvent"),iV=$0(),Lb=new Map,fy=new Map,WE=new Map;iV.startListening({actionCreator:Bo,effect:(t,e)=>{var n=t.payload,r=n.handler,i=n.reactEvent;if(r!=null){var s=i.type,o=rV(i);WE.set(s,{handler:r,reactEvent:o});var a=Lb.get(s);a!==void 0&&(cancelAnimationFrame(a),Lb.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=fy.get(s);x!==void 0&&(typeof d!="number"||!y)&&(clearTimeout(x),fy.delete(s));var S=()=>{var E=WE.get(s);try{if(!E)return;var T=E.handler,C=E.reactEvent,O=e.getState(),N={activeCoordinate:Qie(O),activeDataKey:Kie(O),activeIndex:_0(O),activeLabel:KB(O),activeTooltipIndex:_0(O),isTooltipActive:Jie(O)};T&&T(N,C)}finally{Lb.delete(s),fy.delete(s),WE.delete(s)}};if(!y){S();return}if(d==="raf"){var _=requestAnimationFrame(S);Lb.set(s,_)}else if(typeof d=="number"){if(!fy.has(s)){S();var w=setTimeout(S,d);fy.set(s,w)}}else S()}}});var Mde=Oe([Yg],t=>t.tooltipItemPayloads),Ede=Oe([Mde,(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)}}}),sV=Eo("touchMove"),oV=$0(),Ef=null,$u=null,_3=null,hy=null;oV.startListening({actionCreator:sV,effect:(t,e)=>{var n=t.payload;if(!(n.touches==null||n.touches.length===0)){hy=rV(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),_3=Array.from(n.touches).map(c=>lR({clientX:c.clientX,clientY:c.clientY,currentTarget:n.currentTarget}));var l=()=>{if(hy!=null){var c=e.getState(),d=sx(c,c.tooltip.settings.shared);if(d==="axis"){var f,m=(f=_3)===null||f===void 0?void 0:f[0];if(m==null){Ef=null,$u=null;return}var y=aR(c,m);(y==null?void 0:y.activeIndex)!=null&&e.dispatch(DB({activeIndex:y.activeIndex,activeDataKey:void 0,activeCoordinate:y.activeCoordinate}))}else if(d==="item"){var x,S=hy.touches[0];if(document.elementFromPoint==null||S==null)return;var _=document.elementFromPoint(S.clientX,S.clientY);if(!_||!_.getAttribute)return;var w=_.getAttribute(OY),E=(x=_.getAttribute(LY))!==null&&x!==void 0?x:void 0,T=Qh(c).find(N=>N.id===E);if(w==null||T==null||E==null)return;var C=T.dataKey,O=Ede(c,w,E);e.dispatch(sie({activeDataKey:C,activeIndex:w,activeCoordinate:O,activeGraphicalItemId:E}))}Ef=null,$u=null}};if(!a){l();return}s==="raf"?Ef=requestAnimationFrame(l):typeof s=="number"&&$u===null&&(l(),hy=null,$u=setTimeout(()=>{hy?l():($u=null,Ef=null)},s))}}});var aV={throttleDelay:"raf",throttledEvents:["mousemove","touchmove","pointermove","scroll","wheel"]},lV=cs({name:"eventSettings",initialState:aV,reducers:{setEventSettings:(t,e)=>{e.payload.throttleDelay!=null&&(t.throttleDelay=e.payload.throttleDelay),e.payload.throttledEvents!=null&&(t.throttledEvents=e.payload.throttledEvents)}}}),Ade=lV.actions.setEventSettings,Tde=lV.reducer,Cde=U5({brush:tce,cartesianAxis:$le,chartData:Zse,errorBars:cue,eventSettings:Tde,graphicalItems:Sle,layout:yY,legend:IZ,options:$se,polarAxis:Lae,polarOptions:Sde,referenceElements:sce,renderedTicks:Tce,rootProps:xde,tooltip:aie,zIndex:kse}),Pde=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return VK({reducer:Cde,preloadedState:e,middleware:r=>{var i;return r({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((i="es6")!==null&&i!==void 0?i:"")}).concat([YH.middleware,ZH.middleware,FS.middleware,iV.middleware,oV.middleware])},enhancers:r=>{var i=r;return typeof r=="function"&&(i=r()),i.concat(J5({type:"raf"}))},devTools:{serialize:{replacer:yde},name:"recharts-".concat(n)}})};function Rde(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=Pde(e,r));var o=jP;return R.createElement(qZ,{context:o,store:s.current},n)}function Nde(t){var e=t.layout,n=t.margin,r=Wr(),i=Qs();return R.useEffect(()=>{i||(r(mY(e)),r(pY(n)))},[r,i,e,n]),null}var Ide=R.memo(Nde,xS);function kde(t){var e=Wr();return R.useEffect(()=>{e(bde(t))},[e,t]),null}var Ode=t=>{var e=Wr();return R.useEffect(()=>{e(Ade(t))},[e,t]),null},Lde=R.memo(Ode,xS);function w3(t){var e=t.zIndex,n=t.isPanorama,r=R.useRef(null),i=Wr();return R.useLayoutEffect(()=>(r.current&&i(Nse({zIndex:e,element:r.current,isPanorama:n})),()=>{i(Ise({zIndex:e,isPanorama:n}))}),[i,e,n]),R.createElement("g",{tabIndex:-1,ref:r,className:"recharts-zIndex-layer_".concat(e)})}function S3(t){var e=t.children,n=t.isPanorama,r=zt(wse);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(w3,{key:o,zIndex:o,isPanorama:n})),e,s.map(o=>R.createElement(w3,{key:o,zIndex:o,isPanorama:n})))}var Dde=["children"];function jde(t,e){if(t==null)return{};var n,r,i=Ude(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r{var n=w4(),r=S4(),i=k4();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(n5,qw({},o,{title:a,desc:l,role:d,tabIndex:c,width:n,height:r,style:Fde,ref:e}),s)}),Bde=t=>{var e=t.children,n=zt(pS);if(!n)return null;var r=n.width,i=n.height,s=n.y,o=n.x;return R.createElement(n5,{width:r,height:i,x:o,y:s},e)},M3=R.forwardRef((t,e)=>{var n=t.children,r=jde(t,Dde),i=Qs();return i?R.createElement(Bde,null,R.createElement(S3,{isPanorama:!0},n)):R.createElement(zde,qw({ref:e},r),R.createElement(S3,{isPanorama:!1},n))});function Hde(t,e){return $de(t)||Wde(t,e)||Gde(t,e)||Vde()}function Vde(){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 Rce(t,e){if(t){if(typeof t=="string")return c3(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)?c3(t,e):void 0}}function c3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{if(r==null||n==null)return Bg;var s=e.map(o=>({value:o.value,coordinate:o.coordinate,offset:o.offset,index:o.index}));return i(Ece({ticks:s,axisId:r,axisType:n})),()=>{i(Ace({axisId:r,axisType:n}))}},[i,e,r,n]),null}var Gce=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,E=t.tickMargin,T=t.fontSize,C=t.letterSpacing,O=t.getTicksConfig,N=t.events,L=t.axisType,F=t.axisId,V=nR(Er(Er({},O),{},{ticks:r}),T,C),k=za(O),U=Z1(i),H=dH(k.textAnchor)?k.textAnchor:zce(f,m),ne=Bce(f,m),te={};typeof s=="object"&&(te=s);var pe=Er(Er({},k),{},{fill:"none"},te),oe=V.map(K=>Er({entry:K},Fce(K,y,x,S,_,f,w,m,E))),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),U);return R.createElement(Yo,Dh({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(ge.value,"-").concat(ge.coordinate,"-").concat(ge.tickCoord)},qX(N,ge,q)),i&&R.createElement(Hce,{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(L,"-ticks")},R.createElement(Vce,{ticks:V,axisId:F,axisType:L}),B.length>0&&R.createElement(au,{zIndex:Ms.label},R.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(L,"-tick-labels"),ref:e},B)),ce.length>0&&R.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(L,"-tick-lines")},ce))}),Wce=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=kce(t,Cce),f=R.useState(""),m=l3(f,2),y=m[0],x=m[1],S=R.useState(""),_=l3(S,2),w=_[0],E=_[1],T=R.useRef(null);R.useImperativeHandle(e,()=>({getCalculatedWidth:()=>{var O;return Sce({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 L=N[0];if(L){var F=window.getComputedStyle(L),V=F.fontSize,k=F.letterSpacing;(V!==y||k!==w)&&(x(V),E(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(Uce,{x:t.x,y:t.y,width:r,height:i,orientation:t.orientation,mirror:t.mirror,axisLine:n,otherSvgProps:za(t)}),R.createElement(Gce,{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(mae,{x:t.x,y:t.y,width:t.width,height:t.height,lowerWidth:t.width,upperWidth:t.width},R.createElement(Eae,{label:t.label,labelRef:t.labelRef}),t.children)))}),rR=R.forwardRef((t,e)=>{var n=Jo(t,Gc);return R.createElement(Wce,Dh({},n,{ref:e}))});rR.displayName="CartesianAxis";var $ce=["x1","y1","x2","y2","key"],Xce=["offset"],qce=["xAxisId","yAxisId"],Kce=["xAxisId","yAxisId"];function d3(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{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 kH(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=Ww(n,$ce),f=(i=za(d))!==null&&i!==void 0?i:{};f.offset;var m=Ww(f,Xce);r=R.createElement("line",rh({},m,{x1:s,y1:o,x2:a,y2:l,fill:"none",key:c}))}return r}function tue(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=Ww(t,qce),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(kH,{key:"line-".concat(c),option:i,lineItemProps:d})});return R.createElement("g",{className:"recharts-cartesian-grid-horizontal"},a)}function nue(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=Ww(t,Kce),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(kH,{option:i,lineItemProps:d,key:"line-".concat(c)})});return R.createElement("g",{className:"recharts-cartesian-grid-vertical"},a)}function rue(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 iue(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 sue=(t,e)=>{var n=t.xAxis,r=t.width,i=t.height,s=t.offset;return h4(nR(rs(rs(rs({},Gc),n),{},{ticks:p4(n),viewBox:{x:0,y:0,width:r,height:i}})),s.left,s.left+s.width,e)},oue=(t,e)=>{var n=t.yAxis,r=t.width,i=t.height,s=t.offset;return h4(nR(rs(rs(rs({},Gc),n),{},{ticks:p4(n),viewBox:{x:0,y:0,width:r,height:i}})),s.top,s.top+s.height,e)},aue={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:Ms.grid};function OH(t){var e=w4(),n=S4(),r=_4(),i=rs(rs({},Jo(t,aue)),{},{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=>hL(V,"xAxis",s,x)),_=zt(V=>hL(V,"yAxis",o,x));if(!kl(c)||!kl(d)||!Nt(a)||!Nt(l))return null;var w=i.verticalCoordinatesGenerator||sue,E=i.horizontalCoordinatesGenerator||oue,T=i.horizontalPoints,C=i.verticalPoints;if((!T||!T.length)&&typeof E=="function"){var O=m&&m.length,N=E({yAxis:_?rs(rs({},_),{},{ticks:O?m:_.ticks}):void 0,width:e??c,height:n??d,offset:r},O?!0:f);vw(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 L=y&&y.length,F=w({xAxis:S?rs(rs({},S),{},{ticks:L?y:S.ticks}):void 0,width:e??c,height:n??d,offset:r},L?!0:f);vw(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(eue,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),R.createElement(rue,rh({},i,{horizontalPoints:T})),R.createElement(iue,rh({},i,{verticalPoints:C})),R.createElement(tue,rh({},i,{offset:r,horizontalPoints:T,xAxis:S,yAxis:_})),R.createElement(nue,rh({},i,{offset:r,verticalPoints:C,xAxis:S,yAxis:_}))))}OH.displayName="CartesianGrid";var lue={},LH=cs({name:"errorBars",initialState:lue,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))}}}),iR=LH.actions;iR.addErrorBar;iR.replaceErrorBar;iR.removeErrorBar;var cue=LH.reducer;function DH(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 uue(t){var e=t.xAxisId,n=t.yAxisId,r=t.clipPathId,i=tR(),s=DH(e,n),o=s.needClipX,a=s.needClipY,l=s.needClip,c=zt(T=>bB(T,e,!1)),d=zt(T=>_B(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,E=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:E}))}function due(t){var e=Z1(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 sR(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:AH}function oR(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:AH}var jH=(t,e,n)=>PB(t,"xAxis",sR(t,e),n),UH=(t,e,n)=>CB(t,"xAxis",sR(t,e),n),FH=(t,e,n)=>PB(t,"yAxis",oR(t,e),n),zH=(t,e,n)=>CB(t,"yAxis",oR(t,e),n),fue=Oe([fr,jH,FH,UH,zH],(t,e,n,r,i)=>Fl(t,"xAxis")?gw(e,r,!1):gw(n,i,!1)),hue=(t,e)=>e,BH=Oe([qz,hue],(t,e)=>t.filter(n=>n.type==="area").find(n=>n.id===e)),HH=t=>{var e=fr(t),n=Fl(e,"xAxis");return n?"yAxis":"xAxis"},pue=(t,e)=>{var n=HH(t);return n==="yAxis"?oR(t,e):sR(t,e)},mue=(t,e,n)=>iB(t,HH(t),pue(t,e),n),gue=Oe([BH,mue],(t,e)=>{var n;if(!(t==null||e==null)){var r=t.stackId,i=o2(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]])}}}),vue=Oe([fr,jH,FH,UH,zH,gue,BJ,fue,BH,iee],(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 Vue({layout:t,xAxis:e,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:f,areaSettings:l,stackedData:s,displayedData:x,chartBaseValue:c,bandSize:a})}}),yue=["animationElapsedTime","isAnimating","isEntrance","layout","isRange","stroke","connectNulls"],xue=["id","baseLine"];function Wy(){return Wy=Object.assign?Object.assign.bind():function(t){for(var e=1;ef.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:af.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:at==null?[]:e===1?t.flatMap(n=>n.status==="removed"?[]:[n.next]):t.flatMap(n=>n.status==="matched"?[Rg(Rg({},n.next),{},{x:jc(n.prev.x,n.next.x,e),y:jc(n.prev.y,n.next.y,e)})]:n.status==="added"?[n.next]:[]),GH={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",animationMatchBy:J2,animationInterpolateFn:Nue,connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,shape:Mue,xAxisId:0,yAxisId:0,zIndex:Ms.area};function Xw(t,e){return t&&t!=="none"?t:e}var Iue=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:Xw(r,i),value:m4(n,e),payload:t}]},kue=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:Bg,settings:{stroke:r,strokeWidth:i,fill:s,dataKey:e,nameKey:void 0,name:m4(o,e),hide:a,type:c,color:Xw(r,s),unit:l,graphicalItemId:d}};return R.createElement(Wae,{tooltipEntrySettings:f})});function Oue(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(Ole,{points:n,dot:s,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:o,baseProps:a,needClip:i,clipPathId:e})}function Lue(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 Rg(Rg({},l),{},{value:s.value,payload:s.payload,parentViewBox:void 0,viewBox:l,fill:void 0})});return R.createElement(Rae,{value:e?i:void 0},n)}function Due(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,_=VH(s,Eue),w=Ko(_),E=Rg(Rg({},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(Gae,{option:x,DefaultShape:GH.shape,shapeProps:E})),R.createElement(Oue,{points:e,props:_,clipPathId:i}))}function jue(t,e,n){if(Nt(t)){var r=Nt(e)?e:void 0;return jc(r,t,n)}if(Hi(t)||Nl(t)){var i=Nt(e)?e:void 0;return jc(i,0,n)}return t}function Uue(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=SH(x,s),_=$P(),w=lle(r.onAnimationStart,r.onAnimationEnd),E=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=IC(O,a,m):Array.isArray(a)?N=IC(null,a,m):N=null,R.createElement(cle,{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:_},(L,F,V)=>{var k;return F===1?k=a:Array.isArray(a)?k=y(N,F,_):k=V?a:jue(a,O,F),S.syncStepValue(k,F),R.createElement(Lue,{showLabels:!E,points:o},r.children,R.createElement(Due,{points:L,baseLine:k,needClip:e,clipPathId:n,props:r,animationElapsedTime:F,isAnimating:E||F<1,isEntrance:V}),R.createElement(kae,{label:r.label}))})}function Fue(t){var e=t.needClip,n=t.clipPathId,r=t.props,i=R.useRef(null),s=R.useRef();return R.createElement(Uue,{needClip:e,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:s})}class zue 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,E=due(r),T=E.r,C=E.strokeWidth,O=_H(r),N=T*2+C,L=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(uue,{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(Fue,{needClip:l,clipPathId:w,props:this.props})),R.createElement(i3,{points:i,mainColor:Xw(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:L}),this.props.isRange&&Array.isArray(x)&&R.createElement(i3,{points:x,mainColor:Xw(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:L}))}}function Bue(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,_=VH(t,Aue),w=Hg(),E=QB(),T=DH(x,S),C=T.needClip,O=Qs(),N=(e=zt(pe=>vue(pe,t.id,O)))!==null&&e!==void 0?e:{},L=N.points,F=N.isRange,V=N.baseLine,k=tR();if(w!=="horizontal"&&w!=="vertical"||k==null||E!=="AreaChart"&&E!=="ComposedChart")return null;var U=k.height,H=k.width,ne=k.x,te=k.y;return!L||!L.length?null:R.createElement(zue,$w({},_,{activeDot:n,animationBegin:r,animationDuration:i,animationEasing:s,baseLine:V,connectNulls:o,dot:a,fill:l,fillOpacity:c,height:U,hide:d,layout:w,isAnimationActive:f,isRange:F,legendType:m,needClip:C,points:L,stroke:y,width:H,left:ne,top:te,xAxisId:x,yAxisId:S}))}var Hue=(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 Vue(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,_=Hue(o,a,r,l,c),w=o==="horizontal",E=!1,T=d.map((O,N)=>{var L,F,V,k;if(S)k=s[f+N];else{var U=yi(O,i);Array.isArray(U)?(k=U,E=!0):k=[_,U]}var H=(L=(F=k)===null||F===void 0?void 0:F[1])!==null&&L!==void 0?L:null,ne=H==null||S&&!n&&yi(O,i)==null;if(w){var te;return{x:lk({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:lk({axis:c,ticks:y,bandSize:x,entry:O,index:N}),value:k,payload:O}}),C;return S||E?C=T.map(O=>{var N,L=Array.isArray(O.value)?O.value[0]:null;if(w){var F;return{x:O.x,y:L!=null&&O.y!=null&&(F=c.scale.map(L))!==null&&F!==void 0?F:null,payload:O.payload}}return{x:L!=null&&(N=l.scale.map(L))!==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:E}}function Gue(t){var e=Jo(t,GH),n=Qs();return R.createElement(yle,{id:e.id,type:"area"},r=>R.createElement(R.Fragment,null,R.createElement($ae,{legendPayload:Iue(e)}),R.createElement(kue,{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(Ele,{type:"area",id:r,data:e.data,dataKey:e.dataKey,xAxisId:e.xAxisId,yAxisId:e.yAxisId,zAxisId:0,stackId:TY(e.stackId),hide:e.hide,barSize:void 0,baseValue:e.baseValue,isPanorama:n,connectNulls:e.connectNulls}),R.createElement(Bue,$w({},e,{id:r}))))}var WH=R.memo(Gue,xS);WH.displayName="Area";var Wue=["domain","range"],$ue=["domain","range"];function p3(t,e){if(t==null)return{};var n,r,i=Xue(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r{if(o!=null)return v3(v3({},s),{},{type:o})},[s,o]);return R.useLayoutEffect(()=>{a!=null&&(n.current===null?e(Fle(a)):n.current!==a&&e(zle({prev:n.current,next:a})),n.current=a)},[a,e]),R.useLayoutEffect(()=>()=>{n.current&&(e(Ble(n.current)),n.current=null)},[e]),null}var nde=t=>{var e=t.xAxisId,n=t.className,r=zt(v4),i=Qs(),s="xAxis",o=zt(m=>TB(m,s,e,i)),a=zt(m=>Dre(m,e)),l=zt(m=>Hre(m,e)),c=zt(m=>Gz(m,e));if(a==null||l==null||c==null)return null;t.dangerouslySetInnerHTML,t.ticks,t.scale;var d=OC(t,Kue);c.id,c.scale;var f=OC(c,Yue);return R.createElement(rR,kC({},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}))},rde={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},ide=t=>{var e=Jo(t,rde);return R.createElement(R.Fragment,null,R.createElement(tde,{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(nde,e))},XH=R.memo(ide,$H);XH.displayName="XAxis";var sde=["type"],ode=["dangerouslySetInnerHTML","ticks","scale"],ade=["id","scale"];function LC(){return LC=Object.assign?Object.assign.bind():function(t){for(var e=1;e{if(o!=null)return x3(x3({},s),{},{type:o})},[o,s]);return R.useLayoutEffect(()=>{a!=null&&(n.current===null?e(Hle(a)):n.current!==a&&e(Vle({prev:n.current,next:a})),n.current=a)},[a,e]),R.useLayoutEffect(()=>()=>{n.current&&(e(Gle(n.current)),n.current=null)},[e]),null}function hde(t){var e=t.yAxisId,n=t.className,r=t.width,i=t.label,s=R.useRef(null),o=R.useRef(null),a=zt(v4),l=Qs(),c=Wr(),d="yAxis",f=zt(w=>Wre(w,e)),m=zt(w=>Gre(w,e)),y=zt(w=>TB(w,d,e,l)),x=zt(w=>Wz(w,e));if(R.useLayoutEffect(()=>{if(!(r!=="auto"||!f||Q2(i)||R.isValidElement(i)||x==null)){var w=s.current;if(w){var E=w.getCalculatedWidth();Math.round(f.width)!==Math.round(E)&&c(Wle({id:e,width:E}))}}},[y,f,c,i,e,r,x]),f==null||m==null||x==null)return null;t.dangerouslySetInnerHTML,t.ticks,t.scale;var S=DC(t,ode);x.id,x.scale;var _=DC(x,ade);return R.createElement(rR,LC({},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 pde={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},mde=t=>{var e=Jo(t,pde);return R.createElement(R.Fragment,null,R.createElement(fde,{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(hde,e))},qH=R.memo(mde,$H);qH.displayName="YAxis";var gde=(t,e)=>e,aR=Oe([gde,fr,sz,_i,$B,ou,hse,Gi],bse);function vde(t){return"getBBox"in t.currentTarget&&typeof t.currentTarget.getBBox=="function"}function lR(t){var e=t.currentTarget.getBoundingClientRect(),n,r;if(vde(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 KH=Eo("mouseClick"),YH=$0();YH.startListening({actionCreator:KH,effect:(t,e)=>{var n=t.payload,r=aR(e.getState(),lR(n));(r==null?void 0:r.activeIndex)!=null&&e.dispatch(oie({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var jC=Eo("mouseMove"),ZH=$0(),dm=null,Sf=null,GE=null;ZH.startListening({actionCreator:jC,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),GE=lR(n);var l=()=>{var c=e.getState(),d=sx(c,c.tooltip.settings.shared);if(!GE){dm=null,Sf=null;return}if(d==="axis"){var f=aR(c,GE);(f==null?void 0:f.activeIndex)!=null?e.dispatch(DB({activeIndex:f.activeIndex,activeDataKey:void 0,activeCoordinate:f.activeCoordinate})):e.dispatch(LB())}dm=null,Sf=null};if(!a){l();return}s==="raf"?dm=requestAnimationFrame(l):typeof s=="number"&&Sf===null&&(Sf=setTimeout(l,s))}});function yde(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?"<>":e}var b3={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},QH=cs({name:"rootProps",initialState:b3,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:b3.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}}}),xde=QH.reducer,bde=QH.actions.updateOptions,_de=null,wde={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)},JH=cs({name:"polarOptions",initialState:_de,reducers:wde});JH.actions.updatePolarOptions;var Sde=JH.reducer,eV=Eo("keyDown"),tV=Eo("focus"),nV=Eo("blur"),FS=$0(),fm=null,Mf=null,Ob=null;FS.startListening({actionCreator:eV,effect:(t,e)=>{Ob=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=Ob;if(f!=="ArrowRight"&&f!=="ArrowLeft"&&f!=="Enter")return;var m=Vy(d,Lh(l),Cg(l),Pg(l)),y=m==null?-1:Number(m),x=!Number.isFinite(y)||y<0,S=ou(l),_=Lh(l),w=sx(l,l.tooltip.settings.shared);if(f==="Enter"){if(x)return;var E=Bw(l,w,"hover",String(d.index));e.dispatch(zw({active:!d.active,activeIndex:d.index,activeCoordinate:E}));return}var T=Yre(l),C=T==="left-to-right"?1:-1,O=f==="ArrowRight"?1:-1,N;if(x){var L=Cg(l),F=Pg(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 U=0;U<_.length;U++)if(Vy(k(U),_,L,F)!=null){N=U;break}}else for(var H=_.length-1;H>=0;H--)if(Vy(k(H),_,L,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=Bw(l,w,"hover",String(N));e.dispatch(zw({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(),Ob=null,Mf=setTimeout(()=>{Ob?a():(Mf=null,fm=null)},i))}});FS.startListening({actionCreator:tV,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=sx(n,n.tooltip.settings.shared),a=Bw(n,o,"hover",String(s));e.dispatch(zw({active:!0,activeIndex:s,activeCoordinate:a}))}}}});FS.startListening({actionCreator:nV,effect:(t,e)=>{var n=e.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var i=n.tooltip.keyboardInteraction;i.active&&e.dispatch(zw({active:!1,activeIndex:i.index,activeCoordinate:i.coordinate}))}}});function rV(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 Bo=Eo("externalEvent"),iV=$0(),Lb=new Map,fy=new Map,WE=new Map;iV.startListening({actionCreator:Bo,effect:(t,e)=>{var n=t.payload,r=n.handler,i=n.reactEvent;if(r!=null){var s=i.type,o=rV(i);WE.set(s,{handler:r,reactEvent:o});var a=Lb.get(s);a!==void 0&&(cancelAnimationFrame(a),Lb.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=fy.get(s);x!==void 0&&(typeof d!="number"||!y)&&(clearTimeout(x),fy.delete(s));var S=()=>{var E=WE.get(s);try{if(!E)return;var T=E.handler,C=E.reactEvent,O=e.getState(),N={activeCoordinate:Qie(O),activeDataKey:Kie(O),activeIndex:_0(O),activeLabel:KB(O),activeTooltipIndex:_0(O),isTooltipActive:Jie(O)};T&&T(N,C)}finally{Lb.delete(s),fy.delete(s),WE.delete(s)}};if(!y){S();return}if(d==="raf"){var _=requestAnimationFrame(S);Lb.set(s,_)}else if(typeof d=="number"){if(!fy.has(s)){S();var w=setTimeout(S,d);fy.set(s,w)}}else S()}}});var Mde=Oe([Yg],t=>t.tooltipItemPayloads),Ede=Oe([Mde,(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)}}}),sV=Eo("touchMove"),oV=$0(),Ef=null,$u=null,_3=null,hy=null;oV.startListening({actionCreator:sV,effect:(t,e)=>{var n=t.payload;if(!(n.touches==null||n.touches.length===0)){hy=rV(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),_3=Array.from(n.touches).map(c=>lR({clientX:c.clientX,clientY:c.clientY,currentTarget:n.currentTarget}));var l=()=>{if(hy!=null){var c=e.getState(),d=sx(c,c.tooltip.settings.shared);if(d==="axis"){var f,m=(f=_3)===null||f===void 0?void 0:f[0];if(m==null){Ef=null,$u=null;return}var y=aR(c,m);(y==null?void 0:y.activeIndex)!=null&&e.dispatch(DB({activeIndex:y.activeIndex,activeDataKey:void 0,activeCoordinate:y.activeCoordinate}))}else if(d==="item"){var x,S=hy.touches[0];if(document.elementFromPoint==null||S==null)return;var _=document.elementFromPoint(S.clientX,S.clientY);if(!_||!_.getAttribute)return;var w=_.getAttribute(OY),E=(x=_.getAttribute(LY))!==null&&x!==void 0?x:void 0,T=Qh(c).find(N=>N.id===E);if(w==null||T==null||E==null)return;var C=T.dataKey,O=Ede(c,w,E);e.dispatch(sie({activeDataKey:C,activeIndex:w,activeCoordinate:O,activeGraphicalItemId:E}))}Ef=null,$u=null}};if(!a){l();return}s==="raf"?Ef=requestAnimationFrame(l):typeof s=="number"&&$u===null&&(l(),hy=null,$u=setTimeout(()=>{hy?l():($u=null,Ef=null)},s))}}});var aV={throttleDelay:"raf",throttledEvents:["mousemove","touchmove","pointermove","scroll","wheel"]},lV=cs({name:"eventSettings",initialState:aV,reducers:{setEventSettings:(t,e)=>{e.payload.throttleDelay!=null&&(t.throttleDelay=e.payload.throttleDelay),e.payload.throttledEvents!=null&&(t.throttledEvents=e.payload.throttledEvents)}}}),Ade=lV.actions.setEventSettings,Tde=lV.reducer,Cde=U5({brush:tce,cartesianAxis:$le,chartData:Zse,errorBars:cue,eventSettings:Tde,graphicalItems:Sle,layout:yY,legend:IZ,options:$se,polarAxis:Lae,polarOptions:Sde,referenceElements:sce,renderedTicks:Tce,rootProps:xde,tooltip:aie,zIndex:kse}),Pde=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return VK({reducer:Cde,preloadedState:e,middleware:r=>{var i;return r({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((i="es6")!==null&&i!==void 0?i:"")}).concat([YH.middleware,ZH.middleware,FS.middleware,iV.middleware,oV.middleware])},enhancers:r=>{var i=r;return typeof r=="function"&&(i=r()),i.concat(J5({type:"raf"}))},devTools:{serialize:{replacer:yde},name:"recharts-".concat(n)}})};function Rde(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=Pde(e,r));var o=jP;return R.createElement(qZ,{context:o,store:s.current},n)}function Nde(t){var e=t.layout,n=t.margin,r=Wr(),i=Qs();return R.useEffect(()=>{i||(r(mY(e)),r(pY(n)))},[r,i,e,n]),null}var Ide=R.memo(Nde,xS);function kde(t){var e=Wr();return R.useEffect(()=>{e(bde(t))},[e,t]),null}var Ode=t=>{var e=Wr();return R.useEffect(()=>{e(Ade(t))},[e,t]),null},Lde=R.memo(Ode,xS);function w3(t){var e=t.zIndex,n=t.isPanorama,r=R.useRef(null),i=Wr();return R.useLayoutEffect(()=>(r.current&&i(Nse({zIndex:e,element:r.current,isPanorama:n})),()=>{i(Ise({zIndex:e,isPanorama:n}))}),[i,e,n]),R.createElement("g",{tabIndex:-1,ref:r,className:"recharts-zIndex-layer_".concat(e)})}function S3(t){var e=t.children,n=t.isPanorama,r=zt(wse);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(w3,{key:o,zIndex:o,isPanorama:n})),e,s.map(o=>R.createElement(w3,{key:o,zIndex:o,isPanorama:n})))}var Dde=["children"];function jde(t,e){if(t==null)return{};var n,r,i=Ude(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r{var n=w4(),r=S4(),i=k4();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(n5,qw({},o,{title:a,desc:l,role:d,tabIndex:c,width:n,height:r,style:Fde,ref:e}),s)}),Bde=t=>{var e=t.children,n=zt(pS);if(!n)return null;var r=n.width,i=n.height,s=n.y,o=n.x;return R.createElement(n5,{width:r,height:i,x:o,y:s},e)},M3=R.forwardRef((t,e)=>{var n=t.children,r=jde(t,Dde),i=Qs();return i?R.createElement(Bde,null,R.createElement(S3,{isPanorama:!0},n)):R.createElement(zde,qw({ref:e},r),R.createElement(S3,{isPanorama:!1},n))});function Hde(t,e){return $de(t)||Wde(t,e)||Gde(t,e)||Vde()}function Vde(){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 Gde(t,e){if(t){if(typeof t=="string")return E3(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)?E3(t,e):void 0}}function E3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{if(r!=null){var o=r.getBoundingClientRect(),a=o.width/r.offsetWidth;wn(a)&&a!==s&&t(vY(a))}},[r,t,s]),i}function A3(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 qde(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n(ooe(),null);function Yw(t){if(typeof t=="number")return t;if(typeof t=="string"){var e=parseFloat(t);if(!Number.isNaN(e))return e}return 0}var rfe=R.forwardRef((t,e)=>{var n,r,i=R.useRef(null),s=R.useState({containerWidth:Yw((n=t.style)===null||n===void 0?void 0:n.width),containerHeight:Yw((r=t.style)===null||r===void 0?void 0:r.height)}),o=Kw(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 E=w[0];if(E!=null){var T=E.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(q0,{width:a.containerWidth,height:a.containerHeight}),R.createElement("div",Sd({ref:d},t)))}),ife=R.forwardRef((t,e)=>{var n=t.width,r=t.height,i=R.useState({containerWidth:Yw(n),containerHeight:Yw(r)}),s=Kw(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(q0,{width:o.containerWidth,height:o.containerHeight}),R.createElement("div",Sd({ref:c},t)))}),sfe=R.forwardRef((t,e)=>{var n=t.width,r=t.height;return R.createElement(R.Fragment,null,R.createElement(q0,{width:n,height:r}),R.createElement("div",Sd({ref:e},t)))}),ofe=R.forwardRef((t,e)=>{var n=t.width,r=t.height;return typeof n=="string"||typeof r=="string"?R.createElement(ife,Sd({},t,{ref:e})):typeof n=="number"&&typeof r=="number"?R.createElement(sfe,Sd({},t,{width:n,height:r,ref:e})):R.createElement(R.Fragment,null,R.createElement(q0,{width:n,height:r}),R.createElement("div",Sd({ref:e},t)))});function afe(t){return t?rfe:ofe}var lfe=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,E=t.responsive,T=t.dispatchTouchEvents,C=T===void 0?!0:T,O=R.useRef(null),N=Wr(),L=R.useState(null),F=Kw(L,2),V=F[0],k=F[1],U=R.useState(null),H=Kw(U,2),ne=H[0],te=H[1],pe=Xde(),oe=GP(),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(je=>{pe(je),typeof e=="function"&&e(je),k(je),te(je),je!=null&&(O.current=je)},[pe,e,k,te]),q=R.useCallback(je=>{N(KH(je)),N(Bo({handler:s,reactEvent:je}))},[N,s]),$=R.useCallback(je=>{N(jC(je)),N(Bo({handler:c,reactEvent:je}))},[N,c]),Z=R.useCallback(je=>{N(LB()),N(Bo({handler:d,reactEvent:je}))},[N,d]),ge=R.useCallback(je=>{N(jC(je)),N(Bo({handler:f,reactEvent:je}))},[N,f]),ae=R.useCallback(()=>{N(tV())},[N]),fe=R.useCallback(()=>{N(nV())},[N]),_e=R.useCallback(je=>{N(eV(je.key))},[N]),Se=R.useCallback(je=>{N(Bo({handler:o,reactEvent:je}))},[N,o]),$e=R.useCallback(je=>{N(Bo({handler:a,reactEvent:je}))},[N,a]),Me=R.useCallback(je=>{N(Bo({handler:l,reactEvent:je}))},[N,l]),He=R.useCallback(je=>{N(Bo({handler:m,reactEvent:je}))},[N,m]),Xe=R.useCallback(je=>{N(Bo({handler:S,reactEvent:je}))},[N,S]),ue=R.useCallback(je=>{C&&N(sV(je)),N(Bo({handler:x,reactEvent:je}))},[N,C,x]),Q=R.useCallback(je=>{N(Bo({handler:y,reactEvent:je}))},[N,y]),Ge=afe(E);return R.createElement(rH.Provider,{value:V},R.createElement(wX.Provider,{value:ne},R.createElement(Ge,{width:ce??(_==null?void 0:_.width),height:B??(_==null?void 0:_.height),className:er("recharts-wrapper",r),style:qde({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(nfe,null),n)))}),cfe=["width","height","responsive","children","className","style","compact","title","desc"];function ufe(t,e){if(t==null)return{};var n,r,i=dfe(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r{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=ufe(t,cfe),m=Fa(f);return l?R.createElement(R.Fragment,null,R.createElement(q0,{width:n,height:r}),R.createElement(M3,{otherAttributes:m,title:c,desc:d},s)):R.createElement(lfe,{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(M3,{otherAttributes:m,title:c,desc:d,ref:e},R.createElement(fce,null,s)))});function UC(){return UC=Object.assign?Object.assign.bind():function(t){for(var e=1;eR.createElement(xfe,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:bfe,tooltipPayloadSearcher:Gse,categoricalChartProps:t,ref:e}));const wfe="rgba(130,130,150,0.14)",P3="rgba(130,130,150,0.85)";function Sfe(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 cV(t,e){return`${e==="%"?Math.round(t):t>=1e3?`${(t/1e3).toFixed(1)}k`:Math.round(t).toString()}${e}`}function Mfe({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:cV(r.value,n)})]},r.dataKey))})})}function uV({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(Sfe(s*1.15),10);return v.jsx("div",{style:{height:i},className:"w-full",children:v.jsx(pZ,{width:"100%",height:"100%",children:v.jsxs(_fe,{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(OH,{vertical:!1,stroke:wfe}),v.jsx(XH,{dataKey:"t",hide:!0}),v.jsx(qH,{domain:[0,o],ticks:[0,o/2,o],tickFormatter:a=>cV(a,n),width:42,axisLine:!1,tickLine:!1,tick:{fontSize:10,fill:P3}}),v.jsx(xoe,{content:v.jsx(Mfe,{unit:n}),cursor:{stroke:P3,strokeOpacity:.4,strokeDasharray:"3 3"}}),e.map(a=>v.jsx(WH,{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 Efe=[{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 Afe(){var o,a,l,c;const{sys:t,hist:e}=dX(),n=!!(t!=null&&t.gpu&&t.gpu.busy_percent!=null&&t.gpu.gtt_used!=null&&t.gpu.gtt_total!=null),r=Efe.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(uV,{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 Db({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 Tfe(){var n;const{data:t}=TP(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(r9,{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(Db,{label:"OS-Pakete",tone:t.os>0?"alert":"muted",value:t.os>0?`${t.os} verfügbar`:"aktuell"}),v.jsx(Db,{label:"Engine (llama.cpp)",tone:t.engine>0?"alert":"muted",value:t.engine>0?"Update verfügbar":"aktuell"}),v.jsx(Db,{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(Db,{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(iF,{className:"h-3.5 w-3.5"})]})]})}function dV({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 Jg(){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(dV,{...t}):null;return{showAlert:r,showConfirm:i,showPrompt:s,close:n,dialogElement:o}}function Cfe(){const t=$h(),{data:e}=AP(3e3),{data:n}=qh(),{showAlert:r,dialogElement:i}=Jg(),[s,o]=R.useState(!1),a=(n==null?void 0:n.models)??[];async function l(c){try{await Ut("/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:wg(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(yg,{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(G1,{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(tw,{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(bo,{className:"h-4 w-4 shrink-0 text-primary"})]},c)})})]})}),i]})}function Pfe(){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(G1,{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:ZF.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",PP(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 Rfe(){const t=$h(),{data:e=[]}=FT({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 Ut("/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(V1,{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(IT,{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 R3=[{key:"prompt",label:"Prompt",color:"#f59e0b"},{key:"completion",label:"Antwort",color:"#2dd4bf"}];function Nfe(){const{data:t}=EP(3e3),e=cX(),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(i0,{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:R3.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(uV,{data:e,series:R3,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 Ife(){const{data:t}=v7(3e3),{showAlert:e,dialogElement:n}=Jg(),[r,i]=R.useState({});async function s(o){i(a=>({...a,[o]:!0}));try{const a=await Ut("/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(bP,{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(Hy,{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:wg(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(yg,{className:"h-3 w-3"})," Engine"]}),v.jsxs("a",{href:wg(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(yg,{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 N3({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 kfe(){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(Afe,{}),v.jsx(Nfe,{}),v.jsx(sX,{})]}),v.jsxs("section",{children:[v.jsx(N3,{children:"Stack-Status"}),v.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[v.jsx(Pfe,{}),v.jsx(Ife,{})]})]}),v.jsxs("section",{children:[v.jsx(N3,{children:"Betrieb & Wissen"}),v.jsxs("div",{className:"grid gap-6 md:grid-cols-3",children:[v.jsx(Tfe,{}),v.jsx(Cfe,{}),v.jsx(Rfe,{})]})]})]})}function Ofe(){const t=$h(),{data:e=[]}=x7(2e3),{showAlert:n,dialogElement:r}=Jg();async function i(a){try{await Ut(`/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,"% • ",zT(a.done_bytes),"/",zT(a.total_bytes),a.eta_s?` • ETA ${M7(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 I3({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 Lfe({model:t,onClose:e,onChanged:n}){var S,_;const{data:r,isLoading:i}=w7(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 Ut(`/api/models/${encodeURIComponent(t.name)}/draft`,{method:"POST",body:JSON.stringify({draft_path:w})}),n(),e()}catch(E){l(String((E==null?void 0:E.message)||E)),o(null)}}const x=w=>{var E;return w?`${w.pre??"?"} · ${((E=w.n_vocab)==null?void 0:E.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(bo,{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(xg,{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 E=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",E&&"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:[Ho(w.size_bytes)," · Vocab: ",x(w.vocab)]})]}),T?E?v.jsxs("span",{className:"text-[9px] font-bold uppercase text-primary flex items-center gap-1 shrink-0",children:[v.jsx(bo,{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(xg,{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 Dfe(){var rt,ft,nn,qe,dt,Dt,jt,pt;const t=$h(),{data:e,isLoading:n,error:r}=qh(4e3),{data:i}=y7(4e3),{data:s}=GF(),{data:o}=TP(4e3),{data:a}=b7(),{data:l}=Y1(),{showAlert:c,showConfirm:d,showPrompt:f,dialogElement:m}=Jg(),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,E]=R.useState(null),[T,C]=R.useState(null),[O,N]=R.useState(null),[L,F]=R.useState(null),[V,k]=R.useState(!1),[U,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 Ut(`/api/models/${encodeURIComponent(de)}/load`,{method:"POST"}),_()}catch(J){c("Fehler",`Fehler beim Laden des Modells: ${J.message}`)}}async function Me(de){try{await Ut(`/api/models/${encodeURIComponent(de)}/unload`,{method:"POST"}),_()}catch(J){c("Fehler",`Fehler beim Entladen des Modells: ${J.message}`)}}async function He(){try{await Ut("/api/models/unload",{method:"POST"}),_()}catch(de){c("Fehler",`Fehler beim Entladen aller Modelle: ${de.message}`)}}async function Xe(de,J){try{await Ut(`/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),Ut(`/api/roles/${encodeURIComponent(de)}/recommend`).then(J=>N(J)).catch(()=>{})}async function Q(de,J){let Ae=null;try{Ae=await Ut(`/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 Ut(`/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 Ut(`/api/models/${encodeURIComponent(de)}`,{method:"DELETE"}),_()}catch(J){c("Fehler",`Fehler beim Löschen: ${J.message||J}`)}})}async function je(de,J,Ae,re){try{await Ut("/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?` +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 T3(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)?T3(t,e):void 0}}function T3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n(ooe(),null);function Yw(t){if(typeof t=="number")return t;if(typeof t=="string"){var e=parseFloat(t);if(!Number.isNaN(e))return e}return 0}var rfe=R.forwardRef((t,e)=>{var n,r,i=R.useRef(null),s=R.useState({containerWidth:Yw((n=t.style)===null||n===void 0?void 0:n.width),containerHeight:Yw((r=t.style)===null||r===void 0?void 0:r.height)}),o=Kw(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 E=w[0];if(E!=null){var T=E.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(q0,{width:a.containerWidth,height:a.containerHeight}),R.createElement("div",Sd({ref:d},t)))}),ife=R.forwardRef((t,e)=>{var n=t.width,r=t.height,i=R.useState({containerWidth:Yw(n),containerHeight:Yw(r)}),s=Kw(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(q0,{width:o.containerWidth,height:o.containerHeight}),R.createElement("div",Sd({ref:c},t)))}),sfe=R.forwardRef((t,e)=>{var n=t.width,r=t.height;return R.createElement(R.Fragment,null,R.createElement(q0,{width:n,height:r}),R.createElement("div",Sd({ref:e},t)))}),ofe=R.forwardRef((t,e)=>{var n=t.width,r=t.height;return typeof n=="string"||typeof r=="string"?R.createElement(ife,Sd({},t,{ref:e})):typeof n=="number"&&typeof r=="number"?R.createElement(sfe,Sd({},t,{width:n,height:r,ref:e})):R.createElement(R.Fragment,null,R.createElement(q0,{width:n,height:r}),R.createElement("div",Sd({ref:e},t)))});function afe(t){return t?rfe:ofe}var lfe=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,E=t.responsive,T=t.dispatchTouchEvents,C=T===void 0?!0:T,O=R.useRef(null),N=Wr(),L=R.useState(null),F=Kw(L,2),V=F[0],k=F[1],U=R.useState(null),H=Kw(U,2),ne=H[0],te=H[1],pe=Xde(),oe=GP(),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(je=>{pe(je),typeof e=="function"&&e(je),k(je),te(je),je!=null&&(O.current=je)},[pe,e,k,te]),q=R.useCallback(je=>{N(KH(je)),N(Bo({handler:s,reactEvent:je}))},[N,s]),$=R.useCallback(je=>{N(jC(je)),N(Bo({handler:c,reactEvent:je}))},[N,c]),Z=R.useCallback(je=>{N(LB()),N(Bo({handler:d,reactEvent:je}))},[N,d]),ge=R.useCallback(je=>{N(jC(je)),N(Bo({handler:f,reactEvent:je}))},[N,f]),ae=R.useCallback(()=>{N(tV())},[N]),fe=R.useCallback(()=>{N(nV())},[N]),_e=R.useCallback(je=>{N(eV(je.key))},[N]),Se=R.useCallback(je=>{N(Bo({handler:o,reactEvent:je}))},[N,o]),$e=R.useCallback(je=>{N(Bo({handler:a,reactEvent:je}))},[N,a]),Me=R.useCallback(je=>{N(Bo({handler:l,reactEvent:je}))},[N,l]),He=R.useCallback(je=>{N(Bo({handler:m,reactEvent:je}))},[N,m]),Xe=R.useCallback(je=>{N(Bo({handler:S,reactEvent:je}))},[N,S]),ue=R.useCallback(je=>{C&&N(sV(je)),N(Bo({handler:x,reactEvent:je}))},[N,C,x]),Q=R.useCallback(je=>{N(Bo({handler:y,reactEvent:je}))},[N,y]),Ge=afe(E);return R.createElement(rH.Provider,{value:V},R.createElement(wX.Provider,{value:ne},R.createElement(Ge,{width:ce??(_==null?void 0:_.width),height:B??(_==null?void 0:_.height),className:er("recharts-wrapper",r),style:qde({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(nfe,null),n)))}),cfe=["width","height","responsive","children","className","style","compact","title","desc"];function ufe(t,e){if(t==null)return{};var n,r,i=dfe(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r{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=ufe(t,cfe),m=za(f);return l?R.createElement(R.Fragment,null,R.createElement(q0,{width:n,height:r}),R.createElement(M3,{otherAttributes:m,title:c,desc:d},s)):R.createElement(lfe,{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(M3,{otherAttributes:m,title:c,desc:d,ref:e},R.createElement(fce,null,s)))});function UC(){return UC=Object.assign?Object.assign.bind():function(t){for(var e=1;eR.createElement(xfe,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:bfe,tooltipPayloadSearcher:Gse,categoricalChartProps:t,ref:e}));const wfe="rgba(130,130,150,0.14)",P3="rgba(130,130,150,0.85)";function Sfe(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 cV(t,e){return`${e==="%"?Math.round(t):t>=1e3?`${(t/1e3).toFixed(1)}k`:Math.round(t).toString()}${e}`}function Mfe({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:cV(r.value,n)})]},r.dataKey))})})}function uV({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(Sfe(s*1.15),10);return v.jsx("div",{style:{height:i},className:"w-full",children:v.jsx(pZ,{width:"100%",height:"100%",children:v.jsxs(_fe,{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(OH,{vertical:!1,stroke:wfe}),v.jsx(XH,{dataKey:"t",hide:!0}),v.jsx(qH,{domain:[0,o],ticks:[0,o/2,o],tickFormatter:a=>cV(a,n),width:42,axisLine:!1,tickLine:!1,tick:{fontSize:10,fill:P3}}),v.jsx(xoe,{content:v.jsx(Mfe,{unit:n}),cursor:{stroke:P3,strokeOpacity:.4,strokeDasharray:"3 3"}}),e.map(a=>v.jsx(WH,{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 Efe=[{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 Afe(){var o,a,l,c;const{sys:t,hist:e}=dX(),n=!!(t!=null&&t.gpu&&t.gpu.busy_percent!=null&&t.gpu.gtt_used!=null&&t.gpu.gtt_total!=null),r=Efe.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(uV,{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 Db({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 Tfe(){var n;const{data:t}=TP(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(r9,{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(Db,{label:"OS-Pakete",tone:t.os>0?"alert":"muted",value:t.os>0?`${t.os} verfügbar`:"aktuell"}),v.jsx(Db,{label:"Engine (llama.cpp)",tone:t.engine>0?"alert":"muted",value:t.engine>0?"Update verfügbar":"aktuell"}),v.jsx(Db,{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(Db,{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(iF,{className:"h-3.5 w-3.5"})]})]})}function dV({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 Jg(){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(dV,{...t}):null;return{showAlert:r,showConfirm:i,showPrompt:s,close:n,dialogElement:o}}function Cfe(){const t=$h(),{data:e}=AP(3e3),{data:n}=qh(),{showAlert:r,dialogElement:i}=Jg(),[s,o]=R.useState(!1),a=(n==null?void 0:n.models)??[];async function l(c){try{await Ut("/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:wg(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(yg,{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(G1,{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(tw,{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(bo,{className:"h-4 w-4 shrink-0 text-primary"})]},c)})})]})}),i]})}function Pfe(){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(G1,{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:ZF.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",PP(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 Rfe(){const t=$h(),{data:e=[]}=FT({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 Ut("/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(V1,{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(IT,{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 R3=[{key:"prompt",label:"Prompt",color:"#f59e0b"},{key:"completion",label:"Antwort",color:"#2dd4bf"}];function Nfe(){const{data:t}=EP(3e3),e=cX(),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(i0,{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:R3.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(uV,{data:e,series:R3,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 Ife(){const{data:t}=v7(3e3),{showAlert:e,dialogElement:n}=Jg(),[r,i]=R.useState({});async function s(o){i(a=>({...a,[o]:!0}));try{const a=await Ut("/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(bP,{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(Hy,{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:wg(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(yg,{className:"h-3 w-3"})," Engine"]}),v.jsxs("a",{href:wg(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(yg,{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 N3({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 kfe(){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(Afe,{}),v.jsx(Nfe,{}),v.jsx(sX,{})]}),v.jsxs("section",{children:[v.jsx(N3,{children:"Stack-Status"}),v.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[v.jsx(Pfe,{}),v.jsx(Ife,{})]})]}),v.jsxs("section",{children:[v.jsx(N3,{children:"Betrieb & Wissen"}),v.jsxs("div",{className:"grid gap-6 md:grid-cols-3",children:[v.jsx(Tfe,{}),v.jsx(Cfe,{}),v.jsx(Rfe,{})]})]})]})}function Ofe(){const t=$h(),{data:e=[]}=x7(2e3),{showAlert:n,dialogElement:r}=Jg();async function i(a){try{await Ut(`/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,"% • ",zT(a.done_bytes),"/",zT(a.total_bytes),a.eta_s?` • ETA ${M7(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 I3({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 Lfe({model:t,onClose:e,onChanged:n}){var S,_;const{data:r,isLoading:i}=w7(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 Ut(`/api/models/${encodeURIComponent(t.name)}/draft`,{method:"POST",body:JSON.stringify({draft_path:w})}),n(),e()}catch(E){l(String((E==null?void 0:E.message)||E)),o(null)}}const x=w=>{var E;return w?`${w.pre??"?"} · ${((E=w.n_vocab)==null?void 0:E.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(bo,{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(xg,{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 E=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",E&&"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:[Ho(w.size_bytes)," · Vocab: ",x(w.vocab)]})]}),T?E?v.jsxs("span",{className:"text-[9px] font-bold uppercase text-primary flex items-center gap-1 shrink-0",children:[v.jsx(bo,{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(xg,{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 Dfe(){var rt,ft,nn,qe,dt,Dt,jt,pt;const t=$h(),{data:e,isLoading:n,error:r}=qh(4e3),{data:i}=y7(4e3),{data:s}=GF(),{data:o}=TP(4e3),{data:a}=b7(),{data:l}=Y1(),{showAlert:c,showConfirm:d,showPrompt:f,dialogElement:m}=Jg(),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,E]=R.useState(null),[T,C]=R.useState(null),[O,N]=R.useState(null),[L,F]=R.useState(null),[V,k]=R.useState(!1),[U,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 Ut(`/api/models/${encodeURIComponent(de)}/load`,{method:"POST"}),_()}catch(J){c("Fehler",`Fehler beim Laden des Modells: ${J.message}`)}}async function Me(de){try{await Ut(`/api/models/${encodeURIComponent(de)}/unload`,{method:"POST"}),_()}catch(J){c("Fehler",`Fehler beim Entladen des Modells: ${J.message}`)}}async function He(){try{await Ut("/api/models/unload",{method:"POST"}),_()}catch(de){c("Fehler",`Fehler beim Entladen aller Modelle: ${de.message}`)}}async function Xe(de,J){try{await Ut(`/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),Ut(`/api/roles/${encodeURIComponent(de)}/recommend`).then(J=>N(J)).catch(()=>{})}async function Q(de,J){let Ae=null;try{Ae=await Ut(`/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 Ut(`/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 Ut(`/api/models/${encodeURIComponent(de)}`,{method:"DELETE"}),_()}catch(J){c("Fehler",`Fehler beim Löschen: ${J.message||J}`)}})}async function je(de,J,Ae,re){try{await Ut("/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 Ut("/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 Ut("/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 { @@ -565,7 +565,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho 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(nE,{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: ",Ho(ee)," Gewichte",Ee>0?` · ${Ho(Ee)} real belegt (inkl. KV)`:""," / ",Ho(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} (${Ho(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:Ho(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:()=>E(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:()=>E(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:()=>E(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:()=>E(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:()=>E(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"})]}),ZF.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:()=>E(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:[U?v.jsx(bo,{className:"h-3.5 w-3.5 text-emerald-400"}):v.jsx(ew,{className:"h-3.5 w-3.5"}),v.jsx("span",{children:U?"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"&&((jt=s.tools.zed)==null?void 0:jt.snippet),w==="continue"&&((pt=s.tools.continue)==null?void 0:pt.snippet)]})})]}),v.jsx("button",{onClick:()=>E(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",PP(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:Ho(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(bo,{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(nE,{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=CI(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(i0,{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(I3,{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(nE,{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:Ho(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(Y8,{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:EI(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:()=>je(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(kT,{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=CI(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: ",Ho(de.size_bytes)]}),v.jsx("span",{children:"•"}),v.jsxs("span",{children:["Kontext: ",EI(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(I3,{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(kT,{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}`:`${Ho(Le.size_bytes)} · ${Le.quant}`})]}),ut&&v.jsx(bo,{className:"h-4 w-4 shrink-0 text-primary"})]},Le.name)})]})]})})})(),L&&v.jsx(Lfe,{model:L,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`:"?"," · ",Ho(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(bo,{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 jfe(){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),E=["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 Ut(`/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 Ut(`/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 L(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 Ut(`/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 Ut("/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 U=(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=>L(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…"}),E.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(xg,{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 ${U}`,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(xg,{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(xP,{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 Ufe={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:V1},coder:{title:"Coden & Entwicklung",desc:"Autovervollständigung, Refactoring und Codegenerierung direkt in deiner IDE.",icon:sF},vision:{title:"Bilder & Vision",desc:"Verarbeitet Bilder, Screenshots und visuelle Diagramme in multimodalen Chats.",icon:RT},scout:{title:"Multimodal-Allrounder",desc:"Multimodaler Allrounder für schnelle Antworten, Übersetzungen und Alltag.",icon:PT}};function Ffe(){const{data:t,isLoading:e,error:n}=_7(),{data:r}=qh(),{data:i}=TP(),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(E=>({...E,[x]:"Starte..."}));try{await Ut("/api/models/install",{method:"POST",body:JSON.stringify({repo:x,role:S,quant:_,jinja:w})}),l(E=>({...E,[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(i9,{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=Ufe[x.role]||{title:x.title||x.role,desc:"Spezifisches Modell für diese Systemrolle.",icon:G1},_=S.icon,w=s.find(L=>L.role===x.role),E=i==null?void 0:i.model_list.find(L=>L.role===x.role),T=x.models.find(L=>L.repo===x.recommended)||x.models[0];if(!T)return null;const C=a[T.repo],O=x.models.filter(L=>L.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: ",zT(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(iX,{fit:T.fit})})]})}),v.jsx("div",{className:"pt-1",children:w?E?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: ",E.repo.split("/").pop()]})]}),v.jsxs("button",{onClick:()=>y(E.repo,x.role,T.quant||"Q4_K_M",T.caps.tools!=="no"),disabled:!!a[E.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[E.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(bo,{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(L=>({...L,[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(A8,{className:"h-3 w-3"}):v.jsx(M8,{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(L=>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:L.name,children:L.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: ",L.quant]}),v.jsx("span",{children:"•"}),v.jsx("span",{children:L.fit.text})]})]}),v.jsx("button",{onClick:()=>y(L.repo,x.role,L.quant||"Q4_K_M",L.caps.tools!=="no"),disabled:!!a[L.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[L.repo]||"Installieren"})]},L.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(xP,{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(jfe,{})})]})]})}function zfe(){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(Ofe,{}),v.jsx("div",{className:"transition-all duration-300",children:t==="cockpit"?v.jsx(Dfe,{}):v.jsx(Ffe,{})})]})}const Bfe={cline:"cline_settings.json",cursor:"Settings → Models",opencode:"opencode.jsonc",zed:"settings.json",continue:"~/.continue/config.json",claude_code:"~/.zshrc / env"};function k3({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(yP,{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(T8,{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(P8,{className:"h-3 w-3"})," ",t.detail]})}function O3({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(bo,{className:"h-3.5 w-3.5 text-emerald-400"}):v.jsx(ew,{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 Hfe(){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}=GF(l.toString()),{data:f,isLoading:m}=S7(),y=d?String(d):"";function x(E){e(E),E&&localStorage.setItem("mc_host",E)}function S(E){r(E),localStorage.setItem("mc_mcp_path",E)}const _=c==null?void 0:c.tools[i];async function w(E,T){T&&(await navigator.clipboard.writeText(T),a(E),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(F8,{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(iI,{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(k3,{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(iI,{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(V1,{className:"h-3.5 w-3.5"})," Leitung 2 — Gedächtnis"]}),v.jsx(k3,{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(j8,{className:"h-3.5 w-3.5 text-primary"})," Box LAN IP-Adresse"]}),v.jsx("input",{value:t,onChange:E=>x(E.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(L8,{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:E=>S(E.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(([E,T])=>v.jsx("button",{onClick:()=>s(E),className:nt("rounded-lg px-3 py-1.5 text-[11px] font-semibold tracking-wide transition-all cursor-pointer",i===E?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"border border-border/50 text-muted-foreground hover:text-foreground"),children:T.label},E))}),_&&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(oI,{className:"h-4 w-4 text-primary shrink-0 mt-0.5"}),v.jsx("span",{children:_.note})]}),v.jsx(O3,{tool:_,fileName:Bfe[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(oI,{className:"h-4 w-4 text-violet-400 shrink-0 mt-0.5"}),v.jsx("span",{children:c.memory.note})]}),v.jsx(O3,{tool:c.memory,fileName:"mcp.json",accent:"violet",copied:o==="memory",onCopy:()=>w("memory",c.memory.snippet)})]})]})]})}const Vfe="modulepreload",Gfe=function(t){return"/"+t},L3={},Wfe=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=Gfe(c),c in L3)return;L3[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":Vfe,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 $fe 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 Xfe=R.lazy(()=>Wfe(()=>import("./GraphView-C79Yg7_9.js"),[]).then(t=>({default:t.GraphView}))),D3=["identity","knowledge","rules","events"],j3=new Set(["auto","agent","hermes"]),$E={identity:{label:"Identität",icon:o9,bg:"bg-cyan-500/10",text:"text-cyan-400"},knowledge:{label:"Wissen",icon:s0,bg:"bg-indigo-500/10",text:"text-indigo-400"},rules:{label:"Regeln",icon:e9,bg:"bg-violet-500/10",text:"text-violet-400"},events:{label:"Ereignisse",icon:R8,bg:"bg-amber-500/10",text:"text-amber-400"}},U3={label:"Gedächtnis",icon:TT,bg:"bg-muted/10",text:"text-muted-foreground"},qfe={identity:"border-l-cyan-500/80",knowledge:"border-l-indigo-500/80",rules:"border-l-violet-500/80",events:"border-l-amber-500/80"},F3=`Hi Hermes! Lass uns ein kurzes Onboarding machen, damit du dich künftig an mich erinnerst. Stell mir nacheinander ein paar kurze Fragen zu: + `}),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(nE,{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: ",Ho(ee)," Gewichte",Ee>0?` · ${Ho(Ee)} real belegt (inkl. KV)`:""," / ",Ho(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} (${Ho(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:Ho(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:()=>E(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:()=>E(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:()=>E(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:()=>E(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:()=>E(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"})]}),ZF.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:()=>E(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:[U?v.jsx(bo,{className:"h-3.5 w-3.5 text-emerald-400"}):v.jsx(ew,{className:"h-3.5 w-3.5"}),v.jsx("span",{children:U?"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"&&((jt=s.tools.zed)==null?void 0:jt.snippet),w==="continue"&&((pt=s.tools.continue)==null?void 0:pt.snippet)]})})]}),v.jsx("button",{onClick:()=>E(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",PP(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:Ho(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(bo,{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(nE,{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=CI(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(i0,{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(I3,{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(nE,{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:Ho(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(Y8,{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:EI(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:()=>je(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(kT,{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=CI(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: ",Ho(de.size_bytes)]}),v.jsx("span",{children:"•"}),v.jsxs("span",{children:["Kontext: ",EI(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(I3,{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(kT,{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}`:`${Ho(Le.size_bytes)} · ${Le.quant}`})]}),ut&&v.jsx(bo,{className:"h-4 w-4 shrink-0 text-primary"})]},Le.name)})]})]})})})(),L&&v.jsx(Lfe,{model:L,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`:"?"," · ",Ho(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(bo,{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 jfe(){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),E=["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 Ut(`/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 Ut(`/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 L(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 Ut(`/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 Ut("/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 U=(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=>L(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…"}),E.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(xg,{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 ${U}`,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(xg,{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(xP,{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 Ufe={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:V1},coder:{title:"Coden & Entwicklung",desc:"Autovervollständigung, Refactoring und Codegenerierung direkt in deiner IDE.",icon:sF},vision:{title:"Bilder & Vision",desc:"Verarbeitet Bilder, Screenshots und visuelle Diagramme in multimodalen Chats.",icon:RT},scout:{title:"Multimodal-Allrounder",desc:"Multimodaler Allrounder für schnelle Antworten, Übersetzungen und Alltag.",icon:PT}};function Ffe(){const{data:t,isLoading:e,error:n}=_7(),{data:r}=qh(),{data:i}=TP(),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(E=>({...E,[x]:"Starte..."}));try{await Ut("/api/models/install",{method:"POST",body:JSON.stringify({repo:x,role:S,quant:_,jinja:w})}),l(E=>({...E,[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(i9,{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=Ufe[x.role]||{title:x.title||x.role,desc:"Spezifisches Modell für diese Systemrolle.",icon:G1},_=S.icon,w=s.find(L=>L.role===x.role),E=i==null?void 0:i.model_list.find(L=>L.role===x.role),T=x.models.find(L=>L.repo===x.recommended)||x.models[0];if(!T)return null;const C=a[T.repo],O=x.models.filter(L=>L.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: ",zT(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(iX,{fit:T.fit})})]})}),v.jsx("div",{className:"pt-1",children:w?E?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: ",E.repo.split("/").pop()]})]}),v.jsxs("button",{onClick:()=>y(E.repo,x.role,T.quant||"Q4_K_M",T.caps.tools!=="no"),disabled:!!a[E.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[E.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(bo,{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(L=>({...L,[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(A8,{className:"h-3 w-3"}):v.jsx(M8,{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(L=>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:L.name,children:L.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: ",L.quant]}),v.jsx("span",{children:"•"}),v.jsx("span",{children:L.fit.text})]})]}),v.jsx("button",{onClick:()=>y(L.repo,x.role,L.quant||"Q4_K_M",L.caps.tools!=="no"),disabled:!!a[L.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[L.repo]||"Installieren"})]},L.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(xP,{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(jfe,{})})]})]})}function zfe(){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(Ofe,{}),v.jsx("div",{className:"transition-all duration-300",children:t==="cockpit"?v.jsx(Dfe,{}):v.jsx(Ffe,{})})]})}const Bfe={cline:"cline_settings.json",cursor:"Settings → Models",opencode:"opencode.jsonc",zed:"settings.json",continue:"~/.continue/config.json",claude_code:"~/.zshrc / env"};function k3({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(yP,{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(T8,{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(P8,{className:"h-3 w-3"})," ",t.detail]})}function O3({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(bo,{className:"h-3.5 w-3.5 text-emerald-400"}):v.jsx(ew,{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 Hfe(){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}=GF(l.toString()),{data:f,isLoading:m}=S7(),y=d?String(d):"";function x(E){e(E),E&&localStorage.setItem("mc_host",E)}function S(E){r(E),localStorage.setItem("mc_mcp_path",E)}const _=c==null?void 0:c.tools[i];async function w(E,T){T&&(await navigator.clipboard.writeText(T),a(E),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(F8,{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(iI,{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(k3,{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(iI,{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(V1,{className:"h-3.5 w-3.5"})," Leitung 2 — Gedächtnis"]}),v.jsx(k3,{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(j8,{className:"h-3.5 w-3.5 text-primary"})," Box LAN IP-Adresse"]}),v.jsx("input",{value:t,onChange:E=>x(E.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(L8,{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:E=>S(E.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(([E,T])=>v.jsx("button",{onClick:()=>s(E),className:nt("rounded-lg px-3 py-1.5 text-[11px] font-semibold tracking-wide transition-all cursor-pointer",i===E?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"border border-border/50 text-muted-foreground hover:text-foreground"),children:T.label},E))}),_&&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(oI,{className:"h-4 w-4 text-primary shrink-0 mt-0.5"}),v.jsx("span",{children:_.note})]}),v.jsx(O3,{tool:_,fileName:Bfe[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(oI,{className:"h-4 w-4 text-violet-400 shrink-0 mt-0.5"}),v.jsx("span",{children:c.memory.note})]}),v.jsx(O3,{tool:c.memory,fileName:"mcp.json",accent:"violet",copied:o==="memory",onCopy:()=>w("memory",c.memory.snippet)})]})]})]})}const Vfe="modulepreload",Gfe=function(t){return"/"+t},L3={},Wfe=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=Gfe(c),c in L3)return;L3[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":Vfe,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 $fe 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 Xfe=R.lazy(()=>Wfe(()=>import("./GraphView-C6IMczS5.js"),[]).then(t=>({default:t.GraphView}))),D3=["identity","knowledge","rules","events"],j3=new Set(["auto","agent","hermes"]),$E={identity:{label:"Identität",icon:o9,bg:"bg-cyan-500/10",text:"text-cyan-400"},knowledge:{label:"Wissen",icon:s0,bg:"bg-indigo-500/10",text:"text-indigo-400"},rules:{label:"Regeln",icon:e9,bg:"bg-violet-500/10",text:"text-violet-400"},events:{label:"Ereignisse",icon:R8,bg:"bg-amber-500/10",text:"text-amber-400"}},U3={label:"Gedächtnis",icon:TT,bg:"bg-muted/10",text:"text-muted-foreground"},qfe={identity:"border-l-cyan-500/80",knowledge:"border-l-indigo-500/80",rules:"border-l-violet-500/80",events:"border-l-amber-500/80"},F3=`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, @@ -585,11 +585,11 @@ Frag immer nur eine Sache auf einmal und fass am Ende zusammen, was du dir gemer * @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},fV=0,FC=1,hV=2,Qfe=3,pV=0,zS=1,$y=2,ka=3,Dl=0,ss=1,xo=2,Wc=0,Sh=1,zC=2,BC=3,HC=4,mV=5,ud=100,gV=101,vV=102,yV=103,xV=104,bV=200,_V=201,wV=202,SV=203,Zw=204,Qw=205,MV=206,EV=207,AV=208,TV=209,CV=210,PV=211,RV=212,NV=213,IV=214,Jw=0,e1=1,t1=2,jh=3,n1=4,r1=5,i1=6,s1=7,ax=0,kV=1,OV=2,Cl=0,LV=1,DV=2,jV=3,cR=4,UV=5,FV=6,zV=7,VC="attached",BV="detached",BS=300,Jc=301,Cd=302,M0=303,E0=304,ev=306,Pd=1e3,wo=1001,Ng=1002,ri=1003,HS=1004,Jfe=1004,ih=1005,ehe=1005,Cr=1006,tg=1007,the=1007,qo=1008,nhe=1008,Ba=1009,uR=1010,dR=1011,Ig=1012,VS=1013,eu=1014,Zs=1015,tv=1016,GS=1017,WS=1018,Uh=1020,fR=35902,hR=1021,pR=1022,is=1023,mR=1024,gR=1025,Mh=1026,Fh=1027,$S=1028,lx=1029,vR=1030,XS=1031,rhe=1032,qS=1033,Xy=33776,qy=33777,Ky=33778,Yy=33779,o1=35840,a1=35841,l1=35842,c1=35843,u1=36196,d1=37492,f1=37496,h1=37808,p1=37809,m1=37810,g1=37811,v1=37812,y1=37813,x1=37814,b1=37815,_1=37816,w1=37817,S1=37818,M1=37819,E1=37820,A1=37821,Zy=36492,T1=36494,C1=36495,yR=36283,P1=36284,R1=36285,N1=36286,HV=2200,VV=2201,GV=2202,kg=2300,Og=2301,$_=2302,sh=2400,oh=2401,A0=2402,KS=2500,xR=2501,WV=0,bR=1,I1=2,$V=3200,XV=3201,ihe=3202,she=3203,lu=0,qV=1,Lc="",Ui="srgb",xi="srgb-linear",YS="display-p3",cx="display-p3-linear",T0="linear",Jn="srgb",C0="rec709",P0="p3",ohe=0,Kf=7680,ahe=7681,lhe=7682,che=7683,uhe=34055,dhe=34056,fhe=5386,hhe=512,phe=513,mhe=514,ghe=515,vhe=516,yhe=517,xhe=518,GC=519,KV=512,YV=513,ZV=514,_R=515,QV=516,JV=517,e6=518,t6=519,R0=35044,n6=35048,bhe=35040,_he=35045,whe=35049,She=35041,Mhe=35046,Ehe=35050,Ahe=35042,The="100",WC="300 es",Ml=2e3,N0=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>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 wR(t,e){return(t%e+e)%e}function Che(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)}function Phe(t,e,n){return t!==e?(n-t)/(e-t):0}function Qy(t,e,n){return(1-n)*t+n*e}function Rhe(t,e,n,r){return Qy(t,e,1-Math.exp(-n*r))}function Nhe(t,e=1){return e-Math.abs(wR(t,e*2)-e)}function Ihe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function khe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))}function Ohe(t,e){return t+Math.floor(Math.random()*(e-t+1))}function Lhe(t,e){return t+Math.random()*(e-t)}function Dhe(t){return t*(.5-Math.random())}function jhe(t){t!==void 0&&(z3=t);let e=z3+=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 Uhe(t){return t*Eh}function Fhe(t){return t*Lg}function zhe(t){return(t&t-1)===0&&t!==0}function Bhe(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function Hhe(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function Vhe(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:Lg,generateUUID:Mo,clamp:Ar,euclideanModulo:wR,mapLinear:Che,inverseLerp:Phe,lerp:Qy,damp:Rhe,pingpong:Nhe,smoothstep:Ihe,smootherstep:khe,randInt:Ohe,randFloat:Lhe,randFloatSpread:Dhe,seededRandom:jhe,degToRad:Uhe,radToDeg:Fhe,isPowerOfTwo:zhe,ceilPowerOfTwo:Bhe,floorPowerOfTwo:Hhe,setQuaternionFromProperEuler:Vhe,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],E=i[1],T=i[4],C=i[7],O=i[2],N=i[5],L=i[8];return s[0]=o*S+a*E+l*O,s[3]=o*_+a*T+l*N,s[6]=o*w+a*C+l*L,s[1]=c*S+d*E+f*O,s[4]=c*_+d*T+f*N,s[7]=c*w+d*C+f*L,s[2]=m*S+y*E+x*O,s[5]=m*_+y*T+x*N,s[8]=m*w+y*C+x*L,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(XE.makeScale(e,n)),this}rotate(e){return this.premultiply(XE.makeRotation(-e)),this}translate(e,n){return this.premultiply(XE.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 XE=new Xt;function r6(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}const Ghe={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function $m(t,e){return new Ghe[t](e)}function I0(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function i6(){const t=I0("canvas");return t.style.display="block",t}const B3={};function X_(t){t in B3||(B3[t]=!0,console.warn(t))}function Whe(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 $he(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 Xhe(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 H3=new Xt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),V3=new Xt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),py={[xi]:{transfer:T0,primaries:C0,luminanceCoefficients:[.2126,.7152,.0722],toReference:t=>t,fromReference:t=>t},[Ui]:{transfer:Jn,primaries:C0,luminanceCoefficients:[.2126,.7152,.0722],toReference:t=>t.convertSRGBToLinear(),fromReference:t=>t.convertLinearToSRGB()},[cx]:{transfer:T0,primaries:P0,luminanceCoefficients:[.2289,.6917,.0793],toReference:t=>t.applyMatrix3(V3),fromReference:t=>t.applyMatrix3(H3)},[YS]:{transfer:Jn,primaries:P0,luminanceCoefficients:[.2289,.6917,.0793],toReference:t=>t.convertSRGBToLinear().applyMatrix3(V3),fromReference:t=>t.applyMatrix3(H3).convertLinearToSRGB()}},qhe=new Set([xi,cx]),In={enabled:!0,_workingColorSpace:xi,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(t){if(!qhe.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=py[e].toReference,i=py[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 py[t].primaries},getTransfer:function(t){return t===Lc?T0:py[t].transfer},getLuminanceCoefficients:function(t,e=this._workingColorSpace){return t.fromArray(py[e].luminanceCoefficients)}};function ng(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function qE(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let hm;class s6{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=I0("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=I0("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;o0&&(r.userData=this.userData),n||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==BS)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 wo:e.x=e.x<0?0:1;break;case Ng: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 wo:e.y=e.y<0?0:1;break;case Ng: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=BS;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,L=(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=L/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=L/s,i=F/s),this.set(r,i,s,n),this}let E=Math.sqrt((_-x)*(_-x)+(f-S)*(f-S)+(m-d)*(m-d));return Math.abs(E)<.001&&(E=1),this.x=(_-x)/E,this.y=(f-S)/E,this.z=(m-d)/E,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 o6 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=0?1:-1,T=1-w*w;if(T>Number.EPSILON){const O=Math.sqrt(T),N=Math.atan2(O,w*E);_=Math.sin(_*N)/O,a=Math.sin(a*N)/O}const C=a*E;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 rMath.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(G3.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(G3.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 YE.copy(this).projectOnVector(e),this.sub(YE)}reflect(e){return this.sub(YE.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 YE=new X,G3=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=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(my),Fb.subVectors(this.max,my),pm.subVectors(e.a,my),mm.subVectors(e.b,my),gm.subVectors(e.c,my),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!ZE(n,pm,mm,gm,Fb)||(n=[1,0,0,0,1,0,0,0,1],!ZE(n,pm,mm,gm,Fb))?!1:(zb.crossVectors(Xu,qu),n=[zb.x,zb.y,zb.z],ZE(n,pm,mm,gm,Fb))}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,my=new X,Fb=new X,zb=new X,Cf=new X;function ZE(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 Jhe=new os,gy=new X,QE=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):Jhe.setFromPoints(e).getCenter(r);let i=0;for(let s=0,o=e.length;sthis.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;gy.subVectors(e,this.center);const n=gy.lengthSq();if(n>this.radius*this.radius){const r=Math.sqrt(n),i=(r-this.radius)*.5;this.center.addScaledVector(gy,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):(QE.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(gy.copy(e.center).add(QE)),this.expandByPoint(gy.copy(e.center).sub(QE))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Sc=new X,JE=new X,Bb=new X,Ku=new X,eA=new X,Hb=new X,tA=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){JE.copy(e).add(n).multiplyScalar(.5),Bb.copy(n).sub(e).normalize(),Ku.copy(this.origin).sub(JE);const s=e.distanceTo(n)*.5,o=-this.direction.dot(Bb),a=Ku.dot(this.direction),l=-Ku.dot(Bb),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(JE).addScaledVector(Bb,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=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=0?r:i,n)}intersectsBox(e){return this.intersectBox(e,Sc)!==null}intersectTriangle(e,n,r,i,s){eA.subVectors(n,e),Hb.subVectors(r,e),tA.crossVectors(eA,Hb);let o=this.direction.dot(tA),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(Hb.crossVectors(Ku,Hb));if(l<0)return null;const c=a*this.direction.dot(eA.cross(Ku));if(c<0||l+c>o)return null;const d=-a*Ku.dot(tA);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(epe,e,tpe)}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(),Vb.crossVectors(ho,Yu),i[0]=Yu.x,i[4]=Vb.x,i[8]=ho.x,i[1]=Yu.y,i[5]=Vb.y,i[9]=ho.y,i[2]=Yu.z,i[6]=Vb.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],E=r[3],T=r[7],C=r[11],O=r[15],N=i[0],L=i[4],F=i[8],V=i[12],k=i[1],U=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*L+a*U+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*L+f*U+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*L+S*U+_*pe+w*K,s[10]=x*F+S*H+_*oe+w*q,s[14]=x*V+S*ne+_*ce+w*$,s[3]=E*N+T*k+C*te+O*B,s[7]=E*L+T*U+C*pe+O*K,s[11]=E*F+T*H+C*oe+O*q,s[15]=E*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],E=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*E+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 L=1/N;return e[0]=E*L,e[1]=(S*m*s-f*_*s-S*i*y+r*_*y+f*i*w-r*m*w)*L,e[2]=(a*_*s-S*l*s+S*i*c-r*_*c-a*i*w+r*l*w)*L,e[3]=(f*l*s-a*m*s-f*i*c+r*m*c+a*i*y-r*l*y)*L,e[4]=T*L,e[5]=(d*_*s-x*m*s+x*i*y-n*_*y-d*i*w+n*m*w)*L,e[6]=(x*l*s-o*_*s-x*i*c+n*_*c+o*i*w-n*l*w)*L,e[7]=(o*m*s-d*l*s+d*i*c-n*m*c-o*i*y+n*l*y)*L,e[8]=C*L,e[9]=(x*f*s-d*S*s-x*r*y+n*S*y+d*r*w-n*f*w)*L,e[10]=(o*S*s-x*a*s+x*r*c-n*S*c-o*r*w+n*a*w)*L,e[11]=(d*a*s-o*f*s-d*r*c+n*f*c+o*r*y-n*a*y)*L,e[12]=O*L,e[13]=(d*S*i-x*f*i+x*r*m-n*S*m-d*r*_+n*f*_)*L,e[14]=(x*a*i-o*S*i-x*r*l+n*S*l+o*r*_-n*a*_)*L,e[15]=(o*f*i-d*a*i+d*r*l-n*f*l-o*r*m+n*a*m)*L,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,E=l*c,T=l*d,C=l*f,O=r.x,N=r.y,L=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]=(_+E)*N,i[7]=0,i[8]=(x+T)*L,i[9]=(_-E)*L,i[10]=(1-(m+S))*L,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===N0)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===N0)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,epe=new X(0,0,0),tpe=new X(1,1,1),Yu=new X,Vb=new X,ho=new X,W3=new Ct,$3=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 W3.makeRotationFromQuaternion(e),this.setFromRotationMatrix(W3,n,r)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return $3.setFromEuler(this),this.setFromQuaternion($3,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<>>0}enable(e){this.mask|=1<1){for(let n=0;n1){for(let r=0;r0&&(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;c0){i.children=[];for(let a=0;a0){i.animations=[];for(let a=0;a0&&(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;r0?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),rA.subVectors(e,n);const o=Na.dot(Na),a=Na.dot(Ec),l=Na.dot(rA),c=Ec.dot(Ec),d=Ec.dot(rA),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 aA.setScalar(0),lA.setScalar(0),cA.setScalar(0),aA.fromBufferAttribute(e,n),lA.fromBufferAttribute(e,r),cA.fromBufferAttribute(e,i),o.setScalar(0),o.addScaledVector(aA,s.x),o.addScaledVector(lA,s.y),o.addScaledVector(cA,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),iA.subVectors(e,r);const l=bm.dot(iA),c=_m.dot(iA);if(l<=0&&c<=0)return n.copy(r);sA.subVectors(e,i);const d=bm.dot(sA),f=_m.dot(sA);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);oA.subVectors(e,s);const y=bm.dot(oA),x=_m.dot(oA);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 Q3.subVectors(s,i),a=(f-d)/(f-d+(y-x)),n.copy(i).addScaledVector(Q3,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 a6={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},Wb={h:0,s:0,l:0};function uA(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=Ui){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=wR(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=uA(o,s,e+1/3),this.g=uA(o,s,e),this.b=uA(o,s,e-1/3)}return In.toWorkingColorSpace(this,i),this}setStyle(e,n=Ui){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=Ui){const r=a6[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=qE(e.r),this.g=qE(e.g),this.b=qE(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ui){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=Ui){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+(i0!=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!==Zw&&(r.blendSrc=this.blendSrc),this.blendDst!==Qw&&(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!==jh&&(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!==GC&&(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=ax,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=ape();function ape(){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 Fy(t){const e=t>>10;return Dc.uint32View[0]=Dc.mantissaTable[Dc.offsetTable[e]+(t&1023)]+Dc.exponentTable[e],Dc.floatView[0]}const lpe={toHalfFloat:Ws,fromHalfFloat:Fy},Hr=new X,$b=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=R0,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;i0&&(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;f0&&(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;m0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s(e.far-e.near)**2))&&(J3.copy(s).invert(),Pf.copy(e.ray).applyMatrix4(J3),!(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;xn.far?null:{distance:c,point:Qb.clone(),object:t}}function Jb(t,e,n,r,i,s,o,a,l,c){t.getVertexPosition(a,qb),t.getVertexPosition(l,Kb),t.getVertexPosition(c,Yb);const d=gpe(t,e,n,r,qb,Kb,Yb,tD);if(d){const f=new X;qs.getBarycoord(tD,qb,Kb,Yb,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(qb,Kb,Yb,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,E,T,C,O,N,L,F,V){const k=C/L,U=O/F,H=C/2,ne=O/2,te=N/2,pe=L+1,oe=F+1;let ce=0,B=0;const K=new X;for(let q=0;q0?1:-1,d.push(K.x,K.y,K.z),f.push(Z/L),f.push(1-q/F),ce+=1}}for(let q=0;q>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 wR(t,e){return(t%e+e)%e}function Che(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)}function Phe(t,e,n){return t!==e?(n-t)/(e-t):0}function Qy(t,e,n){return(1-n)*t+n*e}function Rhe(t,e,n,r){return Qy(t,e,1-Math.exp(-n*r))}function Nhe(t,e=1){return e-Math.abs(wR(t,e*2)-e)}function Ihe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function khe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))}function Ohe(t,e){return t+Math.floor(Math.random()*(e-t+1))}function Lhe(t,e){return t+Math.random()*(e-t)}function Dhe(t){return t*(.5-Math.random())}function jhe(t){t!==void 0&&(z3=t);let e=z3+=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 Uhe(t){return t*Eh}function Fhe(t){return t*Lg}function zhe(t){return(t&t-1)===0&&t!==0}function Bhe(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function Hhe(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function Vhe(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:Lg,generateUUID:Mo,clamp:Ar,euclideanModulo:wR,mapLinear:Che,inverseLerp:Phe,lerp:Qy,damp:Rhe,pingpong:Nhe,smoothstep:Ihe,smootherstep:khe,randInt:Ohe,randFloat:Lhe,randFloatSpread:Dhe,seededRandom:jhe,degToRad:Uhe,radToDeg:Fhe,isPowerOfTwo:zhe,ceilPowerOfTwo:Bhe,floorPowerOfTwo:Hhe,setQuaternionFromProperEuler:Vhe,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],E=i[1],T=i[4],C=i[7],O=i[2],N=i[5],L=i[8];return s[0]=o*S+a*E+l*O,s[3]=o*_+a*T+l*N,s[6]=o*w+a*C+l*L,s[1]=c*S+d*E+f*O,s[4]=c*_+d*T+f*N,s[7]=c*w+d*C+f*L,s[2]=m*S+y*E+x*O,s[5]=m*_+y*T+x*N,s[8]=m*w+y*C+x*L,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(XE.makeScale(e,n)),this}rotate(e){return this.premultiply(XE.makeRotation(-e)),this}translate(e,n){return this.premultiply(XE.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 XE=new Xt;function r6(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}const Ghe={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function $m(t,e){return new Ghe[t](e)}function I0(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function i6(){const t=I0("canvas");return t.style.display="block",t}const B3={};function X_(t){t in B3||(B3[t]=!0,console.warn(t))}function Whe(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 $he(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 Xhe(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 H3=new Xt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),V3=new Xt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),py={[xi]:{transfer:T0,primaries:C0,luminanceCoefficients:[.2126,.7152,.0722],toReference:t=>t,fromReference:t=>t},[Ui]:{transfer:Jn,primaries:C0,luminanceCoefficients:[.2126,.7152,.0722],toReference:t=>t.convertSRGBToLinear(),fromReference:t=>t.convertLinearToSRGB()},[cx]:{transfer:T0,primaries:P0,luminanceCoefficients:[.2289,.6917,.0793],toReference:t=>t.applyMatrix3(V3),fromReference:t=>t.applyMatrix3(H3)},[YS]:{transfer:Jn,primaries:P0,luminanceCoefficients:[.2289,.6917,.0793],toReference:t=>t.convertSRGBToLinear().applyMatrix3(V3),fromReference:t=>t.applyMatrix3(H3).convertLinearToSRGB()}},qhe=new Set([xi,cx]),In={enabled:!0,_workingColorSpace:xi,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(t){if(!qhe.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=py[e].toReference,i=py[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 py[t].primaries},getTransfer:function(t){return t===Lc?T0:py[t].transfer},getLuminanceCoefficients:function(t,e=this._workingColorSpace){return t.fromArray(py[e].luminanceCoefficients)}};function ng(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function qE(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let hm;class s6{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=I0("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=I0("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;o0&&(r.userData=this.userData),n||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==BS)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 wo:e.x=e.x<0?0:1;break;case Ng: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 wo:e.y=e.y<0?0:1;break;case Ng: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=BS;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,L=(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=L/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=L/s,i=F/s),this.set(r,i,s,n),this}let E=Math.sqrt((_-x)*(_-x)+(f-S)*(f-S)+(m-d)*(m-d));return Math.abs(E)<.001&&(E=1),this.x=(_-x)/E,this.y=(f-S)/E,this.z=(m-d)/E,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 o6 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=0?1:-1,T=1-w*w;if(T>Number.EPSILON){const O=Math.sqrt(T),N=Math.atan2(O,w*E);_=Math.sin(_*N)/O,a=Math.sin(a*N)/O}const C=a*E;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 rMath.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(G3.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(G3.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 YE.copy(this).projectOnVector(e),this.sub(YE)}reflect(e){return this.sub(YE.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 YE=new X,G3=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=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(my),Fb.subVectors(this.max,my),pm.subVectors(e.a,my),mm.subVectors(e.b,my),gm.subVectors(e.c,my),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!ZE(n,pm,mm,gm,Fb)||(n=[1,0,0,0,1,0,0,0,1],!ZE(n,pm,mm,gm,Fb))?!1:(zb.crossVectors(Xu,qu),n=[zb.x,zb.y,zb.z],ZE(n,pm,mm,gm,Fb))}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,my=new X,Fb=new X,zb=new X,Cf=new X;function ZE(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 Jhe=new os,gy=new X,QE=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):Jhe.setFromPoints(e).getCenter(r);let i=0;for(let s=0,o=e.length;sthis.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;gy.subVectors(e,this.center);const n=gy.lengthSq();if(n>this.radius*this.radius){const r=Math.sqrt(n),i=(r-this.radius)*.5;this.center.addScaledVector(gy,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):(QE.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(gy.copy(e.center).add(QE)),this.expandByPoint(gy.copy(e.center).sub(QE))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Sc=new X,JE=new X,Bb=new X,Ku=new X,eA=new X,Hb=new X,tA=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){JE.copy(e).add(n).multiplyScalar(.5),Bb.copy(n).sub(e).normalize(),Ku.copy(this.origin).sub(JE);const s=e.distanceTo(n)*.5,o=-this.direction.dot(Bb),a=Ku.dot(this.direction),l=-Ku.dot(Bb),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(JE).addScaledVector(Bb,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=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=0?r:i,n)}intersectsBox(e){return this.intersectBox(e,Sc)!==null}intersectTriangle(e,n,r,i,s){eA.subVectors(n,e),Hb.subVectors(r,e),tA.crossVectors(eA,Hb);let o=this.direction.dot(tA),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(Hb.crossVectors(Ku,Hb));if(l<0)return null;const c=a*this.direction.dot(eA.cross(Ku));if(c<0||l+c>o)return null;const d=-a*Ku.dot(tA);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(epe,e,tpe)}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(),Vb.crossVectors(ho,Yu),i[0]=Yu.x,i[4]=Vb.x,i[8]=ho.x,i[1]=Yu.y,i[5]=Vb.y,i[9]=ho.y,i[2]=Yu.z,i[6]=Vb.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],E=r[3],T=r[7],C=r[11],O=r[15],N=i[0],L=i[4],F=i[8],V=i[12],k=i[1],U=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*L+a*U+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*L+f*U+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*L+S*U+_*pe+w*K,s[10]=x*F+S*H+_*oe+w*q,s[14]=x*V+S*ne+_*ce+w*$,s[3]=E*N+T*k+C*te+O*B,s[7]=E*L+T*U+C*pe+O*K,s[11]=E*F+T*H+C*oe+O*q,s[15]=E*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],E=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*E+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 L=1/N;return e[0]=E*L,e[1]=(S*m*s-f*_*s-S*i*y+r*_*y+f*i*w-r*m*w)*L,e[2]=(a*_*s-S*l*s+S*i*c-r*_*c-a*i*w+r*l*w)*L,e[3]=(f*l*s-a*m*s-f*i*c+r*m*c+a*i*y-r*l*y)*L,e[4]=T*L,e[5]=(d*_*s-x*m*s+x*i*y-n*_*y-d*i*w+n*m*w)*L,e[6]=(x*l*s-o*_*s-x*i*c+n*_*c+o*i*w-n*l*w)*L,e[7]=(o*m*s-d*l*s+d*i*c-n*m*c-o*i*y+n*l*y)*L,e[8]=C*L,e[9]=(x*f*s-d*S*s-x*r*y+n*S*y+d*r*w-n*f*w)*L,e[10]=(o*S*s-x*a*s+x*r*c-n*S*c-o*r*w+n*a*w)*L,e[11]=(d*a*s-o*f*s-d*r*c+n*f*c+o*r*y-n*a*y)*L,e[12]=O*L,e[13]=(d*S*i-x*f*i+x*r*m-n*S*m-d*r*_+n*f*_)*L,e[14]=(x*a*i-o*S*i-x*r*l+n*S*l+o*r*_-n*a*_)*L,e[15]=(o*f*i-d*a*i+d*r*l-n*f*l-o*r*m+n*a*m)*L,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,E=l*c,T=l*d,C=l*f,O=r.x,N=r.y,L=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]=(_+E)*N,i[7]=0,i[8]=(x+T)*L,i[9]=(_-E)*L,i[10]=(1-(m+S))*L,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===N0)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===N0)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,epe=new X(0,0,0),tpe=new X(1,1,1),Yu=new X,Vb=new X,ho=new X,W3=new Ct,$3=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 W3.makeRotationFromQuaternion(e),this.setFromRotationMatrix(W3,n,r)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return $3.setFromEuler(this),this.setFromQuaternion($3,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<>>0}enable(e){this.mask|=1<1){for(let n=0;n1){for(let r=0;r0&&(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;c0){i.children=[];for(let a=0;a0){i.animations=[];for(let a=0;a0&&(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;r0?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),rA.subVectors(e,n);const o=Na.dot(Na),a=Na.dot(Ec),l=Na.dot(rA),c=Ec.dot(Ec),d=Ec.dot(rA),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 aA.setScalar(0),lA.setScalar(0),cA.setScalar(0),aA.fromBufferAttribute(e,n),lA.fromBufferAttribute(e,r),cA.fromBufferAttribute(e,i),o.setScalar(0),o.addScaledVector(aA,s.x),o.addScaledVector(lA,s.y),o.addScaledVector(cA,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),iA.subVectors(e,r);const l=bm.dot(iA),c=_m.dot(iA);if(l<=0&&c<=0)return n.copy(r);sA.subVectors(e,i);const d=bm.dot(sA),f=_m.dot(sA);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);oA.subVectors(e,s);const y=bm.dot(oA),x=_m.dot(oA);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 Q3.subVectors(s,i),a=(f-d)/(f-d+(y-x)),n.copy(i).addScaledVector(Q3,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 a6={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},Wb={h:0,s:0,l:0};function uA(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=Ui){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=wR(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=uA(o,s,e+1/3),this.g=uA(o,s,e),this.b=uA(o,s,e-1/3)}return In.toWorkingColorSpace(this,i),this}setStyle(e,n=Ui){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=Ui){const r=a6[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=qE(e.r),this.g=qE(e.g),this.b=qE(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ui){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=Ui){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+(i0!=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!==Zw&&(r.blendSrc=this.blendSrc),this.blendDst!==Qw&&(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!==jh&&(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!==GC&&(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=ax,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=ape();function ape(){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 Fy(t){const e=t>>10;return Dc.uint32View[0]=Dc.mantissaTable[Dc.offsetTable[e]+(t&1023)]+Dc.exponentTable[e],Dc.floatView[0]}const lpe={toHalfFloat:Ws,fromHalfFloat:Fy},Hr=new X,$b=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=R0,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;i0&&(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;f0&&(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;m0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s(e.far-e.near)**2))&&(J3.copy(s).invert(),Pf.copy(e.ray).applyMatrix4(J3),!(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;xn.far?null:{distance:c,point:Qb.clone(),object:t}}function Jb(t,e,n,r,i,s,o,a,l,c){t.getVertexPosition(a,qb),t.getVertexPosition(l,Kb),t.getVertexPosition(c,Yb);const d=gpe(t,e,n,r,qb,Kb,Yb,tD);if(d){const f=new X;qs.getBarycoord(tD,qb,Kb,Yb,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(qb,Kb,Yb,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,E,T,C,O,N,L,F,V){const k=C/L,U=O/F,H=C/2,ne=O/2,te=N/2,pe=L+1,oe=F+1;let ce=0,B=0;const K=new X;for(let q=0;q0?1:-1,d.push(K.x,K.y,K.z),f.push(Z/L),f.push(1-q/F),ce+=1}}for(let q=0;q0&&(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 ux 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,nD=new Ve,rD=new Ve;class Tr extends ux{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=Lg*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Eh*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Lg*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,nD,rD),n.subVectors(rD,nD)}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 c6 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===N0)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 dx 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 u6 extends Ha{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 dx(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:` +}`;class Qo extends Gr{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=ype,this.fragmentShader=xpe,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=Dg(e.uniforms),this.uniformsGroups=vpe(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 ux 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,nD=new Ve,rD=new Ve;class Tr extends ux{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=Lg*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Eh*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Lg*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,nD,rD),n.subVectors(rD,nD)}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 c6 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===N0)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 dx 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 u6 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 dx(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; @@ -4167,7 +4167,7 @@ void main() { #include #include #include -}`,hn={alphahash_fragment:Spe,alphahash_pars_fragment:Mpe,alphamap_fragment:Epe,alphamap_pars_fragment:Ape,alphatest_fragment:Tpe,alphatest_pars_fragment:Cpe,aomap_fragment:Ppe,aomap_pars_fragment:Rpe,batching_pars_vertex:Npe,batching_vertex:Ipe,begin_vertex:kpe,beginnormal_vertex:Ope,bsdfs:Lpe,iridescence_fragment:Dpe,bumpmap_pars_fragment:jpe,clipping_planes_fragment:Upe,clipping_planes_pars_fragment:Fpe,clipping_planes_pars_vertex:zpe,clipping_planes_vertex:Bpe,color_fragment:Hpe,color_pars_fragment:Vpe,color_pars_vertex:Gpe,color_vertex:Wpe,common:$pe,cube_uv_reflection_fragment:Xpe,defaultnormal_vertex:qpe,displacementmap_pars_vertex:Kpe,displacementmap_vertex:Ype,emissivemap_fragment:Zpe,emissivemap_pars_fragment:Qpe,colorspace_fragment:Jpe,colorspace_pars_fragment:eme,envmap_fragment:tme,envmap_common_pars_fragment:nme,envmap_pars_fragment:rme,envmap_pars_vertex:ime,envmap_physical_pars_fragment:mme,envmap_vertex:sme,fog_vertex:ome,fog_pars_vertex:ame,fog_fragment:lme,fog_pars_fragment:cme,gradientmap_pars_fragment:ume,lightmap_pars_fragment:dme,lights_lambert_fragment:fme,lights_lambert_pars_fragment:hme,lights_pars_begin:pme,lights_toon_fragment:gme,lights_toon_pars_fragment:vme,lights_phong_fragment:yme,lights_phong_pars_fragment:xme,lights_physical_fragment:bme,lights_physical_pars_fragment:_me,lights_fragment_begin:wme,lights_fragment_maps:Sme,lights_fragment_end:Mme,logdepthbuf_fragment:Eme,logdepthbuf_pars_fragment:Ame,logdepthbuf_pars_vertex:Tme,logdepthbuf_vertex:Cme,map_fragment:Pme,map_pars_fragment:Rme,map_particle_fragment:Nme,map_particle_pars_fragment:Ime,metalnessmap_fragment:kme,metalnessmap_pars_fragment:Ome,morphinstance_vertex:Lme,morphcolor_vertex:Dme,morphnormal_vertex:jme,morphtarget_pars_vertex:Ume,morphtarget_vertex:Fme,normal_fragment_begin:zme,normal_fragment_maps:Bme,normal_pars_fragment:Hme,normal_pars_vertex:Vme,normal_vertex:Gme,normalmap_pars_fragment:Wme,clearcoat_normal_fragment_begin:$me,clearcoat_normal_fragment_maps:Xme,clearcoat_pars_fragment:qme,iridescence_pars_fragment:Kme,opaque_fragment:Yme,packing:Zme,premultiplied_alpha_fragment:Qme,project_vertex:Jme,dithering_fragment:ege,dithering_pars_fragment:tge,roughnessmap_fragment:nge,roughnessmap_pars_fragment:rge,shadowmap_pars_fragment:ige,shadowmap_pars_vertex:sge,shadowmap_vertex:oge,shadowmask_pars_fragment:age,skinbase_vertex:lge,skinning_pars_vertex:cge,skinning_vertex:uge,skinnormal_vertex:dge,specularmap_fragment:fge,specularmap_pars_fragment:hge,tonemapping_fragment:pge,tonemapping_pars_fragment:mge,transmission_fragment:gge,transmission_pars_fragment:vge,uv_pars_fragment:yge,uv_pars_vertex:xge,uv_vertex:bge,worldpos_vertex:_ge,background_vert:wge,background_frag:Sge,backgroundCube_vert:Mge,backgroundCube_frag:Ege,cube_vert:Age,cube_frag:Tge,depth_vert:Cge,depth_frag:Pge,distanceRGBA_vert:Rge,distanceRGBA_frag:Nge,equirect_vert:Ige,equirect_frag:kge,linedashed_vert:Oge,linedashed_frag:Lge,meshbasic_vert:Dge,meshbasic_frag:jge,meshlambert_vert:Uge,meshlambert_frag:Fge,meshmatcap_vert:zge,meshmatcap_frag:Bge,meshnormal_vert:Hge,meshnormal_frag:Vge,meshphong_vert:Gge,meshphong_frag:Wge,meshphysical_vert:$ge,meshphysical_frag:Xge,meshtoon_vert:qge,meshtoon_frag:Kge,points_vert:Yge,points_frag:Zge,shadow_vert:Qge,shadow_frag:Jge,sprite_vert:eve,sprite_frag:tve},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}}},La={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}};La.physical={uniforms:_s([La.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 t_={r:0,b:0,g:0},Nf=new as,nve=new Ct;function rve(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(E){let T=E.isScene===!0?E.background:null;return T&&T.isTexture&&(T=(E.backgroundBlurriness>0?n:e).get(T)),T}function S(E){let T=!1;const C=x(E);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 _(E,T){const C=x(T);C&&(C.isCubeTexture||C.mapping===ev)?(d===void 0&&(d=new yr(new ep(1,1,1),new Qo({name:"BackgroundCubeMaterial",uniforms:Dg(La.backgroundCube.uniforms),vertexShader:La.backgroundCube.vertexShader,fragmentShader:La.backgroundCube.fragmentShader,side:ss,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(O,N,L){this.matrixWorld.copyPosition(L.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(nve.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(),E.unshift(d,d.geometry,d.material,0,0,null)):C&&C.isTexture&&(c===void 0&&(c=new yr(new nv(2,2),new Qo({name:"BackgroundMaterial",uniforms:Dg(La.background.uniforms),vertexShader:La.background.vertexShader,fragmentShader:La.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(),E.unshift(c,c.geometry,c.material,0,0,null))}function w(E,T){E.getRGB(t_,l6(t)),r.buffers.color.setClear(t_.r,t_.g,t_.b,T,o)}return{getClearColor:function(){return a},setClearColor:function(E,T=1){a.set(E),l=T,w(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(E){l=E,w(a,l)},render:S,addToRenderList:_}}function ive(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),r={},i=m(null);let s=i,o=!1;function a(k,U,H,ne,te){let pe=!1;const oe=f(ne,H,U);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,U,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,U,H){const ne=H.wireframe===!0;let te=r[k.id];te===void 0&&(te={},r[k.id]=te);let pe=te[U.id];pe===void 0&&(pe={},te[U.id]=pe);let oe=pe[ne];return oe===void 0&&(oe=m(l()),pe[ne]=oe),oe}function m(k){const U=[],H=[],ne=[];for(let te=0;te=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,U,H,ne){const te={},pe=U.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 U=0,H=k.length;U=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===VS;if(K.isInterleavedBufferAttribute){const Se=K.data,$e=Se.stride,Me=K.offset;if(Se.isInstancedInterleavedBuffer){for(let He=0;He0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";L="mediump"}return L==="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 L=e.get("EXT_clip_control");L.clipControlEXT(L.LOWER_LEFT_EXT,L.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),E=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:E,maxVaryings:T,maxFragmentUniforms:C,vertexTextures:O,maxSamples:N}}function ave(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 E=s?0:r,T=E*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+=E}};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,E=m.matrixWorldInverse;a.getNormalMatrix(E),(_===null||_.length0){const c=new u6(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 ux{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,iD=[.125,.215,.35,.446,.526,.582],Zf=20,pA=new $c,sD=new ot;let mA=null,gA=0,vA=0,yA=!1;const Yf=(1+Math.sqrt(5))/2,Em=1/Yf,oD=[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 $C{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){mA=this._renderer.getRenderTarget(),gA=this._renderer.getActiveCubeFace(),vA=this._renderer.getActiveMipmapLevel(),yA=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=cD(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=lD(),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;e2?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=cD()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=lD());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;n_(n,0,0,3*l,2*l),r.setRenderTarget(n),r.render(o,pA)}_applyPMREM(e){const n=this._renderer,r=n.autoClear;n.autoClear=!1;const i=this._lodPlanes.length;for(let s=1;sZf&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${_} samples when the maximum is set to ${Zf}`);const w=[];let E=0;for(let L=0;LT-Xm?i-T+Xm:0),N=4*(this._cubeSize-C);n_(n,O,N,3*C,2*C),l.setRenderTarget(n),l.render(f,pA)}}function cve(t){const e=[],n=[],r=[];let i=t;const s=t-Xm+1+iD.length;for(let o=0;ot-Xm?l=iD[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,E=new Float32Array(S*x*y),T=new Float32Array(_*x*y),C=new Float32Array(w*x*y);for(let N=0;N2?0:-1,V=[L,F,0,L+2/3,F,0,L+2/3,F+1,0,L,F,0,L+2/3,F+1,0,L,F+1,0];E.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(E,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 aD(t,e,n){const r=new Ha(t,e,n);return r.texture.mapping=ev,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function n_(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function uve(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:TR(),fragmentShader:` +}`,hn={alphahash_fragment:Spe,alphahash_pars_fragment:Mpe,alphamap_fragment:Epe,alphamap_pars_fragment:Ape,alphatest_fragment:Tpe,alphatest_pars_fragment:Cpe,aomap_fragment:Ppe,aomap_pars_fragment:Rpe,batching_pars_vertex:Npe,batching_vertex:Ipe,begin_vertex:kpe,beginnormal_vertex:Ope,bsdfs:Lpe,iridescence_fragment:Dpe,bumpmap_pars_fragment:jpe,clipping_planes_fragment:Upe,clipping_planes_pars_fragment:Fpe,clipping_planes_pars_vertex:zpe,clipping_planes_vertex:Bpe,color_fragment:Hpe,color_pars_fragment:Vpe,color_pars_vertex:Gpe,color_vertex:Wpe,common:$pe,cube_uv_reflection_fragment:Xpe,defaultnormal_vertex:qpe,displacementmap_pars_vertex:Kpe,displacementmap_vertex:Ype,emissivemap_fragment:Zpe,emissivemap_pars_fragment:Qpe,colorspace_fragment:Jpe,colorspace_pars_fragment:eme,envmap_fragment:tme,envmap_common_pars_fragment:nme,envmap_pars_fragment:rme,envmap_pars_vertex:ime,envmap_physical_pars_fragment:mme,envmap_vertex:sme,fog_vertex:ome,fog_pars_vertex:ame,fog_fragment:lme,fog_pars_fragment:cme,gradientmap_pars_fragment:ume,lightmap_pars_fragment:dme,lights_lambert_fragment:fme,lights_lambert_pars_fragment:hme,lights_pars_begin:pme,lights_toon_fragment:gme,lights_toon_pars_fragment:vme,lights_phong_fragment:yme,lights_phong_pars_fragment:xme,lights_physical_fragment:bme,lights_physical_pars_fragment:_me,lights_fragment_begin:wme,lights_fragment_maps:Sme,lights_fragment_end:Mme,logdepthbuf_fragment:Eme,logdepthbuf_pars_fragment:Ame,logdepthbuf_pars_vertex:Tme,logdepthbuf_vertex:Cme,map_fragment:Pme,map_pars_fragment:Rme,map_particle_fragment:Nme,map_particle_pars_fragment:Ime,metalnessmap_fragment:kme,metalnessmap_pars_fragment:Ome,morphinstance_vertex:Lme,morphcolor_vertex:Dme,morphnormal_vertex:jme,morphtarget_pars_vertex:Ume,morphtarget_vertex:Fme,normal_fragment_begin:zme,normal_fragment_maps:Bme,normal_pars_fragment:Hme,normal_pars_vertex:Vme,normal_vertex:Gme,normalmap_pars_fragment:Wme,clearcoat_normal_fragment_begin:$me,clearcoat_normal_fragment_maps:Xme,clearcoat_pars_fragment:qme,iridescence_pars_fragment:Kme,opaque_fragment:Yme,packing:Zme,premultiplied_alpha_fragment:Qme,project_vertex:Jme,dithering_fragment:ege,dithering_pars_fragment:tge,roughnessmap_fragment:nge,roughnessmap_pars_fragment:rge,shadowmap_pars_fragment:ige,shadowmap_pars_vertex:sge,shadowmap_vertex:oge,shadowmask_pars_fragment:age,skinbase_vertex:lge,skinning_pars_vertex:cge,skinning_vertex:uge,skinnormal_vertex:dge,specularmap_fragment:fge,specularmap_pars_fragment:hge,tonemapping_fragment:pge,tonemapping_pars_fragment:mge,transmission_fragment:gge,transmission_pars_fragment:vge,uv_pars_fragment:yge,uv_pars_vertex:xge,uv_vertex:bge,worldpos_vertex:_ge,background_vert:wge,background_frag:Sge,backgroundCube_vert:Mge,backgroundCube_frag:Ege,cube_vert:Age,cube_frag:Tge,depth_vert:Cge,depth_frag:Pge,distanceRGBA_vert:Rge,distanceRGBA_frag:Nge,equirect_vert:Ige,equirect_frag:kge,linedashed_vert:Oge,linedashed_frag:Lge,meshbasic_vert:Dge,meshbasic_frag:jge,meshlambert_vert:Uge,meshlambert_frag:Fge,meshmatcap_vert:zge,meshmatcap_frag:Bge,meshnormal_vert:Hge,meshnormal_frag:Vge,meshphong_vert:Gge,meshphong_frag:Wge,meshphysical_vert:$ge,meshphysical_frag:Xge,meshtoon_vert:qge,meshtoon_frag:Kge,points_vert:Yge,points_frag:Zge,shadow_vert:Qge,shadow_frag:Jge,sprite_vert:eve,sprite_frag:tve},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 t_={r:0,b:0,g:0},Nf=new as,nve=new Ct;function rve(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(E){let T=E.isScene===!0?E.background:null;return T&&T.isTexture&&(T=(E.backgroundBlurriness>0?n:e).get(T)),T}function S(E){let T=!1;const C=x(E);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 _(E,T){const C=x(T);C&&(C.isCubeTexture||C.mapping===ev)?(d===void 0&&(d=new yr(new ep(1,1,1),new Qo({name:"BackgroundCubeMaterial",uniforms:Dg(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,L){this.matrixWorld.copyPosition(L.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(nve.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(),E.unshift(d,d.geometry,d.material,0,0,null)):C&&C.isTexture&&(c===void 0&&(c=new yr(new nv(2,2),new Qo({name:"BackgroundMaterial",uniforms:Dg(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(),E.unshift(c,c.geometry,c.material,0,0,null))}function w(E,T){E.getRGB(t_,l6(t)),r.buffers.color.setClear(t_.r,t_.g,t_.b,T,o)}return{getClearColor:function(){return a},setClearColor:function(E,T=1){a.set(E),l=T,w(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(E){l=E,w(a,l)},render:S,addToRenderList:_}}function ive(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),r={},i=m(null);let s=i,o=!1;function a(k,U,H,ne,te){let pe=!1;const oe=f(ne,H,U);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,U,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,U,H){const ne=H.wireframe===!0;let te=r[k.id];te===void 0&&(te={},r[k.id]=te);let pe=te[U.id];pe===void 0&&(pe={},te[U.id]=pe);let oe=pe[ne];return oe===void 0&&(oe=m(l()),pe[ne]=oe),oe}function m(k){const U=[],H=[],ne=[];for(let te=0;te=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,U,H,ne){const te={},pe=U.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 U=0,H=k.length;U=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===VS;if(K.isInterleavedBufferAttribute){const Se=K.data,$e=Se.stride,Me=K.offset;if(Se.isInstancedInterleavedBuffer){for(let He=0;He0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";L="mediump"}return L==="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 L=e.get("EXT_clip_control");L.clipControlEXT(L.LOWER_LEFT_EXT,L.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),E=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:E,maxVaryings:T,maxFragmentUniforms:C,vertexTextures:O,maxSamples:N}}function ave(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 E=s?0:r,T=E*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+=E}};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,E=m.matrixWorldInverse;a.getNormalMatrix(E),(_===null||_.length0){const c=new u6(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 ux{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,iD=[.125,.215,.35,.446,.526,.582],Zf=20,pA=new $c,sD=new ot;let mA=null,gA=0,vA=0,yA=!1;const Yf=(1+Math.sqrt(5))/2,Em=1/Yf,oD=[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 $C{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){mA=this._renderer.getRenderTarget(),gA=this._renderer.getActiveCubeFace(),vA=this._renderer.getActiveMipmapLevel(),yA=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=cD(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=lD(),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;e2?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=cD()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=lD());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;n_(n,0,0,3*l,2*l),r.setRenderTarget(n),r.render(o,pA)}_applyPMREM(e){const n=this._renderer,r=n.autoClear;n.autoClear=!1;const i=this._lodPlanes.length;for(let s=1;sZf&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${_} samples when the maximum is set to ${Zf}`);const w=[];let E=0;for(let L=0;LT-Xm?i-T+Xm:0),N=4*(this._cubeSize-C);n_(n,O,N,3*C,2*C),l.setRenderTarget(n),l.render(f,pA)}}function cve(t){const e=[],n=[],r=[];let i=t;const s=t-Xm+1+iD.length;for(let o=0;ot-Xm?l=iD[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,E=new Float32Array(S*x*y),T=new Float32Array(_*x*y),C=new Float32Array(w*x*y);for(let N=0;N2?0:-1,V=[L,F,0,L+2/3,F,0,L+2/3,F+1,0,L,F,0,L+2/3,F+1,0,L,F+1,0];E.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(E,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 aD(t,e,n){const r=new Va(t,e,n);return r.texture.mapping=ev,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function n_(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function uve(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:TR(),fragmentShader:` precision mediump float; precision mediump int; @@ -4346,7 +4346,7 @@ void main() { `;return t.precision==="highp"?e+=` #define HIGH_PRECISION`:t.precision==="mediump"?e+=` #define MEDIUM_PRECISION`:t.precision==="lowp"&&(e+=` -#define LOW_PRECISION`),e}function Sye(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===zS?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===$y?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===ka&&(e="SHADOWMAP_TYPE_VSM"),e}function Mye(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case Jc:case Cd:e="ENVMAP_TYPE_CUBE";break;case ev:e="ENVMAP_TYPE_CUBE_UV";break}return e}function Eye(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case Cd:e="ENVMAP_MODE_REFRACTION";break}return e}function Aye(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case ax:e="ENVMAP_BLENDING_MULTIPLY";break;case kV:e="ENVMAP_BLENDING_MIX";break;case OV:e="ENVMAP_BLENDING_ADD";break}return e}function Tye(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 Cye(t,e,n,r){const i=t.getContext(),s=n.defines;let o=n.vertexShader,a=n.fragmentShader;const l=Sye(n),c=Mye(n),d=Eye(n),f=Aye(n),m=Tye(n),y=mye(n),x=gye(s),S=i.createProgram();let _,w,E=n.glslVersion?"#version "+n.glslVersion+` +#define LOW_PRECISION`),e}function Sye(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===zS?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===$y?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===Oa&&(e="SHADOWMAP_TYPE_VSM"),e}function Mye(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case Jc:case Cd:e="ENVMAP_TYPE_CUBE";break;case ev:e="ENVMAP_TYPE_CUBE_UV";break}return e}function Eye(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case Cd:e="ENVMAP_MODE_REFRACTION";break}return e}function Aye(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case ax:e="ENVMAP_BLENDING_MULTIPLY";break;case kV:e="ENVMAP_BLENDING_MIX";break;case OV:e="ENVMAP_BLENDING_ADD";break}return e}function Tye(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 Cye(t,e,n,r){const i=t.getContext(),s=n.defines;let o=n.vertexShader,a=n.fragmentShader;const l=Sye(n),c=Mye(n),d=Eye(n),f=Aye(n),m=Tye(n),y=mye(n),x=gye(s),S=i.createProgram();let _,w,E=n.glslVersion?"#version "+n.glslVersion+` `:"";n.isRawShaderMaterial?(_=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x].filter(zy).join(` `),_.length>0&&(_+=` `),w=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x].filter(zy).join(` @@ -4367,7 +4367,7 @@ Material Type: `+U.type+` Program Info Log: `+H+` `+ce+` -`+B)}else H!==""?console.warn("THREE.WebGLProgram: Program Info Log:",H):(ne===""||te==="")&&(oe=!1);oe&&(U.diagnostics={runnable:pe,programLog:H,vertexShader:{log:ne,prefix:_},fragmentShader:{log:te,prefix:w}})}i.deleteShader(O),i.deleteShader(N),F=new q_(i,S),V=vye(i,S)}let F;this.getUniforms=function(){return F===void 0&&L(this),F};let V;this.getAttributes=function(){return V===void 0&&L(this),V};let k=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return k===!1&&(k=i.getProgramParameter(S,lye)),k},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(S),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=cye++,this.cacheKey=e,this.usedTimes=1,this.program=S,this.vertexShader=O,this.fragmentShader=N,this}let Pye=0;class Rye{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 Nye(e),n.set(e,r)),r}}class Nye{constructor(e){this.id=Pye++,this.code=e,this.usedTimes=0}}function Iye(t,e,n,r,i,s,o){const a=new Ah,l=new Rye,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,U,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===ev?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=La[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,je=!!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,jt=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:je,bumpMap:We,normalMap:Qe,displacementMap:y&&xt,emissiveMap:at,normalMapObjectSpace:Qe&&k.normalMapType===qV,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:jt,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:je&&_(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:jt&&_(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:U.directional.length,numPointLights:U.point.length,numSpotLights:U.spot.length,numSpotLightMaps:U.spotLightMap.length,numRectAreaLights:U.rectArea.length,numHemiLights:U.hemi.length,numDirLightShadows:U.directionalShadowMap.length,numPointLightShadows:U.pointShadowMap.length,numSpotLightShadows:U.spotShadowMap.length,numSpotLightShadowsWithMaps:U.numSpotLightShadowsWithMaps,numLightProbes:U.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 E(k){const U=[];if(k.shaderID?U.push(k.shaderID):(U.push(k.customVertexShaderID),U.push(k.customFragmentShaderID)),k.defines!==void 0)for(const H in k.defines)U.push(H),U.push(k.defines[H]);return k.isRawShaderMaterial===!1&&(T(U,k),C(U,k),U.push(t.outputColorSpace)),U.push(k.customProgramCacheKey),U.join()}function T(k,U){k.push(U.precision),k.push(U.outputColorSpace),k.push(U.envMapMode),k.push(U.envMapCubeUVHeight),k.push(U.mapUv),k.push(U.alphaMapUv),k.push(U.lightMapUv),k.push(U.aoMapUv),k.push(U.bumpMapUv),k.push(U.normalMapUv),k.push(U.displacementMapUv),k.push(U.emissiveMapUv),k.push(U.metalnessMapUv),k.push(U.roughnessMapUv),k.push(U.anisotropyMapUv),k.push(U.clearcoatMapUv),k.push(U.clearcoatNormalMapUv),k.push(U.clearcoatRoughnessMapUv),k.push(U.iridescenceMapUv),k.push(U.iridescenceThicknessMapUv),k.push(U.sheenColorMapUv),k.push(U.sheenRoughnessMapUv),k.push(U.specularMapUv),k.push(U.specularColorMapUv),k.push(U.specularIntensityMapUv),k.push(U.transmissionMapUv),k.push(U.thicknessMapUv),k.push(U.combine),k.push(U.fogExp2),k.push(U.sizeAttenuation),k.push(U.morphTargetsCount),k.push(U.morphAttributeCount),k.push(U.numDirLights),k.push(U.numPointLights),k.push(U.numSpotLights),k.push(U.numSpotLightMaps),k.push(U.numHemiLights),k.push(U.numRectAreaLights),k.push(U.numDirLightShadows),k.push(U.numPointLightShadows),k.push(U.numSpotLightShadows),k.push(U.numSpotLightShadowsWithMaps),k.push(U.numLightProbes),k.push(U.shadowMapType),k.push(U.toneMapping),k.push(U.numClippingPlanes),k.push(U.numClipIntersection),k.push(U.depthPacking)}function C(k,U){a.disableAll(),U.supportsVertexTextures&&a.enable(0),U.instancing&&a.enable(1),U.instancingColor&&a.enable(2),U.instancingMorph&&a.enable(3),U.matcap&&a.enable(4),U.envMap&&a.enable(5),U.normalMapObjectSpace&&a.enable(6),U.normalMapTangentSpace&&a.enable(7),U.clearcoat&&a.enable(8),U.iridescence&&a.enable(9),U.alphaTest&&a.enable(10),U.vertexColors&&a.enable(11),U.vertexAlphas&&a.enable(12),U.vertexUv1s&&a.enable(13),U.vertexUv2s&&a.enable(14),U.vertexUv3s&&a.enable(15),U.vertexTangents&&a.enable(16),U.anisotropy&&a.enable(17),U.alphaHash&&a.enable(18),U.batching&&a.enable(19),U.dispersion&&a.enable(20),U.batchingColor&&a.enable(21),k.push(a.mask),a.disableAll(),U.fog&&a.enable(0),U.useFog&&a.enable(1),U.flatShading&&a.enable(2),U.logarithmicDepthBuffer&&a.enable(3),U.reverseDepthBuffer&&a.enable(4),U.skinning&&a.enable(5),U.morphTargets&&a.enable(6),U.morphNormals&&a.enable(7),U.morphColors&&a.enable(8),U.premultipliedAlpha&&a.enable(9),U.shadowMapEnabled&&a.enable(10),U.doubleSided&&a.enable(11),U.flipSided&&a.enable(12),U.useDepthPacking&&a.enable(13),U.dithering&&a.enable(14),U.transmission&&a.enable(15),U.sheen&&a.enable(16),U.opaque&&a.enable(17),U.pointsUvs&&a.enable(18),U.decodeVideoTexture&&a.enable(19),U.alphaToCoverage&&a.enable(20),k.push(a.mask)}function O(k){const U=S[k.type];let H;if(U){const ne=La[U];H=AR.clone(ne.uniforms)}else H=k.uniforms;return H}function N(k,U){let H;for(let ne=0,te=d.length;ne0?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||Oye),r.length>1&&r.sort(m||SD),i.length>1&&i.sort(m||SD)}function d(){for(let f=e,m=t.length;f=s.length?(o=new MD,s.push(o)):o=s[i],o}function n(){t=new WeakMap}return{get:e,dispose:n}}function Dye(){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 jye(){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 Uye=0;function Fye(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function zye(t){const e=new Dye,n=jye(),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,E=0,T=0,C=0,O=0,N=0,L=0;c.sort(Fye);for(let V=0,k=c.length;V0&&(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!==E||F.numPointShadows!==T||F.numSpotShadows!==C||F.numSpotMaps!==O||F.numLightProbes!==L)&&(r.directional.length=y,r.spot.length=S,r.rectArea.length=_,r.point.length=x,r.hemi.length=w,r.directionalShadow.length=E,r.directionalShadowMap.length=E,r.pointShadow.length=T,r.pointShadowMap.length=T,r.spotShadow.length=C,r.spotShadowMap.length=C,r.directionalShadowMatrix.length=E,r.pointShadowMatrix.length=T,r.spotLightMatrix.length=C+O-N,r.spotLightMap.length=O,r.numSpotLightShadowsWithMaps=N,r.numLightProbes=L,F.directionalLength=y,F.pointLength=x,F.spotLength=S,F.rectAreaLength=_,F.hemiLength=w,F.numDirectionalShadows=E,F.numPointShadows=T,F.numSpotShadows=C,F.numSpotMaps=O,F.numLightProbes=L,r.version=Uye++)}function l(c,d){let f=0,m=0,y=0,x=0,S=0;const _=d.matrixWorldInverse;for(let w=0,E=c.length;w=o.length?(a=new ED(t),o.push(a)):a=o[s],a}function r(){e=new WeakMap}return{get:n,dispose:r}}class PR extends Gr{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=$V,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 RR 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 Hye=`void main() { +`+B)}else H!==""?console.warn("THREE.WebGLProgram: Program Info Log:",H):(ne===""||te==="")&&(oe=!1);oe&&(U.diagnostics={runnable:pe,programLog:H,vertexShader:{log:ne,prefix:_},fragmentShader:{log:te,prefix:w}})}i.deleteShader(O),i.deleteShader(N),F=new q_(i,S),V=vye(i,S)}let F;this.getUniforms=function(){return F===void 0&&L(this),F};let V;this.getAttributes=function(){return V===void 0&&L(this),V};let k=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return k===!1&&(k=i.getProgramParameter(S,lye)),k},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(S),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=cye++,this.cacheKey=e,this.usedTimes=1,this.program=S,this.vertexShader=O,this.fragmentShader=N,this}let Pye=0;class Rye{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 Nye(e),n.set(e,r)),r}}class Nye{constructor(e){this.id=Pye++,this.code=e,this.usedTimes=0}}function Iye(t,e,n,r,i,s,o){const a=new Ah,l=new Rye,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,U,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===ev?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,je=!!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,jt=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:je,bumpMap:We,normalMap:Qe,displacementMap:y&&xt,emissiveMap:at,normalMapObjectSpace:Qe&&k.normalMapType===qV,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:jt,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:je&&_(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:jt&&_(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:U.directional.length,numPointLights:U.point.length,numSpotLights:U.spot.length,numSpotLightMaps:U.spotLightMap.length,numRectAreaLights:U.rectArea.length,numHemiLights:U.hemi.length,numDirLightShadows:U.directionalShadowMap.length,numPointLightShadows:U.pointShadowMap.length,numSpotLightShadows:U.spotShadowMap.length,numSpotLightShadowsWithMaps:U.numSpotLightShadowsWithMaps,numLightProbes:U.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 E(k){const U=[];if(k.shaderID?U.push(k.shaderID):(U.push(k.customVertexShaderID),U.push(k.customFragmentShaderID)),k.defines!==void 0)for(const H in k.defines)U.push(H),U.push(k.defines[H]);return k.isRawShaderMaterial===!1&&(T(U,k),C(U,k),U.push(t.outputColorSpace)),U.push(k.customProgramCacheKey),U.join()}function T(k,U){k.push(U.precision),k.push(U.outputColorSpace),k.push(U.envMapMode),k.push(U.envMapCubeUVHeight),k.push(U.mapUv),k.push(U.alphaMapUv),k.push(U.lightMapUv),k.push(U.aoMapUv),k.push(U.bumpMapUv),k.push(U.normalMapUv),k.push(U.displacementMapUv),k.push(U.emissiveMapUv),k.push(U.metalnessMapUv),k.push(U.roughnessMapUv),k.push(U.anisotropyMapUv),k.push(U.clearcoatMapUv),k.push(U.clearcoatNormalMapUv),k.push(U.clearcoatRoughnessMapUv),k.push(U.iridescenceMapUv),k.push(U.iridescenceThicknessMapUv),k.push(U.sheenColorMapUv),k.push(U.sheenRoughnessMapUv),k.push(U.specularMapUv),k.push(U.specularColorMapUv),k.push(U.specularIntensityMapUv),k.push(U.transmissionMapUv),k.push(U.thicknessMapUv),k.push(U.combine),k.push(U.fogExp2),k.push(U.sizeAttenuation),k.push(U.morphTargetsCount),k.push(U.morphAttributeCount),k.push(U.numDirLights),k.push(U.numPointLights),k.push(U.numSpotLights),k.push(U.numSpotLightMaps),k.push(U.numHemiLights),k.push(U.numRectAreaLights),k.push(U.numDirLightShadows),k.push(U.numPointLightShadows),k.push(U.numSpotLightShadows),k.push(U.numSpotLightShadowsWithMaps),k.push(U.numLightProbes),k.push(U.shadowMapType),k.push(U.toneMapping),k.push(U.numClippingPlanes),k.push(U.numClipIntersection),k.push(U.depthPacking)}function C(k,U){a.disableAll(),U.supportsVertexTextures&&a.enable(0),U.instancing&&a.enable(1),U.instancingColor&&a.enable(2),U.instancingMorph&&a.enable(3),U.matcap&&a.enable(4),U.envMap&&a.enable(5),U.normalMapObjectSpace&&a.enable(6),U.normalMapTangentSpace&&a.enable(7),U.clearcoat&&a.enable(8),U.iridescence&&a.enable(9),U.alphaTest&&a.enable(10),U.vertexColors&&a.enable(11),U.vertexAlphas&&a.enable(12),U.vertexUv1s&&a.enable(13),U.vertexUv2s&&a.enable(14),U.vertexUv3s&&a.enable(15),U.vertexTangents&&a.enable(16),U.anisotropy&&a.enable(17),U.alphaHash&&a.enable(18),U.batching&&a.enable(19),U.dispersion&&a.enable(20),U.batchingColor&&a.enable(21),k.push(a.mask),a.disableAll(),U.fog&&a.enable(0),U.useFog&&a.enable(1),U.flatShading&&a.enable(2),U.logarithmicDepthBuffer&&a.enable(3),U.reverseDepthBuffer&&a.enable(4),U.skinning&&a.enable(5),U.morphTargets&&a.enable(6),U.morphNormals&&a.enable(7),U.morphColors&&a.enable(8),U.premultipliedAlpha&&a.enable(9),U.shadowMapEnabled&&a.enable(10),U.doubleSided&&a.enable(11),U.flipSided&&a.enable(12),U.useDepthPacking&&a.enable(13),U.dithering&&a.enable(14),U.transmission&&a.enable(15),U.sheen&&a.enable(16),U.opaque&&a.enable(17),U.pointsUvs&&a.enable(18),U.decodeVideoTexture&&a.enable(19),U.alphaToCoverage&&a.enable(20),k.push(a.mask)}function O(k){const U=S[k.type];let H;if(U){const ne=Da[U];H=AR.clone(ne.uniforms)}else H=k.uniforms;return H}function N(k,U){let H;for(let ne=0,te=d.length;ne0?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||Oye),r.length>1&&r.sort(m||SD),i.length>1&&i.sort(m||SD)}function d(){for(let f=e,m=t.length;f=s.length?(o=new MD,s.push(o)):o=s[i],o}function n(){t=new WeakMap}return{get:e,dispose:n}}function Dye(){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 jye(){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 Uye=0;function Fye(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function zye(t){const e=new Dye,n=jye(),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,E=0,T=0,C=0,O=0,N=0,L=0;c.sort(Fye);for(let V=0,k=c.length;V0&&(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!==E||F.numPointShadows!==T||F.numSpotShadows!==C||F.numSpotMaps!==O||F.numLightProbes!==L)&&(r.directional.length=y,r.spot.length=S,r.rectArea.length=_,r.point.length=x,r.hemi.length=w,r.directionalShadow.length=E,r.directionalShadowMap.length=E,r.pointShadow.length=T,r.pointShadowMap.length=T,r.spotShadow.length=C,r.spotShadowMap.length=C,r.directionalShadowMatrix.length=E,r.pointShadowMatrix.length=T,r.spotLightMatrix.length=C+O-N,r.spotLightMap.length=O,r.numSpotLightShadowsWithMaps=N,r.numLightProbes=L,F.directionalLength=y,F.pointLength=x,F.spotLength=S,F.rectAreaLength=_,F.hemiLength=w,F.numDirectionalShadows=E,F.numPointShadows=T,F.numSpotShadows=C,F.numSpotMaps=O,F.numLightProbes=L,r.version=Uye++)}function l(c,d){let f=0,m=0,y=0,x=0,S=0;const _=d.matrixWorldInverse;for(let w=0,E=c.length;w=o.length?(a=new ED(t),o.push(a)):a=o[s],a}function r(){e=new WeakMap}return{get:n,dispose:r}}class PR extends Gr{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=$V,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 RR 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 Hye=`void main() { gl_Position = vec4( position, 1.0 ); }`,Vye=`uniform sampler2D shadow_pass; uniform vec2 resolution; @@ -4395,7 +4395,7 @@ void main() { squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`;function Gye(t,e,n){let r=new fx;const i=new Ve,s=new Ve,o=new Ln,a=new PR({depthPacking:XV}),l=new RR,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:Hye,fragmentShader:Vye}),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=zS;let w=this.type;this.render=function(N,L,F){if(_.enabled===!1||_.autoUpdate===!1&&_.needsUpdate===!1||N.length===0)return;const V=t.getRenderTarget(),k=t.getActiveCubeFace(),U=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!==ka&&this.type===ka,te=w===ka&&this.type!==ka;for(let pe=0,oe=N.length;ped||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!==ka?{minFilter:ri,magFilter:ri}:{};B.map!==null&&B.map.dispose(),B.map=new Ha(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;$0||L.map&&L.alphaTest>0){const H=k.uuid,ne=L.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,L.addEventListener("dispose",O)),k=pe}if(k.visible=L.visible,k.wireframe=L.wireframe,V===ka?k.side=L.shadowSide!==null?L.shadowSide:L.side:k.side=L.shadowSide!==null?L.shadowSide:f[L.side],k.alphaMap=L.alphaMap,k.alphaTest=L.alphaTest,k.map=L.map,k.clipShadows=L.clipShadows,k.clippingPlanes=L.clippingPlanes,k.clipIntersection=L.clipIntersection,k.displacementMap=L.displacementMap,k.displacementScale=L.displacementScale,k.displacementBias=L.displacementBias,k.wireframeLinewidth=L.wireframeLinewidth,k.linewidth=L.linewidth,F.isPointLight===!0&&k.isMeshDistanceMaterial===!0){const H=t.properties.get(k);H.light=F}return k}function C(N,L,F,V,k){if(N.visible===!1)return;if(N.layers.test(L.layers)&&(N.isMesh||N.isLine||N.isPoints)&&(N.castShadow||N.receiveShadow&&k===ka)&&(!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=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;Kte?(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 qye(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 Kye(t){return t.repeat.x=1,t.repeat.y=1,t.offset.x=0,t.offset.y=0,t}function qC(t,e,n,r){const i=Yye(r);switch(n){case hR:return t*e;case mR:return t*e;case gR:return t*e*2;case $S:return t*e/i.components*i.byteLength;case lx:return t*e/i.components*i.byteLength;case vR:return t*e*2/i.components*i.byteLength;case XS:return t*e*2/i.components*i.byteLength;case pR:return t*e*3/i.components*i.byteLength;case is:return t*e*4/i.components*i.byteLength;case qS:return t*e*4/i.components*i.byteLength;case Xy:case qy:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case Ky:case Yy:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case a1:case c1:return Math.max(t,16)*Math.max(e,8)/4;case o1:case l1:return Math.max(t,8)*Math.max(e,8)/2;case u1:case d1:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case f1:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case h1:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case p1:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case m1:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case g1:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case v1:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case y1:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case x1:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case b1:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case _1:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case w1:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case S1:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case M1:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case E1:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case A1:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case Zy:case T1:case C1:return Math.ceil(t/4)*Math.ceil(e/4)*16;case yR:case P1:return Math.ceil(t/4)*Math.ceil(e/4)*8;case R1:case N1:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function Yye(t){switch(t){case Ba:case uR:return{byteLength:1,components:1};case Ig:case dR:case tv:return{byteLength:2,components:1};case GS:case WS:return{byteLength:2,components:4};case eu:case VS:case Zs:return{byteLength:4,components:1};case fR:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}const Zye={contain:Xye,cover:qye,fill:Kye,getByteLength:qC};function Qye(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):I0("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 E(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?T0: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===Uh?Ee=t.DEPTH24_STENCIL8:W===Zs?Ee=t.DEPTH32F_STENCIL8:W===Ig&&(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===Uh?Ee=t.DEPTH_COMPONENT24:W===Zs?Ee=t.DEPTH_COMPONENT32F:W===Ig&&(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),L(W),W.isVideoTexture&&d.delete(W)}function N(ee){const W=ee.target;W.removeEventListener("dispose",N),V(W)}function L(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=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,[wo]:t.CLAMP_TO_EDGE,[Ng]:t.MIRRORED_REPEAT},K={[ri]:t.NEAREST,[HS]:t.NEAREST_MIPMAP_NEAREST,[ih]:t.NEAREST_MIPMAP_LINEAR,[Cr]:t.LINEAR,[tg]:t.LINEAR_MIPMAP_NEAREST,[qo]:t.LINEAR_MIPMAP_LINEAR},q={[KV]:t.NEVER,[t6]:t.ALWAYS,[YV]:t.LESS,[_R]:t.LEQUAL,[ZV]:t.EQUAL,[e6]:t.GEQUAL,[QV]:t.GREATER,[JV]: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 jt=E(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)jt=T(W.format===Fh,W.type),Ae&&(J?n.texStorage2D(t.TEXTURE_2D,1,jt,qe.width,qe.height):n.texImage2D(t.TEXTURE_2D,0,jt,qe.width,qe.height,0,dt,Dt,null));else if(W.isDataTexture)if(de.length>0){J&&Ae&&n.texStorage2D(t.TEXTURE_2D,Fe,jt,de[0].width,de[0].height);for(let Te=0,Le=de.length;Te0){const Ke=qC(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,jt,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,jt,pt.width,pt.height,qe.depth,0,dt,Dt,pt.data)}else{J&&Ae&&n.texStorage2D(t.TEXTURE_2D,Fe,jt,de[0].width,de[0].height);for(let Te=0,Le=de.length;Te0){const Te=qC(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,jt,qe.width,qe.height,qe.depth,0,dt,Dt,qe.data);else if(W.isData3DTexture)J?(Ae&&n.texStorage3D(t.TEXTURE_3D,Fe,jt,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,jt,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,jt,qe.width,qe.height);else{let Te=qe.width,Le=qe.height;for(let Ke=0;Ke>=1,Le>>=1}}else if(de.length>0){if(J&&Ae){const Te=at(de[0]);n.texStorage2D(t.TEXTURE_2D,Fe,jt,Te.width,Te.height)}for(let Te=0,Le=de.length;Te0&&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,jt,pt,dt[Le].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Le,0,de,dt[Le].width,dt[Le].height,0,jt,pt,dt[Le].data);for(let Ke=0;Ke>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,je(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=je(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{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;ft0){Ee.__webglFramebuffer=[];for(let rt=0;rt0&&We(ee)===!1){Ee.__webglMultisampledFramebuffer=t.createFramebuffer(),Ee.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,Ee.__webglMultisampledFramebuffer);for(let rt=0;rt0)for(let ft=0;ft0)for(let ft=0;ft0){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;ft0&&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!==Ba)&&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=U,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 g6(t,e){function n(r,i=Lc){let s;const o=In.getTransfer(i);if(r===Ba)return t.UNSIGNED_BYTE;if(r===GS)return t.UNSIGNED_SHORT_4_4_4_4;if(r===WS)return t.UNSIGNED_SHORT_5_5_5_1;if(r===fR)return t.UNSIGNED_INT_5_9_9_9_REV;if(r===uR)return t.BYTE;if(r===dR)return t.SHORT;if(r===Ig)return t.UNSIGNED_SHORT;if(r===VS)return t.INT;if(r===eu)return t.UNSIGNED_INT;if(r===Zs)return t.FLOAT;if(r===tv)return t.HALF_FLOAT;if(r===hR)return t.ALPHA;if(r===pR)return t.RGB;if(r===is)return t.RGBA;if(r===mR)return t.LUMINANCE;if(r===gR)return t.LUMINANCE_ALPHA;if(r===Mh)return t.DEPTH_COMPONENT;if(r===Fh)return t.DEPTH_STENCIL;if(r===$S)return t.RED;if(r===lx)return t.RED_INTEGER;if(r===vR)return t.RG;if(r===XS)return t.RG_INTEGER;if(r===qS)return t.RGBA_INTEGER;if(r===Xy||r===qy||r===Ky||r===Yy)if(o===Jn)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(r===Xy)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===qy)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===Ky)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===Yy)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(r===Xy)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===qy)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===Ky)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===Yy)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===o1||r===a1||r===l1||r===c1)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(r===o1)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===a1)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===l1)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===c1)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===u1||r===d1||r===f1)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(r===u1||r===d1)return o===Jn?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(r===f1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(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||r===A1)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(r===h1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===p1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===m1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===g1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===v1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===y1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===x1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===b1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===_1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===w1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===S1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===M1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===E1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===A1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===Zy||r===T1||r===C1)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(r===Zy)return o===Jn?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===T1)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===C1)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===yR||r===P1||r===R1||r===N1)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(r===Zy)return s.COMPRESSED_RED_RGTC1_EXT;if(r===P1)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===R1)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===N1)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===Uh?t.UNSIGNED_INT_24_8:t[r]!==void 0?t[r]:null}return{convert:n}}class v6 extends Tr{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Ts extends mn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Jye={type:"move"};class bA{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(Jye)))}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 e0e=` +}`;function Gye(t,e,n){let r=new fx;const i=new Ve,s=new Ve,o=new Ln,a=new PR({depthPacking:XV}),l=new RR,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:Hye,fragmentShader:Vye}),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=zS;let w=this.type;this.render=function(N,L,F){if(_.enabled===!1||_.autoUpdate===!1&&_.needsUpdate===!1||N.length===0)return;const V=t.getRenderTarget(),k=t.getActiveCubeFace(),U=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;ped||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;$0||L.map&&L.alphaTest>0){const H=k.uuid,ne=L.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,L.addEventListener("dispose",O)),k=pe}if(k.visible=L.visible,k.wireframe=L.wireframe,V===Oa?k.side=L.shadowSide!==null?L.shadowSide:L.side:k.side=L.shadowSide!==null?L.shadowSide:f[L.side],k.alphaMap=L.alphaMap,k.alphaTest=L.alphaTest,k.map=L.map,k.clipShadows=L.clipShadows,k.clippingPlanes=L.clippingPlanes,k.clipIntersection=L.clipIntersection,k.displacementMap=L.displacementMap,k.displacementScale=L.displacementScale,k.displacementBias=L.displacementBias,k.wireframeLinewidth=L.wireframeLinewidth,k.linewidth=L.linewidth,F.isPointLight===!0&&k.isMeshDistanceMaterial===!0){const H=t.properties.get(k);H.light=F}return k}function C(N,L,F,V,k){if(N.visible===!1)return;if(N.layers.test(L.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=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;Kte?(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 qye(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 Kye(t){return t.repeat.x=1,t.repeat.y=1,t.offset.x=0,t.offset.y=0,t}function qC(t,e,n,r){const i=Yye(r);switch(n){case hR:return t*e;case mR:return t*e;case gR:return t*e*2;case $S:return t*e/i.components*i.byteLength;case lx:return t*e/i.components*i.byteLength;case vR:return t*e*2/i.components*i.byteLength;case XS:return t*e*2/i.components*i.byteLength;case pR:return t*e*3/i.components*i.byteLength;case is:return t*e*4/i.components*i.byteLength;case qS:return t*e*4/i.components*i.byteLength;case Xy:case qy:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case Ky:case Yy:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case a1:case c1:return Math.max(t,16)*Math.max(e,8)/4;case o1:case l1:return Math.max(t,8)*Math.max(e,8)/2;case u1:case d1:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case f1:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case h1:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case p1:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case m1:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case g1:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case v1:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case y1:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case x1:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case b1:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case _1:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case w1:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case S1:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case M1:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case E1:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case A1:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case Zy:case T1:case C1:return Math.ceil(t/4)*Math.ceil(e/4)*16;case yR:case P1:return Math.ceil(t/4)*Math.ceil(e/4)*8;case R1:case N1:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function Yye(t){switch(t){case Ha:case uR:return{byteLength:1,components:1};case Ig:case dR:case tv:return{byteLength:2,components:1};case GS:case WS:return{byteLength:2,components:4};case eu:case VS:case Zs:return{byteLength:4,components:1};case fR:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}const Zye={contain:Xye,cover:qye,fill:Kye,getByteLength:qC};function Qye(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):I0("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 E(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?T0: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===Uh?Ee=t.DEPTH24_STENCIL8:W===Zs?Ee=t.DEPTH32F_STENCIL8:W===Ig&&(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===Uh?Ee=t.DEPTH_COMPONENT24:W===Zs?Ee=t.DEPTH_COMPONENT32F:W===Ig&&(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),L(W),W.isVideoTexture&&d.delete(W)}function N(ee){const W=ee.target;W.removeEventListener("dispose",N),V(W)}function L(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=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,[wo]:t.CLAMP_TO_EDGE,[Ng]:t.MIRRORED_REPEAT},K={[ri]:t.NEAREST,[HS]:t.NEAREST_MIPMAP_NEAREST,[ih]:t.NEAREST_MIPMAP_LINEAR,[Cr]:t.LINEAR,[tg]:t.LINEAR_MIPMAP_NEAREST,[qo]:t.LINEAR_MIPMAP_LINEAR},q={[KV]:t.NEVER,[t6]:t.ALWAYS,[YV]:t.LESS,[_R]:t.LEQUAL,[ZV]:t.EQUAL,[e6]:t.GEQUAL,[QV]:t.GREATER,[JV]: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 jt=E(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)jt=T(W.format===Fh,W.type),Ae&&(J?n.texStorage2D(t.TEXTURE_2D,1,jt,qe.width,qe.height):n.texImage2D(t.TEXTURE_2D,0,jt,qe.width,qe.height,0,dt,Dt,null));else if(W.isDataTexture)if(de.length>0){J&&Ae&&n.texStorage2D(t.TEXTURE_2D,Fe,jt,de[0].width,de[0].height);for(let Te=0,Le=de.length;Te0){const Ke=qC(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,jt,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,jt,pt.width,pt.height,qe.depth,0,dt,Dt,pt.data)}else{J&&Ae&&n.texStorage2D(t.TEXTURE_2D,Fe,jt,de[0].width,de[0].height);for(let Te=0,Le=de.length;Te0){const Te=qC(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,jt,qe.width,qe.height,qe.depth,0,dt,Dt,qe.data);else if(W.isData3DTexture)J?(Ae&&n.texStorage3D(t.TEXTURE_3D,Fe,jt,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,jt,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,jt,qe.width,qe.height);else{let Te=qe.width,Le=qe.height;for(let Ke=0;Ke>=1,Le>>=1}}else if(de.length>0){if(J&&Ae){const Te=at(de[0]);n.texStorage2D(t.TEXTURE_2D,Fe,jt,Te.width,Te.height)}for(let Te=0,Le=de.length;Te0&&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,jt,pt,dt[Le].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Le,0,de,dt[Le].width,dt[Le].height,0,jt,pt,dt[Le].data);for(let Ke=0;Ke>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,je(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=je(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{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;ft0){Ee.__webglFramebuffer=[];for(let rt=0;rt0&&We(ee)===!1){Ee.__webglMultisampledFramebuffer=t.createFramebuffer(),Ee.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,Ee.__webglMultisampledFramebuffer);for(let rt=0;rt0)for(let ft=0;ft0)for(let ft=0;ft0){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;ft0&&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=U,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 g6(t,e){function n(r,i=Lc){let s;const o=In.getTransfer(i);if(r===Ha)return t.UNSIGNED_BYTE;if(r===GS)return t.UNSIGNED_SHORT_4_4_4_4;if(r===WS)return t.UNSIGNED_SHORT_5_5_5_1;if(r===fR)return t.UNSIGNED_INT_5_9_9_9_REV;if(r===uR)return t.BYTE;if(r===dR)return t.SHORT;if(r===Ig)return t.UNSIGNED_SHORT;if(r===VS)return t.INT;if(r===eu)return t.UNSIGNED_INT;if(r===Zs)return t.FLOAT;if(r===tv)return t.HALF_FLOAT;if(r===hR)return t.ALPHA;if(r===pR)return t.RGB;if(r===is)return t.RGBA;if(r===mR)return t.LUMINANCE;if(r===gR)return t.LUMINANCE_ALPHA;if(r===Mh)return t.DEPTH_COMPONENT;if(r===Fh)return t.DEPTH_STENCIL;if(r===$S)return t.RED;if(r===lx)return t.RED_INTEGER;if(r===vR)return t.RG;if(r===XS)return t.RG_INTEGER;if(r===qS)return t.RGBA_INTEGER;if(r===Xy||r===qy||r===Ky||r===Yy)if(o===Jn)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(r===Xy)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===qy)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===Ky)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===Yy)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(r===Xy)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===qy)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===Ky)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===Yy)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===o1||r===a1||r===l1||r===c1)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(r===o1)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===a1)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===l1)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===c1)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===u1||r===d1||r===f1)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(r===u1||r===d1)return o===Jn?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(r===f1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(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||r===A1)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(r===h1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===p1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===m1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===g1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===v1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===y1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===x1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===b1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===_1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===w1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===S1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===M1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===E1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===A1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===Zy||r===T1||r===C1)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(r===Zy)return o===Jn?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===T1)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===C1)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===yR||r===P1||r===R1||r===N1)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(r===Zy)return s.COMPRESSED_RED_RGTC1_EXT;if(r===P1)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===R1)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===N1)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===Uh?t.UNSIGNED_INT_24_8:t[r]!==void 0?t[r]:null}return{convert:n}}class v6 extends Tr{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Ts extends mn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Jye={type:"move"};class bA{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(Jye)))}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 e0e=` void main() { gl_Position = vec4( position, 1.0 ); @@ -4419,7 +4419,7 @@ void main() { } -}`;class n0e{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:e0e,fragmentShader:t0e,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new yr(new nv(20,20),r)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class r0e 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 n0e,_=n.getContextAttributes();let w=null,E=null;const T=[],C=[],O=new Ve;let N=null;const L=new Tr;L.layers.enable(1),L.viewport=new Ln;const F=new Tr;F.layers.enable(2),F.viewport=new Ln;const V=[L,F],k=new v6;k.layers.enable(1),k.layers.enable(2);let U=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 bA,T[ae]=fe),fe.getTargetRaySpace()},this.getControllerGrip=function(ae){let fe=T[ae];return fe===void 0&&(fe=new bA,T[ae]=fe),fe.getGripSpace()},this.getHand=function(ae){let fe=T[ae];return fe===void 0&&(fe=new bA,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=0&&(C[Se]=null,T[Se].disconnect(_e))}for(let fe=0;fe=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],je=(Me[8]+1)/Me[0],We=He*Ge,Qe=He*je,xt=Se/(-Ge+je),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=L.near=fe,k.far=F.far=L.far=_e,(U!==k.near||H!==k.far)&&(i.updateRenderState({depthNear:k.near,depthFar:k.far}),U=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,L,F):k.projectionMatrix.copy(L.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=Lg*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(E,y.framebuffer),e.setRenderTarget(E));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(E,Q.colorTexture,m.ignoreDepthValues?void 0:Q.depthStencilTexture),e.setRenderTarget(E))}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;_e0&&(_.alphaTest.value=w.alphaTest);const E=e.get(w),T=E.envMap,C=E.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(i0e.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,E,T){_.diffuse.value.copy(w.color),_.opacity.value=w.opacity,_.size.value=w.size*E,_.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,E){_.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=E.texture,_.transmissionSamplerSize.value.set(E.width,E.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 E=e.get(w).light;_.referencePosition.value.setFromMatrixPosition(E.matrixWorld),_.nearDistance.value=E.shadow.camera.near,_.farDistance.value=E.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function o0e(t,e,n,r){let i={},s={},o=[];const a=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function l(E,T){const C=T.program;r.uniformBlockBinding(E,C)}function c(E,T){let C=i[E.id];C===void 0&&(x(E),C=d(E),i[E.id]=C,E.addEventListener("dispose",_));const O=T.program;r.updateUBOMapping(E,O);const N=e.render.frame;s[E.id]!==N&&(m(E),s[E.id]=N)}function d(E){const T=f();E.__bindingPointIndex=T;const C=t.createBuffer(),O=E.__size,N=E.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 E=0;E0&&(C+=O-N),E.__size=C,E.__cache={},this}function S(E){const T={boundary:0,storage:0};return typeof E=="number"||typeof E=="boolean"?(T.boundary=4,T.storage=4):E.isVector2?(T.boundary=8,T.storage=8):E.isVector3||E.isColor?(T.boundary=16,T.storage=12):E.isVector4?(T.boundary=16,T.storage=16):E.isMatrix3?(T.boundary=48,T.storage=48):E.isMatrix4?(T.boundary=64,T.storage=64):E.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",E),T}function _(E){const T=E.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 E in i)t.deleteBuffer(i[E]);o=[],i={},s={}}return{bind:l,update:c,dispose:w}}class y6{constructor(e={}){const{canvas:n=i6(),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=[],E=[];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=Ui,this.toneMapping=Cl,this.toneMappingExposure=1;const T=this;let C=!1,O=0,N=0,L=null,F=-1,V=null;const k=new Ln,U=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 fx;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 L===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 je,We,Qe,xt,at,ee,W,Ee,Be,le,Ce,lt,rt,ft,nn,qe,dt,Dt,jt,pt,de,J,Ae,re;function Fe(){je=new fve(Q),je.init(),J=new g6(Q,je),We=new ove(Q,je,e,J),Qe=new $ye(Q),We.reverseDepthBuffer&&Qe.buffers.depth.setReversed(!0),xt=new mve(Q),at=new kye,ee=new Qye(Q,je,Qe,at,We,J,xt),W=new lve(T),Ee=new dve(T),Be=new wpe(Q),Ae=new ive(Q,Be),le=new hve(Q,Be,xt,Ae),Ce=new vve(Q,le,Be,xt),jt=new gve(Q,We,ee),qe=new ave(at),lt=new Iye(T,W,Ee,je,We,Ae,qe),rt=new s0e(T,at),ft=new Lye,nn=new Bye(je),Dt=new rve(T,W,Ee,Qe,Ce,m,l),dt=new Gye(T,Ce,We),re=new o0e(Q,xt,We,Qe),pt=new sve(Q,je,xt),de=new pve(Q,je,xt),xt.programs=lt.programs,T.capabilities=We,T.extensions=je,T.properties=at,T.renderLists=ft,T.shadowMap=dt,T.state=Qe,T.info=xt}Fe();const Te=new r0e(T,Q);this.xr=Te,this.getContext=function(){return Q},this.getContextAttributes=function(){return Q.getContextAttributes()},this.forceContextLoss=function(){const Y=je.get("WEBGL_lose_context");Y&&Y.loseContext()},this.forceContextRestore=function(){const Y=je.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(U.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(L!==null){const et=L.texture.format;we=et===qS||et===XS||et===lx}if(we){const et=L.texture.type,yt=et===Ba||et===eu||et===Ig||et===Uh||et===GS||et===WS,st=Dt.getClearColor(),Mt=Dt.getClearAlpha(),Ft=st.r,Ht=st.g,Pt=st.b;yt?(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 yt=we.isMesh&&we.matrixWorld.determinant()<0,st=Co(Y,xe,Re,ke,we);Qe.setMaterial(ke,yt);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(je.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{function et(){if(ke.forEach(function(yt){at.get(yt).currentProgram.isReady()&&ke.delete(yt)}),ke.size===0){we(Y);return}setTimeout(et,10)}je.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 d6;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,L),_=nn.get(Y,E.length),_.init(xe),E.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&&qa(et,xe,-1/0,T.sortObjects)}qa(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 yt=0,st=et.length;yt0&&ia(ke,we,Y,xe),Xe&&Dt.render(Y),Ns(S,Y,xe);L!==null&&(ee.updateMultisampleRenderTarget(L),ee.updateRenderTargetMipmap(L)),Y.isScene===!0&&Y.onAfterRender(T,Y,xe),Ae.resetDefaultState(),F=-1,V=null,E.pop(),E.length>0?(_=E[E.length-1],ae===!0&&qe.setGlobalState(T.clippingPlanes,_.state.camera)):_=null,w.pop(),w.length>0?S=w[w.length-1]:S=null};function qa(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 yt=Ce.update(Y),st=Y.material;st.visible&&S.push(Y,yt,st,Re,Me.z,null)}}else if((Y.isMesh||Y.isLine||Y.isPoints)&&(!Y.frustumCulled||ge.intersectsObject(Y))){const yt=Ce.update(Y),st=Y.material;if(ke&&(Y.boundingSphere!==void 0?(Y.boundingSphere===null&&Y.computeBoundingSphere(),Me.copy(Y.boundingSphere.center)):(yt.boundingSphere===null&&yt.computeBoundingSphere(),Me.copy(yt.boundingSphere.center)),Me.applyMatrix4(Y.matrixWorld).applyMatrix4(Se)),Array.isArray(st)){const Mt=yt.groups;for(let Ft=0,Ht=Mt.length;Ft0&&Ei(we,xe,Re),et.length>0&&Ei(et,xe,Re),yt.length>0&&Ei(yt,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 Ha(1,1,{generateMipmaps:!0,type:je.has("EXT_color_buffer_half_float")||je.has("EXT_color_buffer_float")?tv:Ba,minFilter:qo,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:In.workingColorSpace}));const et=_.state.transmissionRenderTarget[ke.id],yt=ke.viewport||k;et.setSize(yt.z,yt.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),je.has("WEBGL_multisampled_render_to_texture")===!1){let Ht=!1;for(let Pt=0,Sn=xe.length;Pt0),Pt=!!Re.morphAttributes.position,Sn=!!Re.morphAttributes.normal,Mn=!!Re.morphAttributes.color;let yn=Cl;ke.toneMapped&&(L===null||L.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),$he(_e),Xhe(_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 Ka=Re.morphAttributes;if((Ka.position!==void 0||Ka.normal!==void 0||Ka.color!==void 0)&&jt.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]),q_.upload(Q,cu(mt),eo,ee)),ke.isShaderMaterial&&ke.uniformsNeedUpdate===!0&&(q_.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;ci0&&ee.useMultisampledRTT(Y)===!1?we=at.get(Y).__webglMultisampledFramebuffer:Array.isArray(Ht)?we=Ht[Re]:we=Ht,k.copy(Y.viewport),U.copy(Y.scissor),H=Y.scissorTest}else k.copy(q).multiplyScalar(ce).floor(),U.copy($).multiplyScalar(ce).floor(),H=Z;if(Qe.bindFramebuffer(Q.FRAMEBUFFER,we)&&ke&&Qe.drawBuffers(Y,we),Qe.viewport(k),Qe.scissor(U),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(yt){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,yt){if(!(Y&&Y.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let st=at.get(Y).__webglFramebuffer;if(Y.isWebGLCubeRenderTarget&&yt!==void 0&&(st=st[yt]),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=L!==null?at.get(L).__webglFramebuffer:null;Qe.bindFramebuffer(Q.FRAMEBUFFER,Mt)}}},this.readRenderTargetPixelsAsync=async function(Y,xe,Re,ke,we,et,yt){if(!(Y&&Y.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let st=at.get(Y).__webglFramebuffer;if(Y.isWebGLCubeRenderTarget&&yt!==void 0&&(st=st[yt]),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=L!==null?at.get(L).__webglFramebuffer:null;Qe.bindFramebuffer(Q.FRAMEBUFFER,Sn);const Mn=Q.fenceSync(Q.SYNC_GPU_COMMANDS_COMPLETE,0);return Q.flush(),await Whe(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&&(X_("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),yt=xe!==null?xe.x:0,st=xe!==null?xe.y:0;ee.setTexture2D(Y,0),Q.copyTexSubImage2D(Q.TEXTURE_2D,Re,0,0,yt,st,we,et),Qe.unbindTexture()},this.copyTextureToTexture=function(Y,xe,Re=null,ke=null,we=0){Y.isTexture!==!0&&(X_("WebGLRenderer: copyTextureToTexture function signature has changed."),ke=arguments[0]||null,Y=arguments[1],xe=arguments[2],we=arguments[3]||0,Re=null);let et,yt,st,Mt,Ft,Ht;Re!==null?(et=Re.max.x-Re.min.x,yt=Re.max.y-Re.min.y,st=Re.min.x,Mt=Re.min.y):(et=Y.image.width,yt=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,yt,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,yt,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&&(X_("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,yt,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,yt=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,yt=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,yt,st,Yt,Lt,yn.data):xe.isCompressedArrayTexture?Q.compressedTexSubImage3D(mt,we,Pt,Sn,Mn,et,yt,st,Yt,yn.data):Q.texSubImage3D(mt,we,Pt,Sn,Mn,et,yt,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,L=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===YS?"display-p3":"srgb",n.unpackColorSpace=In.workingColorSpace===cx?"display-p3":"srgb"}}class JS{constructor(e,n=25e-5){this.isFogExp2=!0,this.name="",this.color=new ot(e),this.density=n}clone(){return new JS(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class eM{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 eM(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class NR 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=R0,this.updateRanges=[],this.version=0,this.uuid=Mo()}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;ie.far||n.push({distance:l,point:xy.clone(),uv:qs.getInterpolation(xy,i_,_y,s_,AD,_A,TD,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 o_(t,e,n,r,i,s){Pm.subVectors(t,n).addScalar(.5).multiply(r),i!==void 0?(by.x=s*Pm.x-i*Pm.y,by.y=i*Pm.x+s*Pm.y):by.copy(Pm),t.copy(e),t.x+=by.x,t.y+=by.y,t.applyMatrix4(x6)}const a_=new X,CD=new X;class _6 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;r0){let r,i;for(r=1,i=n.length;r0){a_.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(a_);this.getObjectForDistance(i).raycast(e,n)}}update(e){const n=this.levels;if(n.length>1){a_.setFromMatrixPosition(e.matrixWorld),CD.setFromMatrixPosition(this.matrixWorld);const r=a_.distanceTo(CD)/e.zoom;n[0].object.visible=!0;let i,s;for(i=1,s=n.length;i=o)n[i-1].object.visible=!1,n[i].object.visible=!0;else break}for(this._currentLevel=i-1;i=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,MA=new Ct,h0e=new Ct,p0e=new ot(1,1,1),jD=new Ct,EA=new fx,u_=new os,kf=new Bi,My=new X,UD=new X,m0e=new X,AA=new f0e,es=new yr,d_=[];function g0e(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;s65535?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=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;h0e.toArray(o,i*16),s.needsUpdate=!0;const a=this._colorsTexture;return a&&(p0e.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);g0e(x,S,l);const _=x.itemSize;for(let w=x.count,E=c;w=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=this._geometryCount)return null;const r=this._bounds[e],i=r.sphere,s=this.geometry;if(r.sphereInitialized===!1){i.makeEmpty(),this.getBoundingBoxAt(e,u_),u_.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=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({...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&&(jD.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse).multiply(this.matrixWorld),EA.setFromProjectionMatrix(jD,e.coordinateSystem));let S=0;if(this.sortObjects){MA.copy(this.matrixWorld).invert(),My.setFromMatrixPosition(r.matrixWorld).applyMatrix4(MA),UD.set(0,0,-1).transformDirection(r.matrixWorld).transformDirection(MA);for(let E=0,T=l.length;E0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;sr)return;TA.applyMatrix4(t.matrixWorld);const l=e.ray.origin.distanceTo(TA);if(!(le.far))return{distance:l,point:zD.clone().applyMatrix4(t.matrixWorld),index:i,face:null,faceIndex:null,barycoord:null,object:t}}const BD=new X,HD=new X;class Js extends Ul{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;i0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;si.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class v0e 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 y0e 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 iM 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 x0e extends iM{constructor(e,n,r,i,s,o){super(e,n,r,s,o),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=wo,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class b0e extends iM{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 _0e 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 $a{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 sM extends $a{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)i;)s-=i;s0?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]:(g_.subVectors(i[0],i[1]).add(i[0]),c=g_);const f=i[a%s],m=i[(a+1)%s];if(this.closed||a+2i.length-2?i.length-1:o+1],f=i[o>i.length-3?i.length-1:o+2];return r.set(WD(a,l.x,c.x,d.x,f.x),WD(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){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;r1&&!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;n0){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 hx 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 E=0;E<=e.length-1;E++)switch(E){case 0:_=e[E+1].x-e[E].x,w=e[E+1].y-e[E].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[E+1].x-e[E].x,w=e[E+1].y-e[E].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 E=0;E<=n;E++){const T=r+E*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=E/n,m.y=N/(e.length-1),a.push(m.x,m.y);const L=l[3*N+0]*C,F=l[3*N+1],V=l[3*N+0]*O;c.push(L,F,V)}}for(let E=0;E0&&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 E(){const C=new X,O=new X;let N=0;const L=(n-e)/r;for(let F=0;F<=s;F++){const V=[],k=F/s,U=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=U*pe,O.y=-k*r+_,O.z=U*oe,f.push(O.x,O.y,O.z),C.set(pe,L,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;F0&&(d.push(k,U,ne),N+=3),n>0&&(d.push(U,H,ne),N+=3)}c.addGroup(w,N,0),w+=N}function T(C){const O=x,N=new Ve,L=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 U=x;for(let H=0;H<=i;H++){const te=H/i*l+a,pe=Math.cos(te),oe=Math.sin(te);L.x=V*oe,L.y=_*k,L.z=V*pe,f.push(L.x,L.y,L.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.9&&L<.1&&(T<.2&&(o[E+0]+=1),C<.2&&(o[E+2]+=1),O<.2&&(o[E+4]+=1))}}function m(E){s.push(E.x,E.y,E.z)}function y(E,T){const C=E*3;T.x=e[C+0],T.y=e[C+1],T.z=e[C+2]}function x(){const E=new X,T=new X,C=new X,O=new X,N=new Ve,L=new Ve,F=new Ve;for(let V=0,k=0;V80*n){a=c=t[0],l=d=t[1];for(let x=n;xc&&(c=f),m>d&&(d=m);y=Math.max(c-a,d-l),y=y!==0?32767/y:0}return O0(s,o,n,a,l,y,0),o}};function P6(t,e,n,r,i){let s,o;if(i===W0e(t,e,n,r)>0)for(s=e;s=e;s-=r)o=$D(s,t[s],t[s+1],o);return o&&uM(o,o.next)&&(D0(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&&(uM(n,n.next)||vr(n.prev,n,n.next)===0)){if(D0(n),n=e=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==e);return e}function O0(t,e,n,r,i,s,o){if(!t)return;!o&&s&&F0e(t,r,i,s);let a=t,l,c;for(;t.prev!==t.next;){if(l=t.prev,c=t.next,s?N0e(t,r,i,s):R0e(t)){e.push(l.i/n|0),e.push(t.i/n|0),e.push(c.i/n|0),D0(t),t=c.next,a=c.next;continue}if(t=c,t===a){o?o===1?(t=I0e(Bh(t),e,n),O0(t,e,n,r,i,s,2)):o===2&&k0e(t,e,n,r,i,s):O0(Bh(t),e,n,r,i,s,1);break}}}function R0e(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=is?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 N0e(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=al?a>c?a:c:l>c?l:c,_=d>f?d>m?d:m:f>m?f:m,w=YC(y,x,e,n,r),E=YC(S,_,e,n,r);let T=t.prevZ,C=t.nextZ;for(;T&&T.z>=w&&C&&C.z<=E;){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<=E;){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 I0e(t,e,n){let r=t;do{const i=r.prev,s=r.next.next;!uM(i,s)&&R6(i,r,r.next,s)&&L0(i,s)&&L0(s,i)&&(e.push(i.i/n|0),e.push(r.i/n|0),e.push(s.i/n|0),D0(r),D0(r.next),r=t=s),r=r.next}while(r!==t);return Bh(r)}function k0e(t,e,n,r,i,s){let o=t;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&H0e(o,a)){let l=N6(o,a);o=Bh(o,o.next),l=Bh(l,l.next),O0(o,e,n,r,i,s,0),O0(l,e,n,r,i,s,0);return}a=a.next}o=o.next}while(o!==t)}function O0e(t,e,n,r){const i=[];let s,o,a,l,c;for(s=0,o=e.length;s=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.x&&n.x>=l&&s!==n.x&&qm(oi.x||n.x===i.x&&U0e(i,n)))&&(i=n,d=f)),n=n.next;while(n!==a);return i}function U0e(t,e){return vr(t.prev,t,e.prev)<0&&vr(e.next,t,t.next)<0}function F0e(t,e,n,r){let i=t;do i.z===0&&(i.z=YC(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,z0e(i)}function z0e(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;e0||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 YC(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 B0e(t){let e=t,n=t;do(e.x=(t-o)*(s-a)&&(t-o)*(r-a)>=(n-o)*(e-a)&&(n-o)*(s-a)>=(i-o)*(r-a)}function H0e(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!V0e(t,e)&&(L0(t,e)&&L0(e,t)&&G0e(t,e)&&(vr(t.prev,t,e.prev)||vr(t,e.prev,e))||uM(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 uM(t,e){return t.x===e.x&&t.y===e.y}function R6(t,e,n,r){const i=__(vr(t,e,n)),s=__(vr(t,e,r)),o=__(vr(n,r,t)),a=__(vr(n,r,e));return!!(i!==s&&o!==a||i===0&&b_(t,n,e)||s===0&&b_(t,r,e)||o===0&&b_(n,t,r)||a===0&&b_(n,e,r))}function b_(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 __(t){return t>0?1:t<0?-1:0}function V0e(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&&R6(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function L0(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 G0e(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 N6(t,e){const n=new ZC(t.i,t.x,t.y),r=new ZC(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 $D(t,e,n,r){const i=new ZC(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 D0(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 ZC(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 W0e(t,e,n,r){let i=0;for(let s=e,o=n-r;s2&&t[e-1].equals(t[0])&&t.pop()}function qD(t,e){for(let n=0;nNumber.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);je=lt+xt*qe-ue.x,We=rt+at*qe-ue.y;const dt=je*je+We*We;if(dt<=2)return new Ve(je,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?(je=-at,We=xt,Qe=Math.sqrt(Ee)):(je=xt,We=at,Qe=Math.sqrt(Ee/2))}return new Ve(je/Qe,We/Qe)}const K=[];for(let ue=0,Q=te.length,Ge=Q-1,je=ue+1;ue=0;ue--){const Q=ue/_,Ge=y*Math.cos(Q*Math.PI/2),je=x*Math.sin(Q*Math.PI/2)+S;for(let We=0,Qe=te.length;We=0;){const je=Ge;let We=Ge-1;We<0&&(We=ue.length-1);for(let Qe=0,xt=d+_*2;Qe0)&&y.push(T,C,N),(w!==r-1||l0!=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 L6 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=ax,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 D6 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 j6 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=ax,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 F6 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 z6 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 B6(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function H6(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 QC(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 HR(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 K0e(t,e,n,r,i=30){const s=t.clone();s.name=e;const o=[];for(let l=0;l=r)){f.push(c.times[y]);for(let S=0;Ss.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l=a.times[x]){const w=x*f+d,E=w+f-d;S=a.values.slice(w,E)}else{const w=a.createInterpolant(),E=d,T=f-d;w.evaluate(s),S=w.resultBuffer.slice(E,T)}l==="quaternion"&&new qt().fromArray(S).normalize().conjugate().toArray(S);const _=c.times.length;for(let w=0;w<_;++w){const E=w*y+m;if(l==="quaternion")qt.multiplyQuaternionsFlat(c.values,E,S,0,c.values,E);else{const T=y-m*2;for(let C=0;C=s)){const a=n[1];e=s)break t}o=r,r=0;break n}break e}for(;r>>1;en;)--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&&B6(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()===$_,s=e.length-1;let o=1;for(let a=1;a0){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}}Xa.prototype.TimeBufferType=Float32Array;Xa.prototype.ValueBufferType=Float32Array;Xa.prototype.DefaultInterpolation=Og;class np extends Xa{constructor(e,n,r){super(e,n,r)}}np.prototype.ValueTypeName="bool";np.prototype.ValueBufferType=Array;np.prototype.DefaultInterpolation=kg;np.prototype.InterpolantFactoryMethodLinear=void 0;np.prototype.InterpolantFactoryMethodSmooth=void 0;class GR extends Xa{}GR.prototype.ValueTypeName="color";class Hh extends Xa{}Hh.prototype.ValueTypeName="number";class W6 extends sv{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 Xa{InterpolantFactoryMethodLinear(e){return new W6(this.times,this.values,this.getValueSize(),e)}}Vh.prototype.ValueTypeName="quaternion";Vh.prototype.InterpolantFactoryMethodSmooth=void 0;class rp extends Xa{constructor(e,n,r){super(e,n,r)}}rp.prototype.ValueTypeName="string";rp.prototype.ValueBufferType=Array;rp.prototype.DefaultInterpolation=kg;rp.prototype.InterpolantFactoryMethodLinear=void 0;rp.prototype.InterpolantFactoryMethodSmooth=void 0;class Gh extends Xa{}Gh.prototype.ValueTypeName="vector";class jg{constructor(e="",n=-1,r=[],i=KS){this.name=e,this.tracks=r,this.duration=n,this.blendMode=i,this.uuid=Mo(),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(J0e(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(Xa.toJSON(r[s]));return i}static CreateFromMorphTargetSequence(e,n,r,i){const s=n.length,o=[];for(let a=0;a1){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=[];HR(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{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){E();function E(){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,L=d.length;N{w.error(T)})}}});return new Response(_)}else throw new exe(`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{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{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class txe extends Rs{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new Va(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;r0: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 xM.createMaterialFromType(e)}static createMaterialFromType(e){const n={ShadowMaterial:k6,SpriteMaterial:IR,RawShaderMaterial:O6,ShaderMaterial:Qo,PointsMaterial:rM,MeshPhysicalMaterial:na,MeshStandardMaterial:gx,MeshPhongMaterial:L6,MeshToonMaterial:D6,MeshNormalMaterial:j6,MeshLambertMaterial:U6,MeshDepthMaterial:PR,MeshDistanceMaterial:RR,MeshBasicMaterial:As,MeshMatcapMaterial:F6,LineDashedMaterial:z6,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;r0){const l=new WR(n);s=new Ug(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,d=e.length;c0){i=new Ug(this.manager),i.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o{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 _6;break;case"Line":o=new Ul(a(e.geometry),l(e.material));break;case"LineLoop":o=new OR(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 LR(a(e.geometry),l(e.material));break;case"Sprite":o=new b6(l(e.material));break;case"Group":o=new Ts;break;case"Bone":o=new nM;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"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 w_;class YR{static getContext(){return w_===void 0&&(w_=new(window.AudioContext||window.webkitAudioContext)),w_}static setContext(e){w_=e}}class uxe extends Rs{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new Va(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);YR.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 nj=new Ct,rj=new Ct,Of=new Ct;class dxe{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;rj.elements[12]=-i,nj.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(rj),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(nj)}}class ZR{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=ij(),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=ij();e=(n-this.oldTime)/1e3,this.oldTime=n,this.elapsedTime+=e}return e}}function ij(){return performance.now()}const Lf=new X,sj=new qt,fxe=new X,Df=new X;class hxe extends mn{constructor(){super(),this.type="AudioListener",this.context=YR.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new ZR}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,sj,fxe),Df.set(0,0,-1).applyQuaternion(sj),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 nG=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;e0){this.source.disconnect(this.filters[0]);for(let e=1,n=this.filters.length;e0&&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=.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 QR="\\[\\]\\.:\\/",vxe=new RegExp("["+QR+"]","g"),JR="[^"+QR+"]",yxe="[^"+QR.replace("\\.","")+"]",xxe=/((?:WC+[\/:])*)/.source.replace("WC",JR),bxe=/(WCOD+)?/.source.replace("WCOD",yxe),_xe=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",JR),wxe=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",JR),Sxe=new RegExp("^"+xxe+bxe+_xe+wxe+"$"),Mxe=["material","materials","bones","map"];class Exe{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(vxe,"")}static parseTrackName(e){const n=Sxe.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);Mxe.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){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],f0&&(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 iG{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=VV,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 xR:for(let d=0,f=l.length;d!==f;++d)l[d].evaluate(o),c[d].accumulateAdditive(a);break;case KS: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===GV;if(e===0)return s===-1?i:o&&(s&1)===1?n-i:i;if(r===HV){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=A0,n?i.endingEnd=this.zeroSlopeAtEnd?oh:sh:i.endingEnd=A0)}_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 Txe=new Float32Array(1);class Cxe 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 rG(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=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.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,cj).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 uj=new X,S_=new X;class Oxe{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){uj.subVectors(e,this.start),S_.subVectors(this.end,this.start);const r=S_.dot(S_);let s=S_.dot(uj)/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 dj=new X;class Lxe 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;o1)for(let f=0;f.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{gj.set(e.z,0,-e.x).normalize();const n=Math.acos(e.y);this.quaternion.setFromAxisAngle(gj,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 aG 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 qxe{constructor(){this.type="ShapePath",this.color=new ot,this.subPaths=[],this.currentPath=null}moveTo(e,n){return this.currentPath=new k0,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 E=[];for(let T=0,C=w.length;TNumber.EPSILON){if(k<0&&(L=E[N],V=-V,F=E[O],k=-k),w.yF.y)continue;if(w.y===L.y){if(w.x===L.x)return!0}else{const U=k*(w.x-L.x)-V*(w.y-L.y);if(U===0)return!0;if(U<0)continue;C=!C}}else{if(w.y!==L.y)continue;if(F.x<=w.x&&w.x<=L.x||L.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,E=s.length;w1){let w=!1,E=0;for(let T=0,C=m.length;T0&&w===!1&&(y=f)}let _;for(let w=0,E=m.length;w=0&&(C[Se]=null,T[Se].disconnect(_e))}for(let fe=0;fe=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],je=(Me[8]+1)/Me[0],We=He*Ge,Qe=He*je,xt=Se/(-Ge+je),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=L.near=fe,k.far=F.far=L.far=_e,(U!==k.near||H!==k.far)&&(i.updateRenderState({depthNear:k.near,depthFar:k.far}),U=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,L,F):k.projectionMatrix.copy(L.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=Lg*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(E,y.framebuffer),e.setRenderTarget(E));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(E,Q.colorTexture,m.ignoreDepthValues?void 0:Q.depthStencilTexture),e.setRenderTarget(E))}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;_e0&&(_.alphaTest.value=w.alphaTest);const E=e.get(w),T=E.envMap,C=E.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(i0e.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,E,T){_.diffuse.value.copy(w.color),_.opacity.value=w.opacity,_.size.value=w.size*E,_.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,E){_.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=E.texture,_.transmissionSamplerSize.value.set(E.width,E.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 E=e.get(w).light;_.referencePosition.value.setFromMatrixPosition(E.matrixWorld),_.nearDistance.value=E.shadow.camera.near,_.farDistance.value=E.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function o0e(t,e,n,r){let i={},s={},o=[];const a=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function l(E,T){const C=T.program;r.uniformBlockBinding(E,C)}function c(E,T){let C=i[E.id];C===void 0&&(x(E),C=d(E),i[E.id]=C,E.addEventListener("dispose",_));const O=T.program;r.updateUBOMapping(E,O);const N=e.render.frame;s[E.id]!==N&&(m(E),s[E.id]=N)}function d(E){const T=f();E.__bindingPointIndex=T;const C=t.createBuffer(),O=E.__size,N=E.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 E=0;E0&&(C+=O-N),E.__size=C,E.__cache={},this}function S(E){const T={boundary:0,storage:0};return typeof E=="number"||typeof E=="boolean"?(T.boundary=4,T.storage=4):E.isVector2?(T.boundary=8,T.storage=8):E.isVector3||E.isColor?(T.boundary=16,T.storage=12):E.isVector4?(T.boundary=16,T.storage=16):E.isMatrix3?(T.boundary=48,T.storage=48):E.isMatrix4?(T.boundary=64,T.storage=64):E.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",E),T}function _(E){const T=E.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 E in i)t.deleteBuffer(i[E]);o=[],i={},s={}}return{bind:l,update:c,dispose:w}}class y6{constructor(e={}){const{canvas:n=i6(),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=[],E=[];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=Ui,this.toneMapping=Cl,this.toneMappingExposure=1;const T=this;let C=!1,O=0,N=0,L=null,F=-1,V=null;const k=new Ln,U=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 fx;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 L===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 je,We,Qe,xt,at,ee,W,Ee,Be,le,Ce,lt,rt,ft,nn,qe,dt,Dt,jt,pt,de,J,Ae,re;function Fe(){je=new fve(Q),je.init(),J=new g6(Q,je),We=new ove(Q,je,e,J),Qe=new $ye(Q),We.reverseDepthBuffer&&Qe.buffers.depth.setReversed(!0),xt=new mve(Q),at=new kye,ee=new Qye(Q,je,Qe,at,We,J,xt),W=new lve(T),Ee=new dve(T),Be=new wpe(Q),Ae=new ive(Q,Be),le=new hve(Q,Be,xt,Ae),Ce=new vve(Q,le,Be,xt),jt=new gve(Q,We,ee),qe=new ave(at),lt=new Iye(T,W,Ee,je,We,Ae,qe),rt=new s0e(T,at),ft=new Lye,nn=new Bye(je),Dt=new rve(T,W,Ee,Qe,Ce,m,l),dt=new Gye(T,Ce,We),re=new o0e(Q,xt,We,Qe),pt=new sve(Q,je,xt),de=new pve(Q,je,xt),xt.programs=lt.programs,T.capabilities=We,T.extensions=je,T.properties=at,T.renderLists=ft,T.shadowMap=dt,T.state=Qe,T.info=xt}Fe();const Te=new r0e(T,Q);this.xr=Te,this.getContext=function(){return Q},this.getContextAttributes=function(){return Q.getContextAttributes()},this.forceContextLoss=function(){const Y=je.get("WEBGL_lose_context");Y&&Y.loseContext()},this.forceContextRestore=function(){const Y=je.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(U.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(L!==null){const et=L.texture.format;we=et===qS||et===XS||et===lx}if(we){const et=L.texture.type,yt=et===Ha||et===eu||et===Ig||et===Uh||et===GS||et===WS,st=Dt.getClearColor(),Mt=Dt.getClearAlpha(),Ft=st.r,Ht=st.g,Pt=st.b;yt?(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 yt=we.isMesh&&we.matrixWorld.determinant()<0,st=Co(Y,xe,Re,ke,we);Qe.setMaterial(ke,yt);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(je.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{function et(){if(ke.forEach(function(yt){at.get(yt).currentProgram.isReady()&&ke.delete(yt)}),ke.size===0){we(Y);return}setTimeout(et,10)}je.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 d6;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,L),_=nn.get(Y,E.length),_.init(xe),E.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 yt=0,st=et.length;yt0&&ia(ke,we,Y,xe),Xe&&Dt.render(Y),Ns(S,Y,xe);L!==null&&(ee.updateMultisampleRenderTarget(L),ee.updateRenderTargetMipmap(L)),Y.isScene===!0&&Y.onAfterRender(T,Y,xe),Ae.resetDefaultState(),F=-1,V=null,E.pop(),E.length>0?(_=E[E.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 yt=Ce.update(Y),st=Y.material;st.visible&&S.push(Y,yt,st,Re,Me.z,null)}}else if((Y.isMesh||Y.isLine||Y.isPoints)&&(!Y.frustumCulled||ge.intersectsObject(Y))){const yt=Ce.update(Y),st=Y.material;if(ke&&(Y.boundingSphere!==void 0?(Y.boundingSphere===null&&Y.computeBoundingSphere(),Me.copy(Y.boundingSphere.center)):(yt.boundingSphere===null&&yt.computeBoundingSphere(),Me.copy(yt.boundingSphere.center)),Me.applyMatrix4(Y.matrixWorld).applyMatrix4(Se)),Array.isArray(st)){const Mt=yt.groups;for(let Ft=0,Ht=Mt.length;Ft0&&Ei(we,xe,Re),et.length>0&&Ei(et,xe,Re),yt.length>0&&Ei(yt,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:je.has("EXT_color_buffer_half_float")||je.has("EXT_color_buffer_float")?tv:Ha,minFilter:qo,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:In.workingColorSpace}));const et=_.state.transmissionRenderTarget[ke.id],yt=ke.viewport||k;et.setSize(yt.z,yt.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),je.has("WEBGL_multisampled_render_to_texture")===!1){let Ht=!1;for(let Pt=0,Sn=xe.length;Pt0),Pt=!!Re.morphAttributes.position,Sn=!!Re.morphAttributes.normal,Mn=!!Re.morphAttributes.color;let yn=Cl;ke.toneMapped&&(L===null||L.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),$he(_e),Xhe(_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)&&jt.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]),q_.upload(Q,cu(mt),eo,ee)),ke.isShaderMaterial&&ke.uniformsNeedUpdate===!0&&(q_.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;ci0&&ee.useMultisampledRTT(Y)===!1?we=at.get(Y).__webglMultisampledFramebuffer:Array.isArray(Ht)?we=Ht[Re]:we=Ht,k.copy(Y.viewport),U.copy(Y.scissor),H=Y.scissorTest}else k.copy(q).multiplyScalar(ce).floor(),U.copy($).multiplyScalar(ce).floor(),H=Z;if(Qe.bindFramebuffer(Q.FRAMEBUFFER,we)&&ke&&Qe.drawBuffers(Y,we),Qe.viewport(k),Qe.scissor(U),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(yt){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,yt){if(!(Y&&Y.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let st=at.get(Y).__webglFramebuffer;if(Y.isWebGLCubeRenderTarget&&yt!==void 0&&(st=st[yt]),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=L!==null?at.get(L).__webglFramebuffer:null;Qe.bindFramebuffer(Q.FRAMEBUFFER,Mt)}}},this.readRenderTargetPixelsAsync=async function(Y,xe,Re,ke,we,et,yt){if(!(Y&&Y.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let st=at.get(Y).__webglFramebuffer;if(Y.isWebGLCubeRenderTarget&&yt!==void 0&&(st=st[yt]),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=L!==null?at.get(L).__webglFramebuffer:null;Qe.bindFramebuffer(Q.FRAMEBUFFER,Sn);const Mn=Q.fenceSync(Q.SYNC_GPU_COMMANDS_COMPLETE,0);return Q.flush(),await Whe(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&&(X_("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),yt=xe!==null?xe.x:0,st=xe!==null?xe.y:0;ee.setTexture2D(Y,0),Q.copyTexSubImage2D(Q.TEXTURE_2D,Re,0,0,yt,st,we,et),Qe.unbindTexture()},this.copyTextureToTexture=function(Y,xe,Re=null,ke=null,we=0){Y.isTexture!==!0&&(X_("WebGLRenderer: copyTextureToTexture function signature has changed."),ke=arguments[0]||null,Y=arguments[1],xe=arguments[2],we=arguments[3]||0,Re=null);let et,yt,st,Mt,Ft,Ht;Re!==null?(et=Re.max.x-Re.min.x,yt=Re.max.y-Re.min.y,st=Re.min.x,Mt=Re.min.y):(et=Y.image.width,yt=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,yt,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,yt,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&&(X_("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,yt,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,yt=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,yt=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,yt,st,Yt,Lt,yn.data):xe.isCompressedArrayTexture?Q.compressedTexSubImage3D(mt,we,Pt,Sn,Mn,et,yt,st,Yt,yn.data):Q.texSubImage3D(mt,we,Pt,Sn,Mn,et,yt,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,L=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===YS?"display-p3":"srgb",n.unpackColorSpace=In.workingColorSpace===cx?"display-p3":"srgb"}}class JS{constructor(e,n=25e-5){this.isFogExp2=!0,this.name="",this.color=new ot(e),this.density=n}clone(){return new JS(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class eM{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 eM(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class NR 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=R0,this.updateRanges=[],this.version=0,this.uuid=Mo()}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;ie.far||n.push({distance:l,point:xy.clone(),uv:qs.getInterpolation(xy,i_,_y,s_,AD,_A,TD,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 o_(t,e,n,r,i,s){Pm.subVectors(t,n).addScalar(.5).multiply(r),i!==void 0?(by.x=s*Pm.x-i*Pm.y,by.y=i*Pm.x+s*Pm.y):by.copy(Pm),t.copy(e),t.x+=by.x,t.y+=by.y,t.applyMatrix4(x6)}const a_=new X,CD=new X;class _6 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;r0){let r,i;for(r=1,i=n.length;r0){a_.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(a_);this.getObjectForDistance(i).raycast(e,n)}}update(e){const n=this.levels;if(n.length>1){a_.setFromMatrixPosition(e.matrixWorld),CD.setFromMatrixPosition(this.matrixWorld);const r=a_.distanceTo(CD)/e.zoom;n[0].object.visible=!0;let i,s;for(i=1,s=n.length;i=o)n[i-1].object.visible=!1,n[i].object.visible=!0;else break}for(this._currentLevel=i-1;i=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,MA=new Ct,h0e=new Ct,p0e=new ot(1,1,1),jD=new Ct,EA=new fx,u_=new os,kf=new Bi,My=new X,UD=new X,m0e=new X,AA=new f0e,es=new yr,d_=[];function g0e(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;s65535?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=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;h0e.toArray(o,i*16),s.needsUpdate=!0;const a=this._colorsTexture;return a&&(p0e.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);g0e(x,S,l);const _=x.itemSize;for(let w=x.count,E=c;w=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=this._geometryCount)return null;const r=this._bounds[e],i=r.sphere,s=this.geometry;if(r.sphereInitialized===!1){i.makeEmpty(),this.getBoundingBoxAt(e,u_),u_.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=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({...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&&(jD.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse).multiply(this.matrixWorld),EA.setFromProjectionMatrix(jD,e.coordinateSystem));let S=0;if(this.sortObjects){MA.copy(this.matrixWorld).invert(),My.setFromMatrixPosition(r.matrixWorld).applyMatrix4(MA),UD.set(0,0,-1).transformDirection(r.matrixWorld).transformDirection(MA);for(let E=0,T=l.length;E0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;sr)return;TA.applyMatrix4(t.matrixWorld);const l=e.ray.origin.distanceTo(TA);if(!(le.far))return{distance:l,point:zD.clone().applyMatrix4(t.matrixWorld),index:i,face:null,faceIndex:null,barycoord:null,object:t}}const BD=new X,HD=new X;class Js extends Ul{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;i0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;si.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class v0e 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 y0e 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 iM 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 x0e extends iM{constructor(e,n,r,i,s,o){super(e,n,r,s,o),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=wo,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class b0e extends iM{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 _0e 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 sM 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)i;)s-=i;s0?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]:(g_.subVectors(i[0],i[1]).add(i[0]),c=g_);const f=i[a%s],m=i[(a+1)%s];if(this.closed||a+2i.length-2?i.length-1:o+1],f=i[o>i.length-3?i.length-1:o+2];return r.set(WD(a,l.x,c.x,d.x,f.x),WD(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){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;r1&&!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;n0){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 hx 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 E=0;E<=e.length-1;E++)switch(E){case 0:_=e[E+1].x-e[E].x,w=e[E+1].y-e[E].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[E+1].x-e[E].x,w=e[E+1].y-e[E].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 E=0;E<=n;E++){const T=r+E*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=E/n,m.y=N/(e.length-1),a.push(m.x,m.y);const L=l[3*N+0]*C,F=l[3*N+1],V=l[3*N+0]*O;c.push(L,F,V)}}for(let E=0;E0&&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 E(){const C=new X,O=new X;let N=0;const L=(n-e)/r;for(let F=0;F<=s;F++){const V=[],k=F/s,U=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=U*pe,O.y=-k*r+_,O.z=U*oe,f.push(O.x,O.y,O.z),C.set(pe,L,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;F0&&(d.push(k,U,ne),N+=3),n>0&&(d.push(U,H,ne),N+=3)}c.addGroup(w,N,0),w+=N}function T(C){const O=x,N=new Ve,L=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 U=x;for(let H=0;H<=i;H++){const te=H/i*l+a,pe=Math.cos(te),oe=Math.sin(te);L.x=V*oe,L.y=_*k,L.z=V*pe,f.push(L.x,L.y,L.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.9&&L<.1&&(T<.2&&(o[E+0]+=1),C<.2&&(o[E+2]+=1),O<.2&&(o[E+4]+=1))}}function m(E){s.push(E.x,E.y,E.z)}function y(E,T){const C=E*3;T.x=e[C+0],T.y=e[C+1],T.z=e[C+2]}function x(){const E=new X,T=new X,C=new X,O=new X,N=new Ve,L=new Ve,F=new Ve;for(let V=0,k=0;V80*n){a=c=t[0],l=d=t[1];for(let x=n;xc&&(c=f),m>d&&(d=m);y=Math.max(c-a,d-l),y=y!==0?32767/y:0}return O0(s,o,n,a,l,y,0),o}};function P6(t,e,n,r,i){let s,o;if(i===W0e(t,e,n,r)>0)for(s=e;s=e;s-=r)o=$D(s,t[s],t[s+1],o);return o&&uM(o,o.next)&&(D0(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&&(uM(n,n.next)||vr(n.prev,n,n.next)===0)){if(D0(n),n=e=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==e);return e}function O0(t,e,n,r,i,s,o){if(!t)return;!o&&s&&F0e(t,r,i,s);let a=t,l,c;for(;t.prev!==t.next;){if(l=t.prev,c=t.next,s?N0e(t,r,i,s):R0e(t)){e.push(l.i/n|0),e.push(t.i/n|0),e.push(c.i/n|0),D0(t),t=c.next,a=c.next;continue}if(t=c,t===a){o?o===1?(t=I0e(Bh(t),e,n),O0(t,e,n,r,i,s,2)):o===2&&k0e(t,e,n,r,i,s):O0(Bh(t),e,n,r,i,s,1);break}}}function R0e(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=is?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 N0e(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=al?a>c?a:c:l>c?l:c,_=d>f?d>m?d:m:f>m?f:m,w=YC(y,x,e,n,r),E=YC(S,_,e,n,r);let T=t.prevZ,C=t.nextZ;for(;T&&T.z>=w&&C&&C.z<=E;){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<=E;){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 I0e(t,e,n){let r=t;do{const i=r.prev,s=r.next.next;!uM(i,s)&&R6(i,r,r.next,s)&&L0(i,s)&&L0(s,i)&&(e.push(i.i/n|0),e.push(r.i/n|0),e.push(s.i/n|0),D0(r),D0(r.next),r=t=s),r=r.next}while(r!==t);return Bh(r)}function k0e(t,e,n,r,i,s){let o=t;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&H0e(o,a)){let l=N6(o,a);o=Bh(o,o.next),l=Bh(l,l.next),O0(o,e,n,r,i,s,0),O0(l,e,n,r,i,s,0);return}a=a.next}o=o.next}while(o!==t)}function O0e(t,e,n,r){const i=[];let s,o,a,l,c;for(s=0,o=e.length;s=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.x&&n.x>=l&&s!==n.x&&qm(oi.x||n.x===i.x&&U0e(i,n)))&&(i=n,d=f)),n=n.next;while(n!==a);return i}function U0e(t,e){return vr(t.prev,t,e.prev)<0&&vr(e.next,t,t.next)<0}function F0e(t,e,n,r){let i=t;do i.z===0&&(i.z=YC(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,z0e(i)}function z0e(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;e0||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 YC(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 B0e(t){let e=t,n=t;do(e.x=(t-o)*(s-a)&&(t-o)*(r-a)>=(n-o)*(e-a)&&(n-o)*(s-a)>=(i-o)*(r-a)}function H0e(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!V0e(t,e)&&(L0(t,e)&&L0(e,t)&&G0e(t,e)&&(vr(t.prev,t,e.prev)||vr(t,e.prev,e))||uM(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 uM(t,e){return t.x===e.x&&t.y===e.y}function R6(t,e,n,r){const i=__(vr(t,e,n)),s=__(vr(t,e,r)),o=__(vr(n,r,t)),a=__(vr(n,r,e));return!!(i!==s&&o!==a||i===0&&b_(t,n,e)||s===0&&b_(t,r,e)||o===0&&b_(n,t,r)||a===0&&b_(n,e,r))}function b_(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 __(t){return t>0?1:t<0?-1:0}function V0e(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&&R6(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function L0(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 G0e(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 N6(t,e){const n=new ZC(t.i,t.x,t.y),r=new ZC(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 $D(t,e,n,r){const i=new ZC(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 D0(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 ZC(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 W0e(t,e,n,r){let i=0;for(let s=e,o=n-r;s2&&t[e-1].equals(t[0])&&t.pop()}function qD(t,e){for(let n=0;nNumber.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);je=lt+xt*qe-ue.x,We=rt+at*qe-ue.y;const dt=je*je+We*We;if(dt<=2)return new Ve(je,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?(je=-at,We=xt,Qe=Math.sqrt(Ee)):(je=xt,We=at,Qe=Math.sqrt(Ee/2))}return new Ve(je/Qe,We/Qe)}const K=[];for(let ue=0,Q=te.length,Ge=Q-1,je=ue+1;ue=0;ue--){const Q=ue/_,Ge=y*Math.cos(Q*Math.PI/2),je=x*Math.sin(Q*Math.PI/2)+S;for(let We=0,Qe=te.length;We=0;){const je=Ge;let We=Ge-1;We<0&&(We=ue.length-1);for(let Qe=0,xt=d+_*2;Qe0)&&y.push(T,C,N),(w!==r-1||l0!=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 L6 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=ax,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 D6 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 j6 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=ax,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 F6 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 z6 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 B6(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function H6(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 QC(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 HR(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 K0e(t,e,n,r,i=30){const s=t.clone();s.name=e;const o=[];for(let l=0;l=r)){f.push(c.times[y]);for(let S=0;Ss.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l=a.times[x]){const w=x*f+d,E=w+f-d;S=a.values.slice(w,E)}else{const w=a.createInterpolant(),E=d,T=f-d;w.evaluate(s),S=w.resultBuffer.slice(E,T)}l==="quaternion"&&new qt().fromArray(S).normalize().conjugate().toArray(S);const _=c.times.length;for(let w=0;w<_;++w){const E=w*y+m;if(l==="quaternion")qt.multiplyQuaternionsFlat(c.values,E,S,0,c.values,E);else{const T=y-m*2;for(let C=0;C=s)){const a=n[1];e=s)break t}o=r,r=0;break n}break e}for(;r>>1;en;)--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&&B6(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()===$_,s=e.length-1;let o=1;for(let a=1;a0){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=Og;class np extends qa{constructor(e,n,r){super(e,n,r)}}np.prototype.ValueTypeName="bool";np.prototype.ValueBufferType=Array;np.prototype.DefaultInterpolation=kg;np.prototype.InterpolantFactoryMethodLinear=void 0;np.prototype.InterpolantFactoryMethodSmooth=void 0;class GR extends qa{}GR.prototype.ValueTypeName="color";class Hh extends qa{}Hh.prototype.ValueTypeName="number";class W6 extends sv{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 W6(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=kg;rp.prototype.InterpolantFactoryMethodLinear=void 0;rp.prototype.InterpolantFactoryMethodSmooth=void 0;class Gh extends qa{}Gh.prototype.ValueTypeName="vector";class jg{constructor(e="",n=-1,r=[],i=KS){this.name=e,this.tracks=r,this.duration=n,this.blendMode=i,this.uuid=Mo(),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(J0e(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;a1){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=[];HR(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{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){E();function E(){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,L=d.length;N{w.error(T)})}}});return new Response(_)}else throw new exe(`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{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{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class txe 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;r0: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 xM.createMaterialFromType(e)}static createMaterialFromType(e){const n={ShadowMaterial:k6,SpriteMaterial:IR,RawShaderMaterial:O6,ShaderMaterial:Qo,PointsMaterial:rM,MeshPhysicalMaterial:na,MeshStandardMaterial:gx,MeshPhongMaterial:L6,MeshToonMaterial:D6,MeshNormalMaterial:j6,MeshLambertMaterial:U6,MeshDepthMaterial:PR,MeshDistanceMaterial:RR,MeshBasicMaterial:As,MeshMatcapMaterial:F6,LineDashedMaterial:z6,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;r0){const l=new WR(n);s=new Ug(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,d=e.length;c0){i=new Ug(this.manager),i.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o{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 _6;break;case"Line":o=new Ul(a(e.geometry),l(e.material));break;case"LineLoop":o=new OR(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 LR(a(e.geometry),l(e.material));break;case"Sprite":o=new b6(l(e.material));break;case"Group":o=new Ts;break;case"Bone":o=new nM;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"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 w_;class YR{static getContext(){return w_===void 0&&(w_=new(window.AudioContext||window.webkitAudioContext)),w_}static setContext(e){w_=e}}class uxe 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);YR.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 nj=new Ct,rj=new Ct,Of=new Ct;class dxe{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;rj.elements[12]=-i,nj.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(rj),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(nj)}}class ZR{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=ij(),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=ij();e=(n-this.oldTime)/1e3,this.oldTime=n,this.elapsedTime+=e}return e}}function ij(){return performance.now()}const Lf=new X,sj=new qt,fxe=new X,Df=new X;class hxe extends mn{constructor(){super(),this.type="AudioListener",this.context=YR.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new ZR}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,sj,fxe),Df.set(0,0,-1).applyQuaternion(sj),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 nG=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;e0){this.source.disconnect(this.filters[0]);for(let e=1,n=this.filters.length;e0&&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=.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 QR="\\[\\]\\.:\\/",vxe=new RegExp("["+QR+"]","g"),JR="[^"+QR+"]",yxe="[^"+QR.replace("\\.","")+"]",xxe=/((?:WC+[\/:])*)/.source.replace("WC",JR),bxe=/(WCOD+)?/.source.replace("WCOD",yxe),_xe=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",JR),wxe=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",JR),Sxe=new RegExp("^"+xxe+bxe+_xe+wxe+"$"),Mxe=["material","materials","bones","map"];class Exe{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(vxe,"")}static parseTrackName(e){const n=Sxe.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);Mxe.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){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],f0&&(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 iG{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=VV,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 xR:for(let d=0,f=l.length;d!==f;++d)l[d].evaluate(o),c[d].accumulateAdditive(a);break;case KS: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===GV;if(e===0)return s===-1?i:o&&(s&1)===1?n-i:i;if(r===HV){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=A0,n?i.endingEnd=this.zeroSlopeAtEnd?oh:sh:i.endingEnd=A0)}_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 Txe=new Float32Array(1);class Cxe 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 rG(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=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.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,cj).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 uj=new X,S_=new X;class Oxe{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){uj.subVectors(e,this.start),S_.subVectors(this.end,this.start);const r=S_.dot(S_);let s=S_.dot(uj)/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 dj=new X;class Lxe 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;o1)for(let f=0;f.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{gj.set(e.z,0,-e.x).normalize();const n=Math.acos(e.y);this.quaternion.setFromAxisAngle(gj,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 aG 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 qxe{constructor(){this.type="ShapePath",this.color=new ot,this.subPaths=[],this.currentPath=null}moveTo(e,n){return this.currentPath=new k0,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 E=[];for(let T=0,C=w.length;TNumber.EPSILON){if(k<0&&(L=E[N],V=-V,F=E[O],k=-k),w.yF.y)continue;if(w.y===L.y){if(w.x===L.x)return!0}else{const U=k*(w.x-L.x)-V*(w.y-L.y);if(U===0)return!0;if(U<0)continue;C=!C}}else{if(w.y!==L.y)continue;if(F.x<=w.x&&w.x<=L.x||L.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,E=s.length;w1){let w=!1,E=0;for(let T=0,C=m.length;T0&&w===!1&&(y=f)}let _;for(let w=0,E=m.length;wye||D[ie]!==z[ye]){var ze=` -`+D[ie].replace(" at new "," at ");return p.displayName&&ze.includes("")&&(ze=ze.replace("",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 D={},z;for(z in M)D[z]=g[z];return P&&(p=p.stateNode,p.__reactInternalMemoizedUnmaskedChildContext=g,p.__reactInternalMemoizedMaskedChildContext=D),D}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 D in P)if(!(D in g))throw Error(o(108,F(p)||"Unknown",D));return s({},M,P)}function Ka(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:bM,Ld=Math.log,Ya=Math.LN2;function bM(p){return p>>>=0,p===0?32:31-(Ld(p)/Ya|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,D=p.suspendedLanes,z=p.pingedLanes,ie=M&268435455;if(ie!==0){var ye=ie&~D;ye!==0?P=hu(ye):(z&=ie,z!==0&&(P=hu(z)))}else ie=M&~D,ie!==0?P=hu(ie):z!==0&&(P=hu(z));if(P===0)return 0;if(g!==0&&g!==P&&(g&D)===0&&(D=P&-P,z=g&-g,D>=z||D===16&&(z&4194240)!==0))return g;if((P&4)!==0&&(P|=M&16),g=p.entangledLanes,g!==0)for(p=p.entanglements,g&=P;0M;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>=ie,D-=ie,ca=1<<32-ci(g)+D|M<En?(br=sn,sn=null):br=sn.sibling;var bn=Bt(Ie,sn,Ue[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===Ue.length)return M(Ie,sn),Zn&&Yl(Ie,En),It;if(sn===null){for(;EnEn?(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=Ue.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=Ue.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(Xv){return g(Ie,Xv)}),Zn&&Yl(Ie,En),It}function ys(Ie,be,Ue,gt){if(typeof Ue=="object"&&Ue!==null&&Ue.type===d&&Ue.key===null&&(Ue=Ue.props.children),typeof Ue=="object"&&Ue!==null){switch(Ue.$$typeof){case l:e:{for(var It=Ue.key,on=be;on!==null;){if(on.key===It){if(It=Ue.type,It===d){if(on.tag===7){M(Ie,on.sibling),be=D(on,Ue.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=D(on,Ue.props),be.ref=bu(Ie,on,Ue),be.return=Ie,Ie=be;break e}M(Ie,on);break}else g(Ie,on);on=on.sibling}Ue.type===d?(be=yc(Ue.props.children,Ie.mode,gt,Ue.key),be.return=Ie,Ie=be):(gt=$p(Ue.type,Ue.key,Ue.props,null,Ie.mode,gt),gt.ref=bu(Ie,be,Ue),gt.return=Ie,Ie=gt)}return ie(Ie);case c:e:{for(on=Ue.key;be!==null;){if(be.key===on)if(be.tag===4&&be.stateNode.containerInfo===Ue.containerInfo&&be.stateNode.implementation===Ue.implementation){M(Ie,be.sibling),be=D(be,Ue.children||[]),be.return=Ie,Ie=be;break e}else{M(Ie,be);break}else g(Ie,be);be=be.sibling}be=qp(Ue,Ie.mode,gt),be.return=Ie,Ie=be}return ie(Ie);case T:return on=Ue._init,ys(Ie,be,on(Ue._payload),gt)}if(pe(Ue))return bt(Ie,be,Ue,gt);if(N(Ue))return Jr(Ie,be,Ue,gt);tl(Ie,Ue)}return typeof Ue=="string"&&Ue!==""||typeof Ue=="number"?(Ue=""+Ue,be!==null&&be.tag===6?(M(Ie,be.sibling),be=D(be,Ue),be.return=Ie,Ie=be):(M(Ie,be),be=Xp(Ue,Ie.mode,gt),be.return=Ie,Ie=be),ie(Ie)):M(Ie,be)}return ys}var da=Ax(!0),Tx=Ax(!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 Cx(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 vv(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||qa(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;pM?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 Rx(p,g,M){var P=lo(p);M={lane:P,action:M,hasEagerState:!1,eagerState:null,next:null},Nx(p)?wv(g,M):(Yd(p,g,M),M=Rn(),p=fi(p,P,M),p!==null&&Zd(p,g,P))}function SM(p,g,M){var P=lo(p),D={lane:P,action:M,hasEagerState:!1,eagerState:null,next:null};if(Nx(p))wv(g,D);else{Yd(p,g,D);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(D.hasEagerState=!0,D.eagerState=ye,Ai(ye,ie))return}catch{}finally{}M=Rn(),p=fi(p,P,M),p!==null&&Zd(p,g,P)}}function Nx(p){var g=p.alternate;return p===nr||g!==null&&g===nr}function wv(p,g){No=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,Po(p,M)}}var Cu={readContext:$i,useCallback:Ur,useContext:Ur,useEffect:Ur,useImperativeHandle:Ur,useInsertionEffect:Ur,useLayoutEffect:Ur,useMemo:Ur,useReducer:Ur,useRef:Ur,useState:Ur,useDebugValue:Ur,useDeferredValue:Ur,useTransition:Ur,useMutableSource:Ur,useSyncExternalStore:Ur,useId:Ur,unstable_isNewReconciler:!1},Sv={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,rl(4194308,4,Kd.bind(null,g,p),M)},useLayoutEffect:function(p,g){return rl(4194308,4,p,g)},useInsertionEffect:function(p,g){return rl(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=Rx.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 D=fs.transition;fs.transition={};try{P(p)}finally{fs.transition=D}},[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,D=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||bv(P,g,M)}D.memoizedState=M;var z={value:M,getSnapshot:g};return D.queue=z,Tp(fa.bind(null,P,z,p),[p]),P.flags|=2048,qd(9,_v.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")&&(ze=ze.replace("",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 D={},z;for(z in M)D[z]=g[z];return P&&(p=p.stateNode,p.__reactInternalMemoizedUnmaskedChildContext=g,p.__reactInternalMemoizedMaskedChildContext=D),D}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 D in P)if(!(D in g))throw Error(o(108,F(p)||"Unknown",D));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:bM,Ld=Math.log,Za=Math.LN2;function bM(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,D=p.suspendedLanes,z=p.pingedLanes,ie=M&268435455;if(ie!==0){var ye=ie&~D;ye!==0?P=hu(ye):(z&=ie,z!==0&&(P=hu(z)))}else ie=M&~D,ie!==0?P=hu(ie):z!==0&&(P=hu(z));if(P===0)return 0;if(g!==0&&g!==P&&(g&D)===0&&(D=P&-P,z=g&-g,D>=z||D===16&&(z&4194240)!==0))return g;if((P&4)!==0&&(P|=M&16),g=p.entangledLanes,g!==0)for(p=p.entanglements,g&=P;0M;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>=ie,D-=ie,ca=1<<32-ci(g)+D|M<En?(br=sn,sn=null):br=sn.sibling;var bn=Bt(Ie,sn,Ue[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===Ue.length)return M(Ie,sn),Zn&&Yl(Ie,En),It;if(sn===null){for(;EnEn?(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=Ue.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=Ue.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(Xv){return g(Ie,Xv)}),Zn&&Yl(Ie,En),It}function ys(Ie,be,Ue,gt){if(typeof Ue=="object"&&Ue!==null&&Ue.type===d&&Ue.key===null&&(Ue=Ue.props.children),typeof Ue=="object"&&Ue!==null){switch(Ue.$$typeof){case l:e:{for(var It=Ue.key,on=be;on!==null;){if(on.key===It){if(It=Ue.type,It===d){if(on.tag===7){M(Ie,on.sibling),be=D(on,Ue.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=D(on,Ue.props),be.ref=bu(Ie,on,Ue),be.return=Ie,Ie=be;break e}M(Ie,on);break}else g(Ie,on);on=on.sibling}Ue.type===d?(be=yc(Ue.props.children,Ie.mode,gt,Ue.key),be.return=Ie,Ie=be):(gt=$p(Ue.type,Ue.key,Ue.props,null,Ie.mode,gt),gt.ref=bu(Ie,be,Ue),gt.return=Ie,Ie=gt)}return ie(Ie);case c:e:{for(on=Ue.key;be!==null;){if(be.key===on)if(be.tag===4&&be.stateNode.containerInfo===Ue.containerInfo&&be.stateNode.implementation===Ue.implementation){M(Ie,be.sibling),be=D(be,Ue.children||[]),be.return=Ie,Ie=be;break e}else{M(Ie,be);break}else g(Ie,be);be=be.sibling}be=qp(Ue,Ie.mode,gt),be.return=Ie,Ie=be}return ie(Ie);case T:return on=Ue._init,ys(Ie,be,on(Ue._payload),gt)}if(pe(Ue))return bt(Ie,be,Ue,gt);if(N(Ue))return Jr(Ie,be,Ue,gt);nl(Ie,Ue)}return typeof Ue=="string"&&Ue!==""||typeof Ue=="number"?(Ue=""+Ue,be!==null&&be.tag===6?(M(Ie,be.sibling),be=D(be,Ue),be.return=Ie,Ie=be):(M(Ie,be),be=Xp(Ue,Ie.mode,gt),be.return=Ie,Ie=be),ie(Ie)):M(Ie,be)}return ys}var da=Ax(!0),Tx=Ax(!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 Cx(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 vv(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;pM?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 Rx(p,g,M){var P=lo(p);M={lane:P,action:M,hasEagerState:!1,eagerState:null,next:null},Nx(p)?wv(g,M):(Yd(p,g,M),M=Rn(),p=fi(p,P,M),p!==null&&Zd(p,g,P))}function SM(p,g,M){var P=lo(p),D={lane:P,action:M,hasEagerState:!1,eagerState:null,next:null};if(Nx(p))wv(g,D);else{Yd(p,g,D);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(D.hasEagerState=!0,D.eagerState=ye,Ai(ye,ie))return}catch{}finally{}M=Rn(),p=fi(p,P,M),p!==null&&Zd(p,g,P)}}function Nx(p){var g=p.alternate;return p===nr||g!==null&&g===nr}function wv(p,g){No=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,Po(p,M)}}var Cu={readContext:$i,useCallback:Ur,useContext:Ur,useEffect:Ur,useImperativeHandle:Ur,useInsertionEffect:Ur,useLayoutEffect:Ur,useMemo:Ur,useReducer:Ur,useRef:Ur,useState:Ur,useDebugValue:Ur,useDeferredValue:Ur,useTransition:Ur,useMutableSource:Ur,useSyncExternalStore:Ur,useId:Ur,unstable_isNewReconciler:!1},Sv={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=Rx.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 D=fs.transition;fs.transition={};try{P(p)}finally{fs.transition=D}},[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,D=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||bv(P,g,M)}D.memoizedState=M;var z={value:M,getSnapshot:g};return D.queue=z,Tp(fa.bind(null,P,z,p),[p]),P.flags|=2048,qd(9,_v.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++,0al&&(g.flags|=128,P=!0,pa(D,!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(D,!0),D.tail===null&&D.tailMode==="hidden"&&!z.alternate&&!Zn)return pr(g),null}else 2*Rr()-D.renderingStartTime>al&&M!==1073741824&&(g.flags|=128,P=!0,pa(D,!1),g.lanes=4194304);D.isBackwards?(z.sibling=g.child,g.child=z):(p=D.last,p!==null?p.sibling=z:g.child=z,D.last=z)}return D.tail!==null?(g=D.tail,D.rendering=g,D.tail=g.sibling,D.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 Cv=a.ReactCurrentOwner,Fr=!1;function ar(p,g,M,P){g.child=p===null?Tx(g,null,M,P):da(g,p.child,M,P)}function $n(p,g,M,P,D){M=M.render;var z=g.ref;return mu(g,D),P=Mu(p,g,M,P,z,D),M=nl(),p!==null&&!Fr?(g.updateQueue=p.updateQueue,g.flags&=-2053,p.lanes&=~D,qi(p,g,D)):(Zn&&M&&hv(g),g.flags|=1,ar(p,g,P,D),g.child)}function Gn(p,g,M,P,D){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,D)):(p=$p(M.type,null,P,g,g.mode,D),p.ref=g.ref,p.return=g,g.child=p)}if(z=p.child,(p.lanes&D)===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,D)}return g.flags|=1,p=Ma(z,P),p.ref=g.ref,p.return=g,g.child=p}function ma(p,g,M,P,D){if(p!==null&&to(p.memoizedProps,P)&&p.ref===g.ref)if(Fr=!1,(p.lanes&D)!==0)(p.flags&131072)!==0&&(Fr=!0);else return g.lanes=p.lanes,qi(p,g,D);return ga(p,g,M,P,D)}function Kr(p,g,M){var P=g.pendingProps,D=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,D,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,D){var z=kn(M)?Pr:xn.current;return z=li(g,z),mu(g,D),M=Mu(p,g,M,P,z,D),P=nl(),p!==null&&!Fr?(g.updateQueue=p.updateQueue,g.flags&=-2053,p.lanes&=~D,qi(p,g,D)):(Zn&&P&&hv(g),g.flags|=1,ar(p,g,M,D),g.child)}function sc(p,g,M,P,D){if(kn(M)){var z=!0;Ka(g)}else z=!1;if(mu(g,D),g.stateNode===null)p!==null&&(p.alternate=null,g.alternate=null,g.flags|=2),wx(g,M,P),fv(g,M,P,D),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)&&Sx(g,ie,P,tt),Ds=!1;var Bt=g.memoizedState;ie.state=Bt,mp(g,P,ie,D),ze=g.memoizedState,ye!==P||Bt!==ze||en.current||Ds?(typeof St=="function"&&(uv(g,M,St,P),ze=g.memoizedState),(ye=Ds||dv(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,cv(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)&&Sx(g,ie,P,ze),Ds=!1,Bt=g.memoizedState,ie.state=Bt,mp(g,P,ie,D);var bt=g.memoizedState;ye!==rn||Bt!==bt||en.current||Ds?(typeof ln=="function"&&(uv(g,M,ln,P),bt=g.memoizedState),(tt=Ds||dv(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,D)}function ui(p,g,M,P,D,z){Pi(p,g);var ie=(g.flags&128)!==0;if(!P&&!ie)return D&&Xr(g,M,!1),qi(p,g,z);P=g.stateNode,Cv.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,D&&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 Pv(p,g,M,P,D){return xu(),bp(D),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 Rv(p,g,M){var P=g.pendingProps,D=tr.current,z=!1,ie=(g.flags&128)!==0,ye;if((ye=ie)||(ye=p!==null&&p.memoizedState===null?!1:(D&2)!==0),ye?(z=!0,g.flags&=-129):(p===null||p.memoizedState!==null)&&(D|=1),Lt(tr,D&1),p===null)return el(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):(D=P.children,p=P.fallback,z?(P=g.mode,z=g.child,D={mode:"hidden",children:D},(P&1)===0&&z!==null?(z.childLanes=0,z.pendingProps=D):z=mf(D,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,D));if(D=p.memoizedState,D!==null){if(ye=D.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,D=g.mode,P=mf({mode:"visible",children:P.children},D,0,null),z=yc(z,D,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!==D.retryLane&&(D.retryLane=P,fi(p,P,-1))}Vp(),g=tf(p,g,M,Error(o(421)))}else qa(ye)?(g.flags|=128,g.child=p.child,g=jx.bind(null,p),ia(ye,g),g=null):(M=D.treeContext,Q&&(qr=cu(ye),Ci=g,Zn=!0,Us=null,yu=!1,M!==null&&(js[us++]=ca,js[us++]=ua,js[us++]=Kl,ca=M.id,ua=M.overflow,Kl=g)),g=so(g,g.pendingProps.children),g.flags|=4096);return g}return z?(P=jp(p,g,P.children,P.fallback,M),z=g.child,D=p.child.memoizedState,z.memoizedState=D===null?oc(M):{baseLanes:D.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=jp(p,g,P.children,P.fallback,M),z=g.child,D=p.child.memoizedState,z.memoizedState=D===null?oc(M):{baseLanes:D.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 D=p.child;return p=D.sibling,M=Ma(D,{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 jp(p,g,M,P,D){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,D,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 kx(p,g,M){p.lanes|=g;var P=p.alternate;P!==null&&(P.lanes|=g),ql(p.return,g,M)}function ko(p,g,M,P,D){var z=p.memoizedState;z===null?p.memoizedState={isBackwards:g,rendering:null,renderingStartTime:0,last:P,tail:M,tailMode:D}:(z.isBackwards=g,z.rendering=null,z.renderingStartTime=0,z.last=P,z.tail=M,z.tailMode=D)}function ac(p,g,M){var P=g.pendingProps,D=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&&kx(p,M,g);else if(p.tag===19)kx(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(D){case"forwards":for(M=g.child,D=null;M!==null;)p=M.alternate,p!==null&&wp(p)===null&&(D=M),M=M.sibling;M=D,M===null?(D=g.child,g.child=null):(D=M.sibling,M.sibling=null),ko(g,!1,D,M,z);break;case"backwards":for(M=null,D=g.child,g.child=null;D!==null;){if(p=D.alternate,p!==null&&wp(p)===null){g.child=D;break}p=D.sibling,D.sibling=M,M=D,D=p}ko(g,!0,M,null,z);break;case"together":ko(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),Oo|=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 Up(p,g,M){switch(g.tag){case 3:Qd(g),xu();break;case 5:Cx(g);break;case 1:kn(g.type)&&Ka(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?Rv(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 D=g.memoizedState;if(D!==null&&(D.rendering=null,D.tail=null,D.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(pv(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 vv(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 Nv=!1;function Iv(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,D=M.memoizedState,z=p.stateNode,ie=z.getSnapshotBeforeUpdate(p.elementType===p.type?P:Wi(p.type,P),D);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=Nv,Nv=!1,M}function ya(p,g,M){var P=g.updateQueue;if(P=P!==null?P.lastEffect:null,P!==null){var D=P=P.next;do{if((D.tag&p)===p){var z=D.destroy;D.destroy=void 0,z!==void 0&&va(g,M,z)}D=D.next}while(D!==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(Ro&&typeof Ro.onCommitFiberUnmount=="function")try{Ro.onCommitFiberUnmount(jd,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 D=P,z=D.destroy;D=D.tag,z!==void 0&&((D&2)!==0||(D&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?Lv(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 kv(p){var g=p.alternate;g!==null&&(p.alternate=null,kv(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 Ov(p){return p.tag===5||p.tag===3||p.tag===4}function zp(p){e:for(;;){for(;p.sibling===null;){if(p.return===null||Ov(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(Ov(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?jt(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 Lv(p,g,M){for(var P=g,D=!1,z,ie;;){if(!D){D=P.return;e:for(;;){if(D===null)throw Error(o(160));switch(z=D.stateNode,D.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}D=D.return}D=!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&&(D=!1)}P.sibling.return=P.return,P=P.sibling}}function sl(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 D=g.type,z=g.updateQueue;g.updateQueue=null,z!==null&&Dt(M,z,D,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 D=Ux.bind(null,p,P);M.has(P)||(M.add(P),P.then(D,D))})}}function EM(p,g){for(ct=g;ct!==null;){g=ct;var M=g.deletions;if(M!==null)for(var P=0;P";case uc:return":has("+(ol(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;PD&&(D=ie),P&=~z}if(P=D,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,10p?16:p,Lo===null)var P=!1;else{if(p=Lo,Lo=null,gc=0,(an&6)!==0)throw Error(o(331));var D=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;zeRr()-cf?Sa(p,0):pc|=M),Ki(p,g)}function Wv(p,g){g===0&&((p.mode&1)===0?g=1:(g=Pn,Pn<<=1,(Pn&130023424)===0&&(Pn=4194304)));var M=Rn();p=ll(p,g),p!==null&&(Vl(p,g,M),Ki(p,M))}function jx(p){var g=p.memoizedState,M=0;g!==null&&(M=g.retryLane),Wv(p,M)}function Ux(p,g){var M=0;switch(p.tag){case 13:var P=p.stateNode,D=p.memoizedState;D!==null&&(M=D.retryLane);break;case 19:P=p.stateNode;break;default:throw Error(o(314))}P!==null&&P.delete(g),Wv(p,M)}var $v;$v=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,Up(p,g,M);Fr=(p.flags&131072)!==0}else Fr=!1,Zn&&(g.flags&1048576)!==0&&Mx(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 D=li(g,xn.current);mu(g,M),D=Mu(null,g,P,p,D,M);var z=nl();return g.flags|=1,typeof D=="object"&&D!==null&&typeof D.render=="function"&&D.$$typeof===void 0?(g.tag=1,g.memoizedState=null,g.updateQueue=null,kn(P)?(z=!0,Ka(g)):z=!1,g.memoizedState=D.state!==null&&D.state!==void 0?D.state:null,gu(g),D.updater=gp,g.stateNode=D,D._reactInternals=g,fv(g,P,p,M),g=ui(null,g,P,!0,z,M)):(g.tag=0,Zn&&z&&hv(g),ar(null,g,D,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,D=P._init,P=D(P._payload),g.type=P,D=g.tag=AM(P),p=Wi(P,p),D){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,D=g.pendingProps,D=g.elementType===P?D:Wi(P,D),ga(p,g,P,D,M);case 1:return P=g.type,D=g.pendingProps,D=g.elementType===P?D:Wi(P,D),sc(p,g,P,D,M);case 3:e:{if(Qd(g),p===null)throw Error(o(387));P=g.pendingProps,z=g.memoizedState,D=z.element,cv(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){D=Error(o(423)),g=Pv(p,g,P,M,D);break e}else if(P!==D){D=Error(o(424)),g=Pv(p,g,P,M,D);break e}else for(Q&&(qr=sa(g.stateNode.containerInfo),Ci=g,Zn=!0,Us=null,yu=!1),M=Tx(g,null,P,M),g.child=M;M;)M.flags=M.flags&-3|4096,M=M.sibling;else{if(xu(),P===D){g=qi(p,g,M);break e}ar(p,g,P,M)}g=g.child}return g;case 5:return Cx(g),p===null&&el(g),P=g.type,D=g.pendingProps,z=p!==null?p.memoizedProps:null,ie=D.children,fe(P,D)?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&&el(g),null;case 13:return Rv(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,D=g.pendingProps,D=g.elementType===P?D:Wi(P,D),$n(p,g,P,D,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,D=g.pendingProps,z=g.memoizedProps,ie=D.value,Xl(g,P,ie),z!==null)if(Ai(z.value,ie)){if(z.children===D.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,D.children,M),g=g.child}return g;case 9:return D=g.type,P=g.pendingProps.children,mu(g,M),D=$i(D),P=P(D),g.flags|=1,ar(p,g,P,M),g.child;case 14:return P=g.type,D=Wi(P,g.pendingProps),D=Wi(P.type,D),Gn(p,g,P,D,M);case 15:return ma(p,g,g.type,g.pendingProps,M);case 17:return P=g.type,D=g.pendingProps,D=g.elementType===P?D:Wi(P,D),p!==null&&(p.alternate=null,g.alternate=null,g.flags|=2),g.tag=1,kn(P)?(p=!0,Ka(g)):p=!1,mu(g,M),wx(g,P,D),fv(g,P,D,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 Fx(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 Fx(p,g,M,P)}function Wp(p){return p=p.prototype,!(!p||!p.isReactComponent)}function AM(p){if(typeof p=="function")return Wp(p)?1:0;if(p!=null){if(p=p.$$typeof,p===S)return 11;if(p===E)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,D,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,D,z,g);case f:ie=8,D|=8;break;case m:return p=vs(12,M,g,D|2),p.elementType=m,p.lanes=z,p;case _:return p=vs(13,M,g,D),p.elementType=_,p.lanes=z,p;case w:return p=vs(19,M,g,D),p.elementType=w,p.lanes=z,p;case C:return mf(M,D,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 E: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,D),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,D){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=D,Q&&(this.mutableSourceEagerHydrationData=null)}function zx(p,g,M,P,D,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 Bx(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 Hx(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=tt&&z>=rn&&D<=St&&ie<=Bt){p.splice(g,1);break}else if(P!==tt||M.width!==ze.width||Btie){if(!(z!==rn||M.height!==ze.height||StD)){tt>P&&(ze.width+=tt-P,ze.x=P),Stz&&(ze.height+=rn-z,ze.y=z),BtM&&(M=ie)),iell&&(g.flags|=128,P=!0,pa(D,!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(D,!0),D.tail===null&&D.tailMode==="hidden"&&!z.alternate&&!Zn)return pr(g),null}else 2*Rr()-D.renderingStartTime>ll&&M!==1073741824&&(g.flags|=128,P=!0,pa(D,!1),g.lanes=4194304);D.isBackwards?(z.sibling=g.child,g.child=z):(p=D.last,p!==null?p.sibling=z:g.child=z,D.last=z)}return D.tail!==null?(g=D.tail,D.rendering=g,D.tail=g.sibling,D.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 Cv=a.ReactCurrentOwner,Fr=!1;function ar(p,g,M,P){g.child=p===null?Tx(g,null,M,P):da(g,p.child,M,P)}function $n(p,g,M,P,D){M=M.render;var z=g.ref;return mu(g,D),P=Mu(p,g,M,P,z,D),M=rl(),p!==null&&!Fr?(g.updateQueue=p.updateQueue,g.flags&=-2053,p.lanes&=~D,qi(p,g,D)):(Zn&&M&&hv(g),g.flags|=1,ar(p,g,P,D),g.child)}function Gn(p,g,M,P,D){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,D)):(p=$p(M.type,null,P,g,g.mode,D),p.ref=g.ref,p.return=g,g.child=p)}if(z=p.child,(p.lanes&D)===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,D)}return g.flags|=1,p=Ma(z,P),p.ref=g.ref,p.return=g,g.child=p}function ma(p,g,M,P,D){if(p!==null&&to(p.memoizedProps,P)&&p.ref===g.ref)if(Fr=!1,(p.lanes&D)!==0)(p.flags&131072)!==0&&(Fr=!0);else return g.lanes=p.lanes,qi(p,g,D);return ga(p,g,M,P,D)}function Kr(p,g,M){var P=g.pendingProps,D=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,D,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,D){var z=kn(M)?Pr:xn.current;return z=li(g,z),mu(g,D),M=Mu(p,g,M,P,z,D),P=rl(),p!==null&&!Fr?(g.updateQueue=p.updateQueue,g.flags&=-2053,p.lanes&=~D,qi(p,g,D)):(Zn&&P&&hv(g),g.flags|=1,ar(p,g,M,D),g.child)}function sc(p,g,M,P,D){if(kn(M)){var z=!0;Ya(g)}else z=!1;if(mu(g,D),g.stateNode===null)p!==null&&(p.alternate=null,g.alternate=null,g.flags|=2),wx(g,M,P),fv(g,M,P,D),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)&&Sx(g,ie,P,tt),Ds=!1;var Bt=g.memoizedState;ie.state=Bt,mp(g,P,ie,D),ze=g.memoizedState,ye!==P||Bt!==ze||en.current||Ds?(typeof St=="function"&&(uv(g,M,St,P),ze=g.memoizedState),(ye=Ds||dv(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,cv(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)&&Sx(g,ie,P,ze),Ds=!1,Bt=g.memoizedState,ie.state=Bt,mp(g,P,ie,D);var bt=g.memoizedState;ye!==rn||Bt!==bt||en.current||Ds?(typeof ln=="function"&&(uv(g,M,ln,P),bt=g.memoizedState),(tt=Ds||dv(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,D)}function ui(p,g,M,P,D,z){Pi(p,g);var ie=(g.flags&128)!==0;if(!P&&!ie)return D&&Xr(g,M,!1),qi(p,g,z);P=g.stateNode,Cv.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,D&&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 Pv(p,g,M,P,D){return xu(),bp(D),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 Rv(p,g,M){var P=g.pendingProps,D=tr.current,z=!1,ie=(g.flags&128)!==0,ye;if((ye=ie)||(ye=p!==null&&p.memoizedState===null?!1:(D&2)!==0),ye?(z=!0,g.flags&=-129):(p===null||p.memoizedState!==null)&&(D|=1),Lt(tr,D&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):(D=P.children,p=P.fallback,z?(P=g.mode,z=g.child,D={mode:"hidden",children:D},(P&1)===0&&z!==null?(z.childLanes=0,z.pendingProps=D):z=mf(D,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,D));if(D=p.memoizedState,D!==null){if(ye=D.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,D=g.mode,P=mf({mode:"visible",children:P.children},D,0,null),z=yc(z,D,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!==D.retryLane&&(D.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=jx.bind(null,p),ia(ye,g),g=null):(M=D.treeContext,Q&&(qr=cu(ye),Ci=g,Zn=!0,Us=null,yu=!1,M!==null&&(js[us++]=ca,js[us++]=ua,js[us++]=Kl,ca=M.id,ua=M.overflow,Kl=g)),g=so(g,g.pendingProps.children),g.flags|=4096);return g}return z?(P=jp(p,g,P.children,P.fallback,M),z=g.child,D=p.child.memoizedState,z.memoizedState=D===null?oc(M):{baseLanes:D.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=jp(p,g,P.children,P.fallback,M),z=g.child,D=p.child.memoizedState,z.memoizedState=D===null?oc(M):{baseLanes:D.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 D=p.child;return p=D.sibling,M=Ma(D,{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 jp(p,g,M,P,D){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,D,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 kx(p,g,M){p.lanes|=g;var P=p.alternate;P!==null&&(P.lanes|=g),ql(p.return,g,M)}function ko(p,g,M,P,D){var z=p.memoizedState;z===null?p.memoizedState={isBackwards:g,rendering:null,renderingStartTime:0,last:P,tail:M,tailMode:D}:(z.isBackwards=g,z.rendering=null,z.renderingStartTime=0,z.last=P,z.tail=M,z.tailMode=D)}function ac(p,g,M){var P=g.pendingProps,D=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&&kx(p,M,g);else if(p.tag===19)kx(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(D){case"forwards":for(M=g.child,D=null;M!==null;)p=M.alternate,p!==null&&wp(p)===null&&(D=M),M=M.sibling;M=D,M===null?(D=g.child,g.child=null):(D=M.sibling,M.sibling=null),ko(g,!1,D,M,z);break;case"backwards":for(M=null,D=g.child,g.child=null;D!==null;){if(p=D.alternate,p!==null&&wp(p)===null){g.child=D;break}p=D.sibling,D.sibling=M,M=D,D=p}ko(g,!0,M,null,z);break;case"together":ko(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),Oo|=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 Up(p,g,M){switch(g.tag){case 3:Qd(g),xu();break;case 5:Cx(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?Rv(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 D=g.memoizedState;if(D!==null&&(D.rendering=null,D.tail=null,D.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(pv(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 vv(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 Nv=!1;function Iv(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,D=M.memoizedState,z=p.stateNode,ie=z.getSnapshotBeforeUpdate(p.elementType===p.type?P:Wi(p.type,P),D);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=Nv,Nv=!1,M}function ya(p,g,M){var P=g.updateQueue;if(P=P!==null?P.lastEffect:null,P!==null){var D=P=P.next;do{if((D.tag&p)===p){var z=D.destroy;D.destroy=void 0,z!==void 0&&va(g,M,z)}D=D.next}while(D!==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(Ro&&typeof Ro.onCommitFiberUnmount=="function")try{Ro.onCommitFiberUnmount(jd,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 D=P,z=D.destroy;D=D.tag,z!==void 0&&((D&2)!==0||(D&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?Lv(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 kv(p){var g=p.alternate;g!==null&&(p.alternate=null,kv(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 Ov(p){return p.tag===5||p.tag===3||p.tag===4}function zp(p){e:for(;;){for(;p.sibling===null;){if(p.return===null||Ov(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(Ov(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?jt(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 Lv(p,g,M){for(var P=g,D=!1,z,ie;;){if(!D){D=P.return;e:for(;;){if(D===null)throw Error(o(160));switch(z=D.stateNode,D.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}D=D.return}D=!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&&(D=!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 D=g.type,z=g.updateQueue;g.updateQueue=null,z!==null&&Dt(M,z,D,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 D=Ux.bind(null,p,P);M.has(P)||(M.add(P),P.then(D,D))})}}function EM(p,g){for(ct=g;ct!==null;){g=ct;var M=g.deletions;if(M!==null)for(var P=0;P";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;PD&&(D=ie),P&=~z}if(P=D,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,10p?16:p,Lo===null)var P=!1;else{if(p=Lo,Lo=null,gc=0,(an&6)!==0)throw Error(o(331));var D=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;zeRr()-cf?Sa(p,0):pc|=M),Ki(p,g)}function Wv(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 jx(p){var g=p.memoizedState,M=0;g!==null&&(M=g.retryLane),Wv(p,M)}function Ux(p,g){var M=0;switch(p.tag){case 13:var P=p.stateNode,D=p.memoizedState;D!==null&&(M=D.retryLane);break;case 19:P=p.stateNode;break;default:throw Error(o(314))}P!==null&&P.delete(g),Wv(p,M)}var $v;$v=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,Up(p,g,M);Fr=(p.flags&131072)!==0}else Fr=!1,Zn&&(g.flags&1048576)!==0&&Mx(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 D=li(g,xn.current);mu(g,M),D=Mu(null,g,P,p,D,M);var z=rl();return g.flags|=1,typeof D=="object"&&D!==null&&typeof D.render=="function"&&D.$$typeof===void 0?(g.tag=1,g.memoizedState=null,g.updateQueue=null,kn(P)?(z=!0,Ya(g)):z=!1,g.memoizedState=D.state!==null&&D.state!==void 0?D.state:null,gu(g),D.updater=gp,g.stateNode=D,D._reactInternals=g,fv(g,P,p,M),g=ui(null,g,P,!0,z,M)):(g.tag=0,Zn&&z&&hv(g),ar(null,g,D,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,D=P._init,P=D(P._payload),g.type=P,D=g.tag=AM(P),p=Wi(P,p),D){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,D=g.pendingProps,D=g.elementType===P?D:Wi(P,D),ga(p,g,P,D,M);case 1:return P=g.type,D=g.pendingProps,D=g.elementType===P?D:Wi(P,D),sc(p,g,P,D,M);case 3:e:{if(Qd(g),p===null)throw Error(o(387));P=g.pendingProps,z=g.memoizedState,D=z.element,cv(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){D=Error(o(423)),g=Pv(p,g,P,M,D);break e}else if(P!==D){D=Error(o(424)),g=Pv(p,g,P,M,D);break e}else for(Q&&(qr=sa(g.stateNode.containerInfo),Ci=g,Zn=!0,Us=null,yu=!1),M=Tx(g,null,P,M),g.child=M;M;)M.flags=M.flags&-3|4096,M=M.sibling;else{if(xu(),P===D){g=qi(p,g,M);break e}ar(p,g,P,M)}g=g.child}return g;case 5:return Cx(g),p===null&&tl(g),P=g.type,D=g.pendingProps,z=p!==null?p.memoizedProps:null,ie=D.children,fe(P,D)?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 Rv(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,D=g.pendingProps,D=g.elementType===P?D:Wi(P,D),$n(p,g,P,D,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,D=g.pendingProps,z=g.memoizedProps,ie=D.value,Xl(g,P,ie),z!==null)if(Ai(z.value,ie)){if(z.children===D.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,D.children,M),g=g.child}return g;case 9:return D=g.type,P=g.pendingProps.children,mu(g,M),D=$i(D),P=P(D),g.flags|=1,ar(p,g,P,M),g.child;case 14:return P=g.type,D=Wi(P,g.pendingProps),D=Wi(P.type,D),Gn(p,g,P,D,M);case 15:return ma(p,g,g.type,g.pendingProps,M);case 17:return P=g.type,D=g.pendingProps,D=g.elementType===P?D:Wi(P,D),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),wx(g,P,D),fv(g,P,D,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 Fx(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 Fx(p,g,M,P)}function Wp(p){return p=p.prototype,!(!p||!p.isReactComponent)}function AM(p){if(typeof p=="function")return Wp(p)?1:0;if(p!=null){if(p=p.$$typeof,p===S)return 11;if(p===E)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,D,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,D,z,g);case f:ie=8,D|=8;break;case m:return p=vs(12,M,g,D|2),p.elementType=m,p.lanes=z,p;case _:return p=vs(13,M,g,D),p.elementType=_,p.lanes=z,p;case w:return p=vs(19,M,g,D),p.elementType=w,p.lanes=z,p;case C:return mf(M,D,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 E: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,D),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,D){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=D,Q&&(this.mutableSourceEagerHydrationData=null)}function zx(p,g,M,P,D,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 Bx(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 Hx(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=tt&&z>=rn&&D<=St&&ie<=Bt){p.splice(g,1);break}else if(P!==tt||M.width!==ze.width||Btie){if(!(z!==rn||M.height!==ze.height||StD)){tt>P&&(ze.width+=tt-P,ze.x=P),Stz&&(ze.height+=rn-z,ze.y=z),BtM&&(M=ie)),ie ")+` 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||Vx,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{jd=g.inject(p),Ro=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 D=rt(p,M,P).disconnect;return{disconnect:function(){D()}}},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 D=g.current,z=Rn(),ie=lo(D);return M=Bx(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),Qa(D,g),p=fi(D,ie,z),p!==null&&hp(p,D,ie),ie},n}),zA}var Sj;function obe(){return Sj||(Sj=1,jA.exports=sbe()),jA.exports}var abe=obe();const lbe=B1(abe);var BA={exports:{}},HA={};/** + `)+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||Vx,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{jd=g.inject(p),Ro=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 D=rt(p,M,P).disconnect;return{disconnect:function(){D()}}},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 D=g.current,z=Rn(),ie=lo(D);return M=Bx(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(D,g),p=fi(D,ie,z),p!==null&&hp(p,D,ie),ie},n}),zA}var Sj;function obe(){return Sj||(Sj=1,jA.exports=sbe()),jA.exports}var abe=obe();const lbe=B1(abe);var BA={exports:{}},HA={};/** * @license React * scheduler.production.min.js * @@ -4461,14 +4461,14 @@ No matching component was found for: * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Mj;function cbe(){return Mj||(Mj=1,(function(t){function e(B,K){var q=B.length;B.push(K);e:for(;0>>1,Z=B[$];if(0>>1;$i(fe,q))_ei(Se,fe)?(B[$]=Se,B[_e]=q,$=_e):(B[$]=fe,B[ae]=q,$=ae);else if(_ei(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,E=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&&!U());){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,L=null,F=-1,V=5,k=-1;function U(){return!(t.unstable_now()-kB||125$?(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=U,t.unstable_wrapCallback=function(B){var K=m;return function(){var q=m;m=K;try{return B.apply(this,arguments)}finally{m=q}}}})(HA)),HA}var Ej;function ube(){return Ej||(Ej=1,BA.exports=cbe()),BA.exports}var Aj=ube();const nN={},dbe=t=>void Object.assign(nN,t);function fbe(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=nN[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"&&WA(_,y),_}function r(d,f){let m=!1;if(f){var y,x;(y=f.__r3f)!=null&&y.attach?GA(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,rP(f),zm(f)}}function i(d,f,m){let y=!1;if(f){var x,S;if((x=f.__r3f)!=null&&x.attach)GA(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(E=>E!==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,rP(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)Nj(d,f,f.__r3f.attach);else if(f.isObject3D&&d.isObject3D){var _;d.remove(f),(_=f.__r3f)!=null&&_.root&&xbe(K_(f),f)}const E=(S=f.__r3f)==null?void 0:S.primitive,T=!E&&(m===void 0?f.dispose!==null:m);if(!E){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"?Aj.unstable_scheduleCallback(Aj.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&&K_(_).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:lbe({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,...E}=y,{args:T=[],children:C,...O}=m;if(!Array.isArray(_))throw new Error("R3F: the args prop must be an array!");if(_.some((L,F)=>L!==T[F]))return[!0];const N=pG(d,E,O,!0);return N.changes.length?[!1,N]:null}},commitUpdate(d,[f,m],y,x,S,_){f?a(d,y,S,_):WA(d,m)},commitMount(d,f,m,y){var x;const S=(x=d.__r3f)!=null?x:{};d.raycast&&S.handlers&&S.eventCount&&K_(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&&Nj(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&&GA(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:WA}}var Tj,Cj;const VA=t=>"colorSpace"in t||"outputColorSpace"in t,lG=()=>{var t;return(t=nN.ColorManagement)!=null?t:null},cG=t=>t&&t.isOrthographicCamera,hbe=t=>t&&t.hasOwnProperty("current"),vx=typeof window<"u"&&((Tj=window.document)!=null&&Tj.createElement||((Cj=window.navigator)==null?void 0:Cj.product)==="ReactNative")?R.useLayoutEffect:R.useEffect;function uG(t){const e=R.useRef(t);return vx(()=>void(e.current=t),[t]),e}function pbe({set:t}){return vx(()=>(t(new Promise(()=>null)),()=>t(!1)),[t]),null}class dG 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}}dG.getDerivedStateFromError=()=>({error:!0});const fG="__default",Pj=new Map,mbe=t=>t&&!!t.memoized&&!!t.changes;function hG(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 Ty=t=>{var e;return(e=t.__r3f)==null?void 0:e.root.getState()};function K_(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 gbe(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 nP(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 Rj=/-\d+$/;function GA(t,e,n){if(ir.str(n)){if(Rj.test(n)){const s=n.replace(Rj,""),{target:o,key:a}=nP(t,s);Array.isArray(o[a])||(o[a]=[])}const{target:r,key:i}=nP(t,n);e.__r3f.previousAttach=r[i],r[i]=e}else e.__r3f.previousAttach=n(t,e)}function Nj(t,e,n){var r,i;if(ir.str(n)){const{target:s,key:o}=nP(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 pG(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{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 E in i){const T=i[E];E.startsWith(`${x}-`)&&m.push([E,T,!1,E.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 WA(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}=mbe(e)?e:pG(t,e),l=r==null?void 0:r.eventCount;t.__r3f&&(t.__r3f.memoizedProps=o);for(let m=0;mT[C],t),!(E&&E.set))){const[T,...C]=_.reverse();w=C.reverse().reduce((O,N)=>O[N],t),y=T}if(x===fG+"remove")if(w.constructor){let T=Pj.get(w.constructor);T||(T=new w.constructor,Pj.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(E&&E.set&&(E.copy||E instanceof Ah)){if(Array.isArray(x))E.fromArray?E.fromArray(x):E.set(...x);else if(E.copy&&x&&x.constructor&&E.constructor===x.constructor)E.copy(x);else if(x!==void 0){var c;const T=(c=E)==null?void 0:c.isColor;!T&&E.setScalar?E.setScalar(x):E instanceof Ah&&x instanceof Ah?E.mask=x.mask:E.set(x),!lG()&&s&&!s.linear&&T&&E.convertSRGBToLinear()}}else{var d;if(w[y]=x,(d=w[y])!=null&&d.isTexture&&w[y].format===is&&w[y].type===Ba&&s){const T=w[y];VA(T)&&VA(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=K_(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&&rP(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 rP(t){t.onUpdate==null||t.onUpdate(t)}function vbe(t,e){t.manual||(cG(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 P_(t){return(t.eventObject||t.object).uuid+"/"+t.index+t.instanceId}function ybe(){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 mG(t,e,n,r){const i=n.get(e);i&&(n.delete(e),n.size===0&&(t.delete(r),i.target.releasePointerCapture(r)))}function xbe(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)=>{mG(n.capturedMap,e,r,i)})}function bbe(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{const T=Ty(w.object),C=Ty(E.object);return!T||!C?w.distance-E.distance:C.events.priority-T.events.priority||w.distance-E.distance}).filter(w=>{const E=P_(w);return f.has(E)?!1:(f.add(E),!0)});d.events.filter&&(S=d.events.filter(S,d));for(const w of S){let E=w.object;for(;E;){var _;(_=E.__r3f)!=null&&_.eventCount&&m.push({...w,eventObject:E}),E=E.parent}}if("pointerId"in l&&d.internal.capturedMap.has(l.pointerId))for(let w of d.internal.capturedMap.get(l.pointerId).values())f.has(P_(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=Ty(x.object)||m,{raycaster:_,pointer:w,camera:E,internal:T}=S,C=new X(w.x,w.y,0).unproject(E),O=k=>{var U,H;return(U=(H=T.capturedMap.get(k))==null?void 0:H.has(x.eventObject))!=null?U:!1},N=k=>{const U={intersection:x,target:c.target};T.capturedMap.has(k)?T.capturedMap.get(k).set(x.eventObject,U):T.capturedMap.set(k,new Map([[x.eventObject,U]])),c.target.setPointerCapture(k)},L=k=>{const U=T.capturedMap.get(k);U&&mG(T.capturedMap,x.eventObject,U,k)};let F={};for(let k in c){let U=c[k];typeof U!="function"&&(F[k]=U)}let V={...x,...F,pointer:w,intersections:l,stopped:y.stopped,delta:d,unprojectedPoint:C,ray:_.ray,camera:E,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(U=>U.eventObject===x.eventObject))){const U=l.slice(0,l.indexOf(x));s([...U,x])}},target:{hasPointerCapture:O,setPointerCapture:N,releasePointerCapture:L},currentTarget:{hasPointerCapture:O,setPointerCapture:N,releasePointerCapture:L},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(P_(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;ds([]);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 E(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 L=P_(T),F=m.hovered.get(L);F?F.stopped&&T.stopPropagation():(m.hovered.set(L,T),N.onPointerOver==null||N.onPointerOver(T),N.onPointerEnter==null||N.onPointerEnter(T))}N.onPointerMove==null||N.onPointerMove(T)}else{const L=N[l];L?(!x||m.initialHits.includes(C))&&(o(d,m.interaction.filter(F=>!m.initialHits.includes(F))),L(T)):x&&m.initialHits.includes(C)&&o(d,m.interaction.filter(F=>!m.initialHits.includes(F)))}}i(_,d,w,E)}}return{handlePointer:a}}const gG=t=>!!(t!=null&&t.render),vG=R.createContext(null),_be=(t,e)=>{const n=nbe((a,l)=>{const c=new X,d=new X,f=new X;function m(w=l().camera,E=d,T=l().size){const{width:C,height:O,top:N,left:L}=T,F=C/O;E.isVector3?f.copy(E):f.set(...E);const V=w.getWorldPosition(c).distanceTo(f);if(cG(w))return{width:C/w.zoom,height:O/w.zoom,top:N,left:L,factor:1,distance:V,aspect:F};{const k=w.fov*Math.PI/180,U=2*Math.tan(k/2)*V,H=U*(C/O);return{width:H,height:U,top:N,left:L,factor:C/H,distance:V,aspect:F}}}let y;const x=w=>a(E=>({performance:{...E.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,E)=>e(w,E,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new ZR,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(E=>({...E,events:{...E.events,...w}})),setSize:(w,E,T,C,O)=>{const N=l().camera,L={width:w,height:E,top:C||0,left:O||0,updateStyle:T};a(F=>({size:L,viewport:{...F.viewport,...m(N,d,L)}}))},setDpr:w=>a(E=>{const T=hG(w);return{viewport:{...E.viewport,dpr:T,initialDpr:E.viewport.initialDpr||T}}}),setFrameloop:(w="always")=>{const E=l().clock;E.stop(),E.elapsedTime=0,w!=="never"&&(E.start(),E.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,E,T)=>{const C=l().internal;return C.priority=C.priority+(E>0?1:0),C.subscribers.push({ref:w,priority:E,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-(E>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,vbe(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 R_,wbe=new Set,Sbe=new Set,Mbe=new Set;function $A(t,e){if(t.size)for(const{callback:n}of t.values())n(e)}function Cy(t,e){switch(t){case"before":return $A(wbe,e);case"after":return $A(Sbe,e);case"tail":return $A(Mbe,e)}}let XA,qA;function KA(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),XA=e.internal.subscribers,R_=0;R_0)&&!((d=s.gl.xr)!=null&&d.isPresenting)&&(r+=KA(c,s))}if(n=!1,Cy("after",c),r===0)return Cy("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&&Cy("before",c),f)KA(c,f,m);else for(const y of t.values())KA(c,y.store.getState());d&&Cy("after",c)}return{loop:o,invalidate:a,advance:l}}function yG(){const t=R.useContext(vG);if(!t)throw new Error("R3F: Hooks can only be used within the Canvas component!");return t}function nd(t=n=>n,e){return yG()(t,e)}function xG(t,e=0){const n=yG(),r=n.getState().internal.subscribe,i=uG(t);return vx(()=>r(i,e,n),[e,r,n]),null}const Fg=new Map,{invalidate:Ij,advance:kj}=Ebe(Fg),{reconciler:D1,applyProps:Nm}=fbe(Fg,ybe),Im={objects:"shallow",strict:!1},Abe=(t,e)=>{const n=typeof t=="function"?t(e):t;return gG(n)?n:new y6({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...t})};function Tbe(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 Cbe(t){const e=Fg.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||_be(Ij,kj),o=n||D1.createContainer(s,Km.ConcurrentRoot,null,!1,null,"",i,null);e||Fg.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:E=!1,legacy:T=!1,orthographic:C=!1,frameloop:O="always",dpr:N=[1,2],performance:L,raycaster:F,camera:V,onPointerMissed:k}=d,U=s.getState(),H=U.gl;U.gl||U.set({gl:H=Abe(f,t)});let ne=U.raycaster;ne||U.set({raycaster:ne=new sG});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}}),!U.camera||U.camera===c&&!ir.equ(c,V,Im)){c=V;const q=V instanceof ux,$=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())),!U.camera&&!(V!=null&&V.rotation)&&$.lookAt(0,0,0)),U.set({camera:$}),ne.camera=$}if(!U.scene){let q;y!=null&&y.isScene?q=y:(q=new NR,y&&Nm(q,y)),U.set({scene:Fm(q)})}if(!U.xr){var oe;const q=(ge,ae)=>{const fe=s.getState();fe.frameloop!=="never"&&kj(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||Ij(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(),U.set({xr:Z})}if(H.shadowMap){const q=H.shadowMap.enabled,$=H.shadowMap.type;if(H.shadowMap.enabled=!!_,ir.boo(_))H.shadowMap.type=$y;else if(ir.str(_)){var ce;const Z={basic:pV,percentage:zS,soft:$y,variance:ka};H.shadowMap.type=(ce=Z[_])!=null?ce:$y}else ir.obj(_)&&Object.assign(H.shadowMap,_);(q!==H.shadowMap.enabled||$!==H.shadowMap.type)&&(H.shadowMap.needsUpdate=!0)}const B=lG();B&&("enabled"in B?B.enabled=!T:"legacyMode"in B&&(B.legacyMode=T)),l||Nm(H,{outputEncoding:w?3e3:3001,toneMapping:E?Cl:cR}),U.legacy!==T&&U.set(()=>({legacy:T})),U.linear!==w&&U.set(()=>({linear:w})),U.flat!==E&&U.set(()=>({flat:E})),f&&!ir.fun(f)&&!gG(f)&&!ir.equ(f,H,Im)&&Nm(H,f),x&&!U.events.handlers&&U.set({events:x(s)});const K=Tbe(t,m);return ir.equ(K,U.size,Im)||U.setSize(K.width,K.height,K.updateStyle,K.top,K.left),N&&U.viewport.dpr!==hG(N)&&U.setDpr(N),U.frameloop!==O&&U.setFrameloop(O),U.onPointerMissed||U.set({onPointerMissed:k}),L&&!ir.equ(L,U.performance,Im)&&U.set(q=>({performance:{...q.performance,...L}})),a=S,l=!0,this},render(d){return l||this.configure(),D1.updateContainer(v.jsx(Pbe,{store:s,children:d,onCreated:a,rootElement:t}),o,null,()=>{}),s},unmount(){bG(t)}}}function Pbe({store:t,children:e,onCreated:n,rootElement:r}){return vx(()=>{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(vG.Provider,{value:t,children:e})}function bG(t,e){const n=Fg.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),D1.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(),gbe(i),Fg.delete(t)}catch{}},500)})}}D1.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:R.version});const YA={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 Rbe(t){const{handlePointer:e}=bbe(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(YA).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]=YA[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]=YA[s];r.connected.removeEventListener(a,o)}}),n(s=>({events:{...s.events,connected:void 0}}))}}}}function Oj(t,e){let n;return(...r)=>{window.clearTimeout(n),n=window.setTimeout(()=>t(...r),e)}}function Nbe({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:E,top:T,width:C,height:O,bottom:N,right:L,x:F,y:V}=a.current.element.getBoundingClientRect(),k={left:E,top:T,width:C,height:O,bottom:N,right:L,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&&!Lbe(a.current.lastBounds,k)&&o(a.current.lastBounds=k)};return[w,c?Oj(w,c):w,l?Oj(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=_G(w),S())};return kbe(y,!!e),Ibe(m),R.useEffect(()=>{x(),S()},[e,y,m]),R.useEffect(()=>x,[]),[_,s,f]}function Ibe(t){R.useEffect(()=>{const e=t;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[t])}function kbe(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 _G(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,..._G(t.parentElement)]}const Obe=["x","y","top","bottom","left","right","width","height"],Lbe=(t,e)=>Obe.every(n=>t[n]===e[n]);var Dbe=Object.defineProperty,jbe=Object.defineProperties,Ube=Object.getOwnPropertyDescriptors,Lj=Object.getOwnPropertySymbols,Fbe=Object.prototype.hasOwnProperty,zbe=Object.prototype.propertyIsEnumerable,Dj=(t,e,n)=>e in t?Dbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,jj=(t,e)=>{for(var n in e||(e={}))Fbe.call(e,n)&&Dj(t,n,e[n]);if(Lj)for(var n of Lj(e))zbe.call(e,n)&&Dj(t,n,e[n]);return t},Bbe=(t,e)=>jbe(t,Ube(e)),Uj,Fj;typeof window<"u"&&((Uj=window.document)!=null&&Uj.createElement||((Fj=window.navigator)==null?void 0:Fj.product)==="ReactNative")?R.useLayoutEffect:R.useEffect;function wG(t,e,n){if(!t)return;if(n(t)===!0)return t;let r=t.child;for(;r;){const i=wG(r,e,n);if(i)return i;r=r.sibling}}function SG(t){try{return Object.defineProperties(t,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return t}}const zj=console.error;console.error=function(){const t=[...arguments].join("");if(t!=null&&t.startsWith("Warning:")&&t.includes("useContext")){console.error=zj;return}return zj.apply(this,arguments)};const rN=SG(R.createContext(null));class MG extends R.Component{render(){return R.createElement(rN.Provider,{value:this._reactInternals},this.props.children)}}function Hbe(){const t=R.useContext(rN);if(t===null)throw new Error("its-fine: useFiber must be called within a !");const e=R.useId();return R.useMemo(()=>{for(const r of[t,t==null?void 0:t.alternate]){if(!r)continue;const i=wG(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 Vbe(){const t=Hbe(),[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!==rN&&!e.has(i)&&e.set(i,R.useContext(SG(i)))}n=n.return}return e}function Gbe(){const t=Vbe();return R.useMemo(()=>Array.from(t.keys()).reduce((e,n)=>r=>R.createElement(e,null,R.createElement(n.Provider,Bbe(jj({},r),{value:t.get(n)}))),e=>R.createElement(MG,jj({},e))),[t])}const Wbe=R.forwardRef(function({children:e,fallback:n,resize:r,style:i,gl:s,events:o=Rbe,eventSource:a,eventPrefix:l,shadows:c,linear:d,flat:f,legacy:m,orthographic:y,frameloop:x,dpr:S,performance:_,raycaster:w,camera:E,scene:T,onPointerMissed:C,onCreated:O,...N},L){R.useMemo(()=>dbe(Zxe),[]);const F=Gbe(),[V,k]=Nbe({scroll:!0,debounce:{scroll:50,resize:0},...r}),U=R.useRef(null),H=R.useRef(null);R.useImperativeHandle(L,()=>U.current);const ne=uG(C),[te,pe]=R.useState(!1),[oe,ce]=R.useState(!1);if(te)throw te;if(oe)throw oe;const B=R.useRef(null);vx(()=>{const q=U.current;k.width>0&&k.height>0&&q&&(B.current||(B.current=Cbe(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:E,scene:T,size:k,onPointerMissed:(...$)=>ne.current==null?void 0:ne.current(...$),onCreated:$=>{$.events.connect==null||$.events.connect(a?hbe(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(dG,{set:ce,children:v.jsx(R.Suspense,{fallback:v.jsx(pbe,{set:pe}),children:e??null})})})))}),R.useEffect(()=>{const q=U.current;if(q)return()=>bG(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:U,style:{display:"block"},children:n})})})}),$be=R.forwardRef(function(e,n){return v.jsx(MG,{children:v.jsx(Wbe,{...e,ref:n})})});function iP(){return iP=Object.assign?Object.assign.bind():function(t){for(var e=1;ee in t?Xbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Kbe=(t,e,n)=>(qbe(t,e+"",n),n);class Ybe{constructor(){Kbe(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;se in t?Zbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,$t=(t,e,n)=>(Qbe(t,typeof e!="symbol"?e+"":e,n),n);const N_=new Jh,Bj=new Nc,Jbe=Math.cos(70*(Math.PI/180)),Hj=(t,e)=>(t%e+e)%e;let e_e=class extends Ybe{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=Hj(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{let Ae=Hj(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-Fer.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(L,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):(N_.origin.copy(r.object.position),N_.direction.set(0,0,-1).transformDirection(r.object.matrix),Math.abs(r.object.up.dot(N_.direction))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 tP,f=new tP;let m=1;const y=new X,x=new Ve,S=new Ve,_=new Ve,w=new Ve,E=new Ve,T=new Ve,C=new Ve,O=new Ve,N=new Ve,L=new X,F=new Ve;let V=!1;const k=[],U={};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,L.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){E.set(J.clientX,J.clientY),T.subVectors(E,w).multiplyScalar(r.panSpeed),B(T.x,T.y),w.copy(E),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 je(){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)E.set(J.pageX,J.pageY);else{const Ae=de(J),re=.5*(J.pageX+Ae.x),Fe=.5*(J.pageY+Ae.y);E.set(re,Fe)}T.subVectors(E,w).multiplyScalar(r.panSpeed),B(T.x,T.y),w.copy(E)}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;jt(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;je(),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 jt(J){delete U[J.pointerId];for(let Ae=0;Ae{$(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 t_e=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),E=nd(N=>N.performance),T=e||m,C=r||x.connected||y.domElement,O=R.useMemo(()=>new e_e(T),[T]);return xG(()=>{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&&E.regress(),o&&o(V)},L=V=>{a&&a(V)},F=V=>{l&&l(V)};return O.addEventListener("change",N),O.addEventListener("start",L),O.addEventListener("end",F),()=>{O.removeEventListener("start",L),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",iP({ref:d,object:O,enableDamping:i},c))});function Vj(t,e){if(e===WV)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(e===I1||e===bR){let n=t.getIndex();if(n===null){const o=[],a=t.getAttribute("position");if(a!==void 0){for(let l=0;l=2.0 are supported."));return}const c=new L_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=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 r_e(){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 i_e{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=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return n.loadTextureImage(e,s.source,o)}}class y_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 x_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 b_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 __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!==Vo.TRIANGLES&&c.mode!==Vo.TRIANGLE_STRIP&&c.mode!==Vo.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,E=new X(1,1,1),T=new kR(x.geometry,x.material,m);for(let C=0;C0||t.search(/^data\:image\/jpeg/)===0?"image/jpeg":t.search(/\.webp($|\?)/i)>0||t.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const O_e=new Ct;class L_e{constructor(e={},n={}){this.json=e,this.extensions={},this.plugins={},this.options=n,this.cache=new r_e,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 X6(this.options.manager):this.textureLoader=new tG(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Va(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{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=2&&_.setY(V,N[L*l+1]),l>=3&&_.setZ(V,N[L*l+2]),l>=4&&_.setW(V,N[L*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=Wj[m.magFilter]||Cr,d.minFilter=Wj[m.minFilter]||qo,d.wrapS=$j[m.wrapS]||Pd,d.wrapT=$j[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||k_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 rM,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 gx}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,Ui)),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||QA.OPAQUE;if(d===QA.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,d===QA.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,Ui)),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 Xj(l,a,n)})}const o=[];for(let a=0,l=e.length;a0&&N_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;y1?d=new Ts:c.length===1?d=c[0]:d=new mn,d!==c[0])for(let f=0,m=c.length;f{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?C_e[i.interpolation]:Og,f=this._getArrayFromAccessor(r);for(let m=0,y=l.length;m>>1,Z=B[$];if(0>>1;$i(fe,q))_ei(Se,fe)?(B[$]=Se,B[_e]=q,$=_e):(B[$]=fe,B[ae]=q,$=ae);else if(_ei(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,E=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&&!U());){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,L=null,F=-1,V=5,k=-1;function U(){return!(t.unstable_now()-kB||125$?(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=U,t.unstable_wrapCallback=function(B){var K=m;return function(){var q=m;m=K;try{return B.apply(this,arguments)}finally{m=q}}}})(HA)),HA}var Ej;function ube(){return Ej||(Ej=1,BA.exports=cbe()),BA.exports}var Aj=ube();const nN={},dbe=t=>void Object.assign(nN,t);function fbe(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=nN[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"&&WA(_,y),_}function r(d,f){let m=!1;if(f){var y,x;(y=f.__r3f)!=null&&y.attach?GA(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,rP(f),zm(f)}}function i(d,f,m){let y=!1;if(f){var x,S;if((x=f.__r3f)!=null&&x.attach)GA(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(E=>E!==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,rP(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)Nj(d,f,f.__r3f.attach);else if(f.isObject3D&&d.isObject3D){var _;d.remove(f),(_=f.__r3f)!=null&&_.root&&xbe(K_(f),f)}const E=(S=f.__r3f)==null?void 0:S.primitive,T=!E&&(m===void 0?f.dispose!==null:m);if(!E){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"?Aj.unstable_scheduleCallback(Aj.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&&K_(_).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:lbe({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,...E}=y,{args:T=[],children:C,...O}=m;if(!Array.isArray(_))throw new Error("R3F: the args prop must be an array!");if(_.some((L,F)=>L!==T[F]))return[!0];const N=pG(d,E,O,!0);return N.changes.length?[!1,N]:null}},commitUpdate(d,[f,m],y,x,S,_){f?a(d,y,S,_):WA(d,m)},commitMount(d,f,m,y){var x;const S=(x=d.__r3f)!=null?x:{};d.raycast&&S.handlers&&S.eventCount&&K_(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&&Nj(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&&GA(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:WA}}var Tj,Cj;const VA=t=>"colorSpace"in t||"outputColorSpace"in t,lG=()=>{var t;return(t=nN.ColorManagement)!=null?t:null},cG=t=>t&&t.isOrthographicCamera,hbe=t=>t&&t.hasOwnProperty("current"),vx=typeof window<"u"&&((Tj=window.document)!=null&&Tj.createElement||((Cj=window.navigator)==null?void 0:Cj.product)==="ReactNative")?R.useLayoutEffect:R.useEffect;function uG(t){const e=R.useRef(t);return vx(()=>void(e.current=t),[t]),e}function pbe({set:t}){return vx(()=>(t(new Promise(()=>null)),()=>t(!1)),[t]),null}class dG 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}}dG.getDerivedStateFromError=()=>({error:!0});const fG="__default",Pj=new Map,mbe=t=>t&&!!t.memoized&&!!t.changes;function hG(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 Ty=t=>{var e;return(e=t.__r3f)==null?void 0:e.root.getState()};function K_(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 gbe(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 nP(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 Rj=/-\d+$/;function GA(t,e,n){if(ir.str(n)){if(Rj.test(n)){const s=n.replace(Rj,""),{target:o,key:a}=nP(t,s);Array.isArray(o[a])||(o[a]=[])}const{target:r,key:i}=nP(t,n);e.__r3f.previousAttach=r[i],r[i]=e}else e.__r3f.previousAttach=n(t,e)}function Nj(t,e,n){var r,i;if(ir.str(n)){const{target:s,key:o}=nP(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 pG(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{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 E in i){const T=i[E];E.startsWith(`${x}-`)&&m.push([E,T,!1,E.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 WA(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}=mbe(e)?e:pG(t,e),l=r==null?void 0:r.eventCount;t.__r3f&&(t.__r3f.memoizedProps=o);for(let m=0;mT[C],t),!(E&&E.set))){const[T,...C]=_.reverse();w=C.reverse().reduce((O,N)=>O[N],t),y=T}if(x===fG+"remove")if(w.constructor){let T=Pj.get(w.constructor);T||(T=new w.constructor,Pj.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(E&&E.set&&(E.copy||E instanceof Ah)){if(Array.isArray(x))E.fromArray?E.fromArray(x):E.set(...x);else if(E.copy&&x&&x.constructor&&E.constructor===x.constructor)E.copy(x);else if(x!==void 0){var c;const T=(c=E)==null?void 0:c.isColor;!T&&E.setScalar?E.setScalar(x):E instanceof Ah&&x instanceof Ah?E.mask=x.mask:E.set(x),!lG()&&s&&!s.linear&&T&&E.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];VA(T)&&VA(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=K_(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&&rP(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 rP(t){t.onUpdate==null||t.onUpdate(t)}function vbe(t,e){t.manual||(cG(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 P_(t){return(t.eventObject||t.object).uuid+"/"+t.index+t.instanceId}function ybe(){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 mG(t,e,n,r){const i=n.get(e);i&&(n.delete(e),n.size===0&&(t.delete(r),i.target.releasePointerCapture(r)))}function xbe(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)=>{mG(n.capturedMap,e,r,i)})}function bbe(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{const T=Ty(w.object),C=Ty(E.object);return!T||!C?w.distance-E.distance:C.events.priority-T.events.priority||w.distance-E.distance}).filter(w=>{const E=P_(w);return f.has(E)?!1:(f.add(E),!0)});d.events.filter&&(S=d.events.filter(S,d));for(const w of S){let E=w.object;for(;E;){var _;(_=E.__r3f)!=null&&_.eventCount&&m.push({...w,eventObject:E}),E=E.parent}}if("pointerId"in l&&d.internal.capturedMap.has(l.pointerId))for(let w of d.internal.capturedMap.get(l.pointerId).values())f.has(P_(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=Ty(x.object)||m,{raycaster:_,pointer:w,camera:E,internal:T}=S,C=new X(w.x,w.y,0).unproject(E),O=k=>{var U,H;return(U=(H=T.capturedMap.get(k))==null?void 0:H.has(x.eventObject))!=null?U:!1},N=k=>{const U={intersection:x,target:c.target};T.capturedMap.has(k)?T.capturedMap.get(k).set(x.eventObject,U):T.capturedMap.set(k,new Map([[x.eventObject,U]])),c.target.setPointerCapture(k)},L=k=>{const U=T.capturedMap.get(k);U&&mG(T.capturedMap,x.eventObject,U,k)};let F={};for(let k in c){let U=c[k];typeof U!="function"&&(F[k]=U)}let V={...x,...F,pointer:w,intersections:l,stopped:y.stopped,delta:d,unprojectedPoint:C,ray:_.ray,camera:E,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(U=>U.eventObject===x.eventObject))){const U=l.slice(0,l.indexOf(x));s([...U,x])}},target:{hasPointerCapture:O,setPointerCapture:N,releasePointerCapture:L},currentTarget:{hasPointerCapture:O,setPointerCapture:N,releasePointerCapture:L},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(P_(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;ds([]);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 E(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 L=P_(T),F=m.hovered.get(L);F?F.stopped&&T.stopPropagation():(m.hovered.set(L,T),N.onPointerOver==null||N.onPointerOver(T),N.onPointerEnter==null||N.onPointerEnter(T))}N.onPointerMove==null||N.onPointerMove(T)}else{const L=N[l];L?(!x||m.initialHits.includes(C))&&(o(d,m.interaction.filter(F=>!m.initialHits.includes(F))),L(T)):x&&m.initialHits.includes(C)&&o(d,m.interaction.filter(F=>!m.initialHits.includes(F)))}}i(_,d,w,E)}}return{handlePointer:a}}const gG=t=>!!(t!=null&&t.render),vG=R.createContext(null),_be=(t,e)=>{const n=nbe((a,l)=>{const c=new X,d=new X,f=new X;function m(w=l().camera,E=d,T=l().size){const{width:C,height:O,top:N,left:L}=T,F=C/O;E.isVector3?f.copy(E):f.set(...E);const V=w.getWorldPosition(c).distanceTo(f);if(cG(w))return{width:C/w.zoom,height:O/w.zoom,top:N,left:L,factor:1,distance:V,aspect:F};{const k=w.fov*Math.PI/180,U=2*Math.tan(k/2)*V,H=U*(C/O);return{width:H,height:U,top:N,left:L,factor:C/H,distance:V,aspect:F}}}let y;const x=w=>a(E=>({performance:{...E.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,E)=>e(w,E,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new ZR,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(E=>({...E,events:{...E.events,...w}})),setSize:(w,E,T,C,O)=>{const N=l().camera,L={width:w,height:E,top:C||0,left:O||0,updateStyle:T};a(F=>({size:L,viewport:{...F.viewport,...m(N,d,L)}}))},setDpr:w=>a(E=>{const T=hG(w);return{viewport:{...E.viewport,dpr:T,initialDpr:E.viewport.initialDpr||T}}}),setFrameloop:(w="always")=>{const E=l().clock;E.stop(),E.elapsedTime=0,w!=="never"&&(E.start(),E.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,E,T)=>{const C=l().internal;return C.priority=C.priority+(E>0?1:0),C.subscribers.push({ref:w,priority:E,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-(E>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,vbe(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 R_,wbe=new Set,Sbe=new Set,Mbe=new Set;function $A(t,e){if(t.size)for(const{callback:n}of t.values())n(e)}function Cy(t,e){switch(t){case"before":return $A(wbe,e);case"after":return $A(Sbe,e);case"tail":return $A(Mbe,e)}}let XA,qA;function KA(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),XA=e.internal.subscribers,R_=0;R_0)&&!((d=s.gl.xr)!=null&&d.isPresenting)&&(r+=KA(c,s))}if(n=!1,Cy("after",c),r===0)return Cy("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&&Cy("before",c),f)KA(c,f,m);else for(const y of t.values())KA(c,y.store.getState());d&&Cy("after",c)}return{loop:o,invalidate:a,advance:l}}function yG(){const t=R.useContext(vG);if(!t)throw new Error("R3F: Hooks can only be used within the Canvas component!");return t}function nd(t=n=>n,e){return yG()(t,e)}function xG(t,e=0){const n=yG(),r=n.getState().internal.subscribe,i=uG(t);return vx(()=>r(i,e,n),[e,r,n]),null}const Fg=new Map,{invalidate:Ij,advance:kj}=Ebe(Fg),{reconciler:D1,applyProps:Nm}=fbe(Fg,ybe),Im={objects:"shallow",strict:!1},Abe=(t,e)=>{const n=typeof t=="function"?t(e):t;return gG(n)?n:new y6({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...t})};function Tbe(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 Cbe(t){const e=Fg.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||_be(Ij,kj),o=n||D1.createContainer(s,Km.ConcurrentRoot,null,!1,null,"",i,null);e||Fg.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:E=!1,legacy:T=!1,orthographic:C=!1,frameloop:O="always",dpr:N=[1,2],performance:L,raycaster:F,camera:V,onPointerMissed:k}=d,U=s.getState(),H=U.gl;U.gl||U.set({gl:H=Abe(f,t)});let ne=U.raycaster;ne||U.set({raycaster:ne=new sG});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}}),!U.camera||U.camera===c&&!ir.equ(c,V,Im)){c=V;const q=V instanceof ux,$=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())),!U.camera&&!(V!=null&&V.rotation)&&$.lookAt(0,0,0)),U.set({camera:$}),ne.camera=$}if(!U.scene){let q;y!=null&&y.isScene?q=y:(q=new NR,y&&Nm(q,y)),U.set({scene:Fm(q)})}if(!U.xr){var oe;const q=(ge,ae)=>{const fe=s.getState();fe.frameloop!=="never"&&kj(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||Ij(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(),U.set({xr:Z})}if(H.shadowMap){const q=H.shadowMap.enabled,$=H.shadowMap.type;if(H.shadowMap.enabled=!!_,ir.boo(_))H.shadowMap.type=$y;else if(ir.str(_)){var ce;const Z={basic:pV,percentage:zS,soft:$y,variance:Oa};H.shadowMap.type=(ce=Z[_])!=null?ce:$y}else ir.obj(_)&&Object.assign(H.shadowMap,_);(q!==H.shadowMap.enabled||$!==H.shadowMap.type)&&(H.shadowMap.needsUpdate=!0)}const B=lG();B&&("enabled"in B?B.enabled=!T:"legacyMode"in B&&(B.legacyMode=T)),l||Nm(H,{outputEncoding:w?3e3:3001,toneMapping:E?Cl:cR}),U.legacy!==T&&U.set(()=>({legacy:T})),U.linear!==w&&U.set(()=>({linear:w})),U.flat!==E&&U.set(()=>({flat:E})),f&&!ir.fun(f)&&!gG(f)&&!ir.equ(f,H,Im)&&Nm(H,f),x&&!U.events.handlers&&U.set({events:x(s)});const K=Tbe(t,m);return ir.equ(K,U.size,Im)||U.setSize(K.width,K.height,K.updateStyle,K.top,K.left),N&&U.viewport.dpr!==hG(N)&&U.setDpr(N),U.frameloop!==O&&U.setFrameloop(O),U.onPointerMissed||U.set({onPointerMissed:k}),L&&!ir.equ(L,U.performance,Im)&&U.set(q=>({performance:{...q.performance,...L}})),a=S,l=!0,this},render(d){return l||this.configure(),D1.updateContainer(v.jsx(Pbe,{store:s,children:d,onCreated:a,rootElement:t}),o,null,()=>{}),s},unmount(){bG(t)}}}function Pbe({store:t,children:e,onCreated:n,rootElement:r}){return vx(()=>{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(vG.Provider,{value:t,children:e})}function bG(t,e){const n=Fg.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),D1.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(),gbe(i),Fg.delete(t)}catch{}},500)})}}D1.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:R.version});const YA={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 Rbe(t){const{handlePointer:e}=bbe(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(YA).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]=YA[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]=YA[s];r.connected.removeEventListener(a,o)}}),n(s=>({events:{...s.events,connected:void 0}}))}}}}function Oj(t,e){let n;return(...r)=>{window.clearTimeout(n),n=window.setTimeout(()=>t(...r),e)}}function Nbe({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:E,top:T,width:C,height:O,bottom:N,right:L,x:F,y:V}=a.current.element.getBoundingClientRect(),k={left:E,top:T,width:C,height:O,bottom:N,right:L,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&&!Lbe(a.current.lastBounds,k)&&o(a.current.lastBounds=k)};return[w,c?Oj(w,c):w,l?Oj(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=_G(w),S())};return kbe(y,!!e),Ibe(m),R.useEffect(()=>{x(),S()},[e,y,m]),R.useEffect(()=>x,[]),[_,s,f]}function Ibe(t){R.useEffect(()=>{const e=t;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[t])}function kbe(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 _G(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,..._G(t.parentElement)]}const Obe=["x","y","top","bottom","left","right","width","height"],Lbe=(t,e)=>Obe.every(n=>t[n]===e[n]);var Dbe=Object.defineProperty,jbe=Object.defineProperties,Ube=Object.getOwnPropertyDescriptors,Lj=Object.getOwnPropertySymbols,Fbe=Object.prototype.hasOwnProperty,zbe=Object.prototype.propertyIsEnumerable,Dj=(t,e,n)=>e in t?Dbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,jj=(t,e)=>{for(var n in e||(e={}))Fbe.call(e,n)&&Dj(t,n,e[n]);if(Lj)for(var n of Lj(e))zbe.call(e,n)&&Dj(t,n,e[n]);return t},Bbe=(t,e)=>jbe(t,Ube(e)),Uj,Fj;typeof window<"u"&&((Uj=window.document)!=null&&Uj.createElement||((Fj=window.navigator)==null?void 0:Fj.product)==="ReactNative")?R.useLayoutEffect:R.useEffect;function wG(t,e,n){if(!t)return;if(n(t)===!0)return t;let r=t.child;for(;r;){const i=wG(r,e,n);if(i)return i;r=r.sibling}}function SG(t){try{return Object.defineProperties(t,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return t}}const zj=console.error;console.error=function(){const t=[...arguments].join("");if(t!=null&&t.startsWith("Warning:")&&t.includes("useContext")){console.error=zj;return}return zj.apply(this,arguments)};const rN=SG(R.createContext(null));class MG extends R.Component{render(){return R.createElement(rN.Provider,{value:this._reactInternals},this.props.children)}}function Hbe(){const t=R.useContext(rN);if(t===null)throw new Error("its-fine: useFiber must be called within a !");const e=R.useId();return R.useMemo(()=>{for(const r of[t,t==null?void 0:t.alternate]){if(!r)continue;const i=wG(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 Vbe(){const t=Hbe(),[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!==rN&&!e.has(i)&&e.set(i,R.useContext(SG(i)))}n=n.return}return e}function Gbe(){const t=Vbe();return R.useMemo(()=>Array.from(t.keys()).reduce((e,n)=>r=>R.createElement(e,null,R.createElement(n.Provider,Bbe(jj({},r),{value:t.get(n)}))),e=>R.createElement(MG,jj({},e))),[t])}const Wbe=R.forwardRef(function({children:e,fallback:n,resize:r,style:i,gl:s,events:o=Rbe,eventSource:a,eventPrefix:l,shadows:c,linear:d,flat:f,legacy:m,orthographic:y,frameloop:x,dpr:S,performance:_,raycaster:w,camera:E,scene:T,onPointerMissed:C,onCreated:O,...N},L){R.useMemo(()=>dbe(Zxe),[]);const F=Gbe(),[V,k]=Nbe({scroll:!0,debounce:{scroll:50,resize:0},...r}),U=R.useRef(null),H=R.useRef(null);R.useImperativeHandle(L,()=>U.current);const ne=uG(C),[te,pe]=R.useState(!1),[oe,ce]=R.useState(!1);if(te)throw te;if(oe)throw oe;const B=R.useRef(null);vx(()=>{const q=U.current;k.width>0&&k.height>0&&q&&(B.current||(B.current=Cbe(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:E,scene:T,size:k,onPointerMissed:(...$)=>ne.current==null?void 0:ne.current(...$),onCreated:$=>{$.events.connect==null||$.events.connect(a?hbe(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(dG,{set:ce,children:v.jsx(R.Suspense,{fallback:v.jsx(pbe,{set:pe}),children:e??null})})})))}),R.useEffect(()=>{const q=U.current;if(q)return()=>bG(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:U,style:{display:"block"},children:n})})})}),$be=R.forwardRef(function(e,n){return v.jsx(MG,{children:v.jsx(Wbe,{...e,ref:n})})});function iP(){return iP=Object.assign?Object.assign.bind():function(t){for(var e=1;ee in t?Xbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Kbe=(t,e,n)=>(qbe(t,e+"",n),n);class Ybe{constructor(){Kbe(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;se in t?Zbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,$t=(t,e,n)=>(Qbe(t,typeof e!="symbol"?e+"":e,n),n);const N_=new Jh,Bj=new Nc,Jbe=Math.cos(70*(Math.PI/180)),Hj=(t,e)=>(t%e+e)%e;let e_e=class extends Ybe{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=Hj(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{let Ae=Hj(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-Fer.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(L,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):(N_.origin.copy(r.object.position),N_.direction.set(0,0,-1).transformDirection(r.object.matrix),Math.abs(r.object.up.dot(N_.direction))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 tP,f=new tP;let m=1;const y=new X,x=new Ve,S=new Ve,_=new Ve,w=new Ve,E=new Ve,T=new Ve,C=new Ve,O=new Ve,N=new Ve,L=new X,F=new Ve;let V=!1;const k=[],U={};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,L.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){E.set(J.clientX,J.clientY),T.subVectors(E,w).multiplyScalar(r.panSpeed),B(T.x,T.y),w.copy(E),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 je(){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)E.set(J.pageX,J.pageY);else{const Ae=de(J),re=.5*(J.pageX+Ae.x),Fe=.5*(J.pageY+Ae.y);E.set(re,Fe)}T.subVectors(E,w).multiplyScalar(r.panSpeed),B(T.x,T.y),w.copy(E)}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;jt(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;je(),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 jt(J){delete U[J.pointerId];for(let Ae=0;Ae{$(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 t_e=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),E=nd(N=>N.performance),T=e||m,C=r||x.connected||y.domElement,O=R.useMemo(()=>new e_e(T),[T]);return xG(()=>{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&&E.regress(),o&&o(V)},L=V=>{a&&a(V)},F=V=>{l&&l(V)};return O.addEventListener("change",N),O.addEventListener("start",L),O.addEventListener("end",F),()=>{O.removeEventListener("start",L),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",iP({ref:d,object:O,enableDamping:i},c))});function Vj(t,e){if(e===WV)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(e===I1||e===bR){let n=t.getIndex();if(n===null){const o=[],a=t.getAttribute("position");if(a!==void 0){for(let l=0;l=2.0 are supported."));return}const c=new L_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=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 r_e(){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 i_e{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=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return n.loadTextureImage(e,s.source,o)}}class y_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 x_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 b_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 __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!==Vo.TRIANGLES&&c.mode!==Vo.TRIANGLE_STRIP&&c.mode!==Vo.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,E=new X(1,1,1),T=new kR(x.geometry,x.material,m);for(let C=0;C0||t.search(/^data\:image\/jpeg/)===0?"image/jpeg":t.search(/\.webp($|\?)/i)>0||t.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const O_e=new Ct;class L_e{constructor(e={},n={}){this.json=e,this.extensions={},this.plugins={},this.options=n,this.cache=new r_e,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 X6(this.options.manager):this.textureLoader=new tG(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{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=2&&_.setY(V,N[L*l+1]),l>=3&&_.setZ(V,N[L*l+2]),l>=4&&_.setW(V,N[L*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=Wj[m.magFilter]||Cr,d.minFilter=Wj[m.minFilter]||qo,d.wrapS=$j[m.wrapS]||Pd,d.wrapT=$j[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||k_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 rM,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 gx}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,Ui)),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||QA.OPAQUE;if(d===QA.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,d===QA.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,Ui)),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 Xj(l,a,n)})}const o=[];for(let a=0,l=e.length;a0&&N_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;y1?d=new Ts:c.length===1?d=c[0]:d=new mn,d!==c[0])for(let f=0,m=c.length;f{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?C_e[i.interpolation]:Og,f=this._getArrayFromAccessor(r);for(let m=0,y=l.length;mnew 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())}),jn=(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())}),qj=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.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 TG(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{const s=TG(t,i,r);s!=null&&n.set(i,s)}),n})}var aP={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 CG(t){return Math.max(Math.min(t,1),0)}var Zj=class PG{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(aP));return Object.entries(this._expressionMap).forEach(([r,i])=>{n.has(r)&&(e[r]=i)}),e}get customExpressionMap(){const e={},n=new Set(Object.values(aP));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 PG().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=CG(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}}},Ry={Color:"color",EmissionColor:"emissionColor",ShadeColor:"shadeColor",RimColor:"rimColor",OutlineColor:"outlineColor"},j_e={_Color:Ry.Color,_EmissionColor:Ry.EmissionColor,_ShadeColor:Ry.ShadeColor,_RimColor:Ry.RimColor,_OutlineColor:Ry.OutlineColor},U_e=new ot,RG=class NG{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(U_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(NG._propertyNameMapMap).find(([r])=>this.material[r]===!0))==null?void 0:e[1])!=null?n:null}};RG._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 Qj=RG,j1=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)})}},Jj=new Ve,IG=class kG{constructor({material:e,scale:n,offset:r}){var i,s;this.material=e,this.scale=n,this.offset=r;const o=(i=Object.entries(kG._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(Jj.copy(n.deltaOffset).multiplyScalar(e)),r.repeat.add(Jj.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))})}};IG._propertyNamesMap={isMeshStandardMaterial:["map","emissiveMap","bumpMap","normalMap","displacementMap","roughnessMap","metalnessMap","alphaMap"],isMeshBasicMaterial:["map","specularMap","alphaMap"],isMToonMaterial:["map","normalMap","emissiveMap","shadeMultiplyTexture","rimMultiplyTexture","outlineWidthMultiplyTexture","uvAnimationMaskTexture"]};var eU=IG,F_e=new Set(["1.0","1.0-beta"]),OG=class LG{get name(){return"VRMExpressionLoaderPlugin"}constructor(e){this.parser=e}afterRoot(e){return jn(this,null,function*(){e.userData.vrmExpressionManager=yield this._import(e)})}_import(e){return jn(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 jn(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(!F_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(aP)),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 Zj;return yield Promise.all(Array.from(d.entries()).map(m=>jn(this,[m],function*([y,x]){var S,_,w,E,T,C,O;const N=new qj(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=(E=x.overrideMouth)!=null?E:"none",(T=x.morphTargetBinds)==null||T.forEach(L=>jn(this,null,function*(){var F;if(L.node===void 0||L.index===void 0)return;const V=yield Kj(e,L.node),k=L.index;if(!V.every(U=>Array.isArray(U.morphTargetInfluences)&&k{const V=F.material;V&&(Array.isArray(V)?L.push(...V):L.push(V))}),(C=x.materialColorBinds)==null||C.forEach(F=>jn(this,null,function*(){L.filter(k=>{var U;const H=(U=this.parser.associations.get(k))==null?void 0:U.materials;return F.material===H}).forEach(k=>{N.addBind(new Qj({material:k,type:F.type,targetValue:new ot().fromArray(F.targetValue),targetAlpha:F.targetValue[3]}))})})),(O=x.textureTransformBinds)==null||O.forEach(F=>jn(this,null,function*(){L.filter(k=>{var U;const H=(U=this.parser.associations.get(k))==null?void 0:U.materials;return F.material===H}).forEach(k=>{var U,H;N.addBind(new eU({material:k,offset:new Ve().fromArray((U=F.offset)!=null?U:[0,0]),scale:new Ve().fromArray((H=F.scale)!=null?H:[1,1])}))})}))}f.registerExpression(N)}))),f})}_v0Import(e){return jn(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 Zj,a=s.blendShapeGroups;if(!a)return o;const l=new Set;return yield Promise.all(a.map(c=>jn(this,null,function*(){var d;const f=c.presetName,m=f!=null&&LG.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 qj(y);e.scene.add(x),x.isBinary=(d=c.isBinary)!=null?d:!1,c.binds&&c.binds.forEach(_=>jn(this,null,function*(){var w;if(_.mesh===void 0||_.index===void 0)return;const E=[];if((w=r.nodes)==null||w.forEach((C,O)=>{C.mesh===_.mesh&&E.push(O)}),E.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(E.map(C=>jn(this,null,function*(){var O;const N=yield Kj(e,C);if(!N.every(L=>Array.isArray(L.morphTargetInfluences)&&T{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 E=_.propertyName;w.forEach(T=>{if(E==="_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 eU({material:T,scale:O,offset:N}));return}const C=j_e[E];if(C){x.addBind(new Qj({material:T,type:C,targetValue:new ot().fromArray(_.targetValue),targetAlpha:_.targetValue[3]}));return}console.warn(E+" is not supported")})}),o.registerExpression(x)}))),o})}};OG.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 z_e=OG,iN=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;o0&&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 tM(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 JC?[]:s.array,a=[];for(let S=0;S{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}};iN.DEFAULT_FIRSTPERSON_ONLY_LAYER=9;iN.DEFAULT_THIRDPERSON_ONLY_LAYER=10;var tU=iN,B_e=new Set(["1.0","1.0-beta"]),H_e=class{get name(){return"VRMFirstPersonLoaderPlugin"}constructor(t){this.parser=t}afterRoot(t){return jn(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 jn(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 jn(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(!B_e.has(a))return console.warn(`VRMFirstPersonLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=o.firstPerson,c=[],d=yield Yj(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 tU(e,c)})}_v0Import(t,e){return jn(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 Yj(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 tU(e,o)})}_convertV0FlagToV1Type(t){return t==="FirstPersonOnly"?"firstPersonOnly":t==="ThirdPersonOnly"?"thirdPersonOnly":t==="Both"?"both":"auto"}},nU=new X,rU=new X,V_e=new qt,iU=class extends Ts{constructor(t){super(),this.vrmHumanoid=t,this._boneAxesMap=new Map,Object.values(t.humanBones).forEach(e=>{const n=new aG(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(nU,V_e,rU);const r=nU.set(.1,.1,.1).divide(rU);n.matrix.copy(e.node.matrixWorld).scale(r)}),super.updateMatrixWorld(t)}},eT=["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"],G_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 DG(t){return t.invert?t.invert():t.inverse(),t}var zf=new X,Bf=new qt,lP=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&&DG(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}},tT=new X,W_e=new qt,$_e=new X,sU=class jG extends lP{static _setupTransforms(e){const n=new mn;n.name="VRMHumanoidRig";const r={},i={},s={};eT.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,tT),r[a]=d,i[a]=c.quaternion.clone();const m=new qt;(l=c.parent)==null||l.matrixWorld.decompose(tT,m,tT),s[a]=m}});const o={};return eT.forEach(a=>{var l;const c=e.getBoneNode(a);if(c){const d=r[a];let f=a,m;for(;m==null&&(f=G_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}=jG._setupTransforms(e);super(n),this.original=e,this.root=r,this._parentWorldRotations=i,this._boneRotations=s}update(){eT.forEach(e=>{const n=this.original.getBoneNode(e);if(n!=null){const r=this.getBoneNode(e),i=this._parentWorldRotations[e],s=W_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($_e);n.parent.updateWorldMatrix(!0,!1);const l=n.parent.matrixWorld,c=a.applyMatrix4(l.invert());n.position.copy(c)}}})}},oU=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 lP(e),this._normalizedHumanBones=new sU(this._rawHumanBones)}copy(e){return this.autoUpdateHumanBones=e.autoUpdateHumanBones,this._rawHumanBones=new lP(e.humanBones),this._normalizedHumanBones=new sU(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()}},X_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"},q_e=new Set(["1.0","1.0-beta"]),aU={leftThumbProximal:"leftThumbMetacarpal",leftThumbIntermediate:"leftThumbProximal",rightThumbProximal:"rightThumbMetacarpal",rightThumbIntermediate:"rightThumbProximal"},K_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 jn(this,null,function*(){t.userData.vrmHumanoid=yield this._import(t)})}_import(t){return jn(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 jn(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(!q_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=>jn(this,[f],function*([m,y]){let x=m;const S=y.node;if(l){const w=aU[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 oU(this._ensureRequiredBonesExist(c),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(t.scene.add(d.normalizedHumanBonesRoot),this.helperRoot){const f=new iU(d);this.helperRoot.add(f),f.renderOrder=this.helperRoot.renderOrder}return d})}_v0Import(t){return jn(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=>jn(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=aU[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 oU(this._ensureRequiredBonesExist(s),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(t.scene.add(o.normalizedHumanBonesRoot),this.helperRoot){const a=new iU(o);this.helperRoot.add(a),a.renderOrder=this.helperRoot.renderOrder}return o})}_ensureRequiredBonesExist(t){const e=Object.values(X_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}},lU=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}},Y_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}},k_=new qt,cU=new qt,Ny=new X,uU=new X,dU=Math.sqrt(2)/2,Z_e=new qt(0,0,-dU,dU),Q_e=new X(0,1,0),J_e=class extends Ts{constructor(t){super(),this.matrixAutoUpdate=!1,this.vrmLookAt=t;{const e=new lU;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 lU;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 Y_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(Ny),this.vrmLookAt.getLookAtWorldQuaternion(k_),k_.multiply(this.vrmLookAt.getFaceFrontQuaternion(cU)),this._meshYaw.position.copy(Ny),this._meshYaw.quaternion.copy(k_),this._meshPitch.position.copy(Ny),this._meshPitch.quaternion.copy(k_),this._meshPitch.quaternion.multiply(cU.setFromAxisAngle(Q_e,e)),this._meshPitch.quaternion.multiply(Z_e);const{target:r,autoUpdate:i}=this.vrmLookAt;r!=null&&i&&(r.getWorldPosition(uU).sub(Ny),this._lineTarget.geometry.tail.copy(uU),this._lineTarget.geometry.update(),this._lineTarget.position.copy(Ny)),super.updateMatrixWorld(t)}},ewe=new X,twe=new X;function cP(t,e){return t.matrixWorld.decompose(ewe,e,twe),e}function Y_(t){return[Math.atan2(-t.z,t.x),Math.atan2(t.y,Math.sqrt(t.x*t.x+t.z*t.z))]}function fU(t){const e=Math.round(t/2/Math.PI);return t-2*Math.PI*e}var hU=new X(0,0,1),nwe=new X,rwe=new X,iwe=new X,swe=new qt,nT=new qt,pU=new qt,owe=new qt,rT=new as,FG=class zG{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 zG(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 cP(n,e)}getFaceFrontQuaternion(e){if(this.faceFront.distanceToSquared(hU)<.01)return e.copy(this._restHeadWorldQuaternion).invert();const[n,r]=Y_(this.faceFront);return rT.set(0,.5*Math.PI+n,r,"YZX"),e.setFromEuler(rT).premultiply(owe.copy(this._restHeadWorldQuaternion).invert())}getLookAtWorldDirection(e){return this.getLookAtWorldQuaternion(nT),this.getFaceFrontQuaternion(pU),e.copy(hU).applyQuaternion(nT).applyQuaternion(pU).applyEuler(this.getEuler(rT))}lookAt(e){const n=swe.copy(this._restHeadWorldQuaternion).multiply(DG(this.getLookAtWorldQuaternion(nT))),r=this.getLookAtWorldPosition(rwe),i=iwe.copy(e).sub(r).applyQuaternion(n).normalize(),[s,o]=Y_(this.faceFront),[a,l]=Y_(i),c=fU(a-s),d=fU(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(nwe)),this._needsUpdate&&(this._needsUpdate=!1,this.applier.applyYawPitch(this._yaw,this._pitch))}};FG.EULER_ORDER="YXZ";var awe=FG,lwe=new X(0,0,1),pl=new qt,km=new qt,zo=new as(0,0,0,"YXZ"),Z_=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),cP(s.parent,this._restLeftEyeParentWorldQuat)),o&&(this._restQuatRightEye.copy(o.quaternion),cP(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?zo.x=-gr.DEG2RAD*this.rangeMapVerticalDown.map(-e):zo.x=gr.DEG2RAD*this.rangeMapVerticalUp.map(e),t<0?zo.y=-gr.DEG2RAD*this.rangeMapHorizontalInner.map(-t):zo.y=gr.DEG2RAD*this.rangeMapHorizontalOuter.map(t),pl.setFromEuler(zo),this._getWorldFaceFrontQuat(km),i.quaternion.copy(km).multiply(pl).multiply(km.invert()),pl.copy(this._restLeftEyeParentWorldQuat),n.quaternion.copy(i.quaternion).multiply(pl).premultiply(pl.invert()).multiply(this._restQuatLeftEye)),r&&(e<0?zo.x=-gr.DEG2RAD*this.rangeMapVerticalDown.map(-e):zo.x=gr.DEG2RAD*this.rangeMapVerticalUp.map(e),t<0?zo.y=-gr.DEG2RAD*this.rangeMapHorizontalOuter.map(-t):zo.y=gr.DEG2RAD*this.rangeMapHorizontalInner.map(t),pl.setFromEuler(zo),this._getWorldFaceFrontQuat(km),s.quaternion.copy(km).multiply(pl).multiply(km.invert()),pl.copy(this._restRightEyeParentWorldQuat),r.quaternion.copy(s.quaternion).multiply(pl).premultiply(pl.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(lwe)<.01)return t.identity();const[e,n]=Y_(this.faceFront);return zo.set(0,.5*Math.PI+e,n,"YZX"),t.setFromEuler(zo)}};Z_.type="bone";var uP=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)}};uP.type="expression";var mU=class{constructor(t,e){this.inputMaxValue=t,this.outputScale=e}map(t){return this.outputScale*CG(t/this.inputMaxValue)}},cwe=new Set(["1.0","1.0-beta"]),O_=.01,uwe=class{get name(){return"VRMLookAtLoaderPlugin"}constructor(t,e){this.parser=t,this.helperRoot=e==null?void 0:e.helperRoot}afterRoot(t){return jn(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 jn(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 jn(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(!cwe.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 uP(n,m,y,x,S):_=new Z_(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(console.error(o),console.warn("VRMMetaLoaderPlugin: Failed to load a thumbnail image"),null))})}},pwe=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()}},mwe=class extends pwe{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)})}},gwe=Object.defineProperty,gU=Object.getOwnPropertySymbols,vwe=Object.prototype.hasOwnProperty,ywe=Object.prototype.propertyIsEnumerable,vU=(t,e,n)=>e in t?gwe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,yU=(t,e)=>{for(var n in e||(e={}))vwe.call(e,n)&&vU(t,n,e[n]);if(gU)for(var n of gU(e))ywe.call(e,n)&&vU(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())}),xwe={"":3e3,srgb:3001};function bwe(t,e){parseInt(Td,10)>=152?t.colorSpace=e:t.encoding=xwe[e]}var _we=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&&bwe(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)})}},wwe=`// #define PHONG + */var I_=(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())}),jn=(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())}),qj=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.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 TG(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{const s=TG(t,i,r);s!=null&&n.set(i,s)}),n})}var aP={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 CG(t){return Math.max(Math.min(t,1),0)}var Zj=class PG{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(aP));return Object.entries(this._expressionMap).forEach(([r,i])=>{n.has(r)&&(e[r]=i)}),e}get customExpressionMap(){const e={},n=new Set(Object.values(aP));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 PG().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=CG(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}}},Ry={Color:"color",EmissionColor:"emissionColor",ShadeColor:"shadeColor",RimColor:"rimColor",OutlineColor:"outlineColor"},j_e={_Color:Ry.Color,_EmissionColor:Ry.EmissionColor,_ShadeColor:Ry.ShadeColor,_RimColor:Ry.RimColor,_OutlineColor:Ry.OutlineColor},U_e=new ot,RG=class NG{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(U_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(NG._propertyNameMapMap).find(([r])=>this.material[r]===!0))==null?void 0:e[1])!=null?n:null}};RG._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 Qj=RG,j1=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)})}},Jj=new Ve,IG=class kG{constructor({material:e,scale:n,offset:r}){var i,s;this.material=e,this.scale=n,this.offset=r;const o=(i=Object.entries(kG._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(Jj.copy(n.deltaOffset).multiplyScalar(e)),r.repeat.add(Jj.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))})}};IG._propertyNamesMap={isMeshStandardMaterial:["map","emissiveMap","bumpMap","normalMap","displacementMap","roughnessMap","metalnessMap","alphaMap"],isMeshBasicMaterial:["map","specularMap","alphaMap"],isMToonMaterial:["map","normalMap","emissiveMap","shadeMultiplyTexture","rimMultiplyTexture","outlineWidthMultiplyTexture","uvAnimationMaskTexture"]};var eU=IG,F_e=new Set(["1.0","1.0-beta"]),OG=class LG{get name(){return"VRMExpressionLoaderPlugin"}constructor(e){this.parser=e}afterRoot(e){return jn(this,null,function*(){e.userData.vrmExpressionManager=yield this._import(e)})}_import(e){return jn(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 jn(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(!F_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(aP)),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 Zj;return yield Promise.all(Array.from(d.entries()).map(m=>jn(this,[m],function*([y,x]){var S,_,w,E,T,C,O;const N=new qj(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=(E=x.overrideMouth)!=null?E:"none",(T=x.morphTargetBinds)==null||T.forEach(L=>jn(this,null,function*(){var F;if(L.node===void 0||L.index===void 0)return;const V=yield Kj(e,L.node),k=L.index;if(!V.every(U=>Array.isArray(U.morphTargetInfluences)&&k{const V=F.material;V&&(Array.isArray(V)?L.push(...V):L.push(V))}),(C=x.materialColorBinds)==null||C.forEach(F=>jn(this,null,function*(){L.filter(k=>{var U;const H=(U=this.parser.associations.get(k))==null?void 0:U.materials;return F.material===H}).forEach(k=>{N.addBind(new Qj({material:k,type:F.type,targetValue:new ot().fromArray(F.targetValue),targetAlpha:F.targetValue[3]}))})})),(O=x.textureTransformBinds)==null||O.forEach(F=>jn(this,null,function*(){L.filter(k=>{var U;const H=(U=this.parser.associations.get(k))==null?void 0:U.materials;return F.material===H}).forEach(k=>{var U,H;N.addBind(new eU({material:k,offset:new Ve().fromArray((U=F.offset)!=null?U:[0,0]),scale:new Ve().fromArray((H=F.scale)!=null?H:[1,1])}))})}))}f.registerExpression(N)}))),f})}_v0Import(e){return jn(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 Zj,a=s.blendShapeGroups;if(!a)return o;const l=new Set;return yield Promise.all(a.map(c=>jn(this,null,function*(){var d;const f=c.presetName,m=f!=null&&LG.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 qj(y);e.scene.add(x),x.isBinary=(d=c.isBinary)!=null?d:!1,c.binds&&c.binds.forEach(_=>jn(this,null,function*(){var w;if(_.mesh===void 0||_.index===void 0)return;const E=[];if((w=r.nodes)==null||w.forEach((C,O)=>{C.mesh===_.mesh&&E.push(O)}),E.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(E.map(C=>jn(this,null,function*(){var O;const N=yield Kj(e,C);if(!N.every(L=>Array.isArray(L.morphTargetInfluences)&&T{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 E=_.propertyName;w.forEach(T=>{if(E==="_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 eU({material:T,scale:O,offset:N}));return}const C=j_e[E];if(C){x.addBind(new Qj({material:T,type:C,targetValue:new ot().fromArray(_.targetValue),targetAlpha:_.targetValue[3]}));return}console.warn(E+" is not supported")})}),o.registerExpression(x)}))),o})}};OG.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 z_e=OG,iN=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;o0&&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 tM(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 JC?[]:s.array,a=[];for(let S=0;S{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}};iN.DEFAULT_FIRSTPERSON_ONLY_LAYER=9;iN.DEFAULT_THIRDPERSON_ONLY_LAYER=10;var tU=iN,B_e=new Set(["1.0","1.0-beta"]),H_e=class{get name(){return"VRMFirstPersonLoaderPlugin"}constructor(t){this.parser=t}afterRoot(t){return jn(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 jn(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 jn(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(!B_e.has(a))return console.warn(`VRMFirstPersonLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=o.firstPerson,c=[],d=yield Yj(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 tU(e,c)})}_v0Import(t,e){return jn(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 Yj(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 tU(e,o)})}_convertV0FlagToV1Type(t){return t==="FirstPersonOnly"?"firstPersonOnly":t==="ThirdPersonOnly"?"thirdPersonOnly":t==="Both"?"both":"auto"}},nU=new X,rU=new X,V_e=new qt,iU=class extends Ts{constructor(t){super(),this.vrmHumanoid=t,this._boneAxesMap=new Map,Object.values(t.humanBones).forEach(e=>{const n=new aG(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(nU,V_e,rU);const r=nU.set(.1,.1,.1).divide(rU);n.matrix.copy(e.node.matrixWorld).scale(r)}),super.updateMatrixWorld(t)}},eT=["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"],G_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 DG(t){return t.invert?t.invert():t.inverse(),t}var zf=new X,Bf=new qt,lP=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&&DG(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}},tT=new X,W_e=new qt,$_e=new X,sU=class jG extends lP{static _setupTransforms(e){const n=new mn;n.name="VRMHumanoidRig";const r={},i={},s={};eT.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,tT),r[a]=d,i[a]=c.quaternion.clone();const m=new qt;(l=c.parent)==null||l.matrixWorld.decompose(tT,m,tT),s[a]=m}});const o={};return eT.forEach(a=>{var l;const c=e.getBoneNode(a);if(c){const d=r[a];let f=a,m;for(;m==null&&(f=G_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}=jG._setupTransforms(e);super(n),this.original=e,this.root=r,this._parentWorldRotations=i,this._boneRotations=s}update(){eT.forEach(e=>{const n=this.original.getBoneNode(e);if(n!=null){const r=this.getBoneNode(e),i=this._parentWorldRotations[e],s=W_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($_e);n.parent.updateWorldMatrix(!0,!1);const l=n.parent.matrixWorld,c=a.applyMatrix4(l.invert());n.position.copy(c)}}})}},oU=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 lP(e),this._normalizedHumanBones=new sU(this._rawHumanBones)}copy(e){return this.autoUpdateHumanBones=e.autoUpdateHumanBones,this._rawHumanBones=new lP(e.humanBones),this._normalizedHumanBones=new sU(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()}},X_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"},q_e=new Set(["1.0","1.0-beta"]),aU={leftThumbProximal:"leftThumbMetacarpal",leftThumbIntermediate:"leftThumbProximal",rightThumbProximal:"rightThumbMetacarpal",rightThumbIntermediate:"rightThumbProximal"},K_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 jn(this,null,function*(){t.userData.vrmHumanoid=yield this._import(t)})}_import(t){return jn(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 jn(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(!q_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=>jn(this,[f],function*([m,y]){let x=m;const S=y.node;if(l){const w=aU[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 oU(this._ensureRequiredBonesExist(c),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(t.scene.add(d.normalizedHumanBonesRoot),this.helperRoot){const f=new iU(d);this.helperRoot.add(f),f.renderOrder=this.helperRoot.renderOrder}return d})}_v0Import(t){return jn(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=>jn(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=aU[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 oU(this._ensureRequiredBonesExist(s),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(t.scene.add(o.normalizedHumanBonesRoot),this.helperRoot){const a=new iU(o);this.helperRoot.add(a),a.renderOrder=this.helperRoot.renderOrder}return o})}_ensureRequiredBonesExist(t){const e=Object.values(X_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}},lU=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}},Y_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}},k_=new qt,cU=new qt,Ny=new X,uU=new X,dU=Math.sqrt(2)/2,Z_e=new qt(0,0,-dU,dU),Q_e=new X(0,1,0),J_e=class extends Ts{constructor(t){super(),this.matrixAutoUpdate=!1,this.vrmLookAt=t;{const e=new lU;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 lU;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 Y_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(Ny),this.vrmLookAt.getLookAtWorldQuaternion(k_),k_.multiply(this.vrmLookAt.getFaceFrontQuaternion(cU)),this._meshYaw.position.copy(Ny),this._meshYaw.quaternion.copy(k_),this._meshPitch.position.copy(Ny),this._meshPitch.quaternion.copy(k_),this._meshPitch.quaternion.multiply(cU.setFromAxisAngle(Q_e,e)),this._meshPitch.quaternion.multiply(Z_e);const{target:r,autoUpdate:i}=this.vrmLookAt;r!=null&&i&&(r.getWorldPosition(uU).sub(Ny),this._lineTarget.geometry.tail.copy(uU),this._lineTarget.geometry.update(),this._lineTarget.position.copy(Ny)),super.updateMatrixWorld(t)}},ewe=new X,twe=new X;function cP(t,e){return t.matrixWorld.decompose(ewe,e,twe),e}function Y_(t){return[Math.atan2(-t.z,t.x),Math.atan2(t.y,Math.sqrt(t.x*t.x+t.z*t.z))]}function fU(t){const e=Math.round(t/2/Math.PI);return t-2*Math.PI*e}var hU=new X(0,0,1),nwe=new X,rwe=new X,iwe=new X,swe=new qt,nT=new qt,pU=new qt,owe=new qt,rT=new as,FG=class zG{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 zG(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 cP(n,e)}getFaceFrontQuaternion(e){if(this.faceFront.distanceToSquared(hU)<.01)return e.copy(this._restHeadWorldQuaternion).invert();const[n,r]=Y_(this.faceFront);return rT.set(0,.5*Math.PI+n,r,"YZX"),e.setFromEuler(rT).premultiply(owe.copy(this._restHeadWorldQuaternion).invert())}getLookAtWorldDirection(e){return this.getLookAtWorldQuaternion(nT),this.getFaceFrontQuaternion(pU),e.copy(hU).applyQuaternion(nT).applyQuaternion(pU).applyEuler(this.getEuler(rT))}lookAt(e){const n=swe.copy(this._restHeadWorldQuaternion).multiply(DG(this.getLookAtWorldQuaternion(nT))),r=this.getLookAtWorldPosition(rwe),i=iwe.copy(e).sub(r).applyQuaternion(n).normalize(),[s,o]=Y_(this.faceFront),[a,l]=Y_(i),c=fU(a-s),d=fU(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(nwe)),this._needsUpdate&&(this._needsUpdate=!1,this.applier.applyYawPitch(this._yaw,this._pitch))}};FG.EULER_ORDER="YXZ";var awe=FG,lwe=new X(0,0,1),ml=new qt,km=new qt,zo=new as(0,0,0,"YXZ"),Z_=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),cP(s.parent,this._restLeftEyeParentWorldQuat)),o&&(this._restQuatRightEye.copy(o.quaternion),cP(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?zo.x=-gr.DEG2RAD*this.rangeMapVerticalDown.map(-e):zo.x=gr.DEG2RAD*this.rangeMapVerticalUp.map(e),t<0?zo.y=-gr.DEG2RAD*this.rangeMapHorizontalInner.map(-t):zo.y=gr.DEG2RAD*this.rangeMapHorizontalOuter.map(t),ml.setFromEuler(zo),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?zo.x=-gr.DEG2RAD*this.rangeMapVerticalDown.map(-e):zo.x=gr.DEG2RAD*this.rangeMapVerticalUp.map(e),t<0?zo.y=-gr.DEG2RAD*this.rangeMapHorizontalOuter.map(-t):zo.y=gr.DEG2RAD*this.rangeMapHorizontalInner.map(t),ml.setFromEuler(zo),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(lwe)<.01)return t.identity();const[e,n]=Y_(this.faceFront);return zo.set(0,.5*Math.PI+e,n,"YZX"),t.setFromEuler(zo)}};Z_.type="bone";var uP=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)}};uP.type="expression";var mU=class{constructor(t,e){this.inputMaxValue=t,this.outputScale=e}map(t){return this.outputScale*CG(t/this.inputMaxValue)}},cwe=new Set(["1.0","1.0-beta"]),O_=.01,uwe=class{get name(){return"VRMLookAtLoaderPlugin"}constructor(t,e){this.parser=t,this.helperRoot=e==null?void 0:e.helperRoot}afterRoot(t){return jn(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 jn(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 jn(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(!cwe.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 uP(n,m,y,x,S):_=new Z_(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(console.error(o),console.warn("VRMMetaLoaderPlugin: Failed to load a thumbnail image"),null))})}},pwe=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()}},mwe=class extends pwe{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)})}},gwe=Object.defineProperty,gU=Object.getOwnPropertySymbols,vwe=Object.prototype.hasOwnProperty,ywe=Object.prototype.propertyIsEnumerable,vU=(t,e,n)=>e in t?gwe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,yU=(t,e)=>{for(var n in e||(e={}))vwe.call(e,n)&&vU(t,n,e[n]);if(gU)for(var n of gU(e))ywe.call(e,n)&&vU(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())}),xwe={"":3e3,srgb:3001};function bwe(t,e){parseInt(Td,10)>=152?t.colorSpace=e:t.encoding=xwe[e]}var _we=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&&bwe(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)})}},wwe=`// #define PHONG varying vec3 vViewPosition; @@ -5401,7 +5401,7 @@ void main() { } `,Mwe={None:"none"},xU={None:"none",ScreenCoordinates:"screenCoordinates"},Ewe={3e3:"",3001:"srgb"};function iT(t){return parseInt(Td,10)>=152?t.colorSpace:Ewe[t.encoding]}var Awe=class extends Qo{constructor(t={}){var e;super({vertexShader:wwe,fragmentShader:Swe}),this.uvAnimationScrollXSpeedFactor=0,this.uvAnimationScrollYSpeedFactor=0,this.uvAnimationRotationSpeedFactor=0,this.fog=!0,this.normalMapType=lu,this._ignoreVertexColor=!0,this._v0CompatShade=!1,this._debugMode=Mwe.None,this._outlineWidthMode=xU.None,this._isOutline=!1,t.transparentWithZWrite&&(t.depthWrite=!0),delete t.transparentWithZWrite,t.fog=!0,t.lights=!0,t.clipping=!0,this.uniforms=AR.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:${iT(this.matcapTexture)}`:"",this.shadeMultiplyTexture?`shadeMultiplyTextureColorSpace:${iT(this.shadeMultiplyTexture)}`:"",this.rimMultiplyTexture?`rimMultiplyTextureColorSpace:${iT(this.rimMultiplyTexture)}`:""].join(","),this.onBeforeCompile=n=>{const r=parseInt(Td,10),i=Object.entries(yU(yU({},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 ","#include "))}}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===xU.ScreenCoordinates}}_updateTextureMatrix(t,e){t.value&&(t.value.matrixAutoUpdate&&t.value.updateMatrix(),e.value.copy(t.value.matrix))}},Twe=new Set(["1.0","1.0-beta"]),BG=class Q_{get name(){return Q_.EXTENSION_NAME}constructor(e,n={}){var r,i,s,o;this.parser=e,this.materialType=(r=n.materialType)!=null?r:Awe,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{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[Q_.EXTENSION_NAME];if(a==null)return;const l=a.specVersion;if(!Twe.has(l)){console.warn(`MToonMaterialLoaderPlugin: Unknown ${Q_.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 _we(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)}};BG.EXTENSION_NAME="VRMC_materials_mtoon";var Cwe=BG,Pwe=(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())}),HG=class dP{get name(){return dP.EXTENSION_NAME}constructor(e){this.parser=e}extendMaterialParams(e,n){return Pwe(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[dP.EXTENSION_NAME];if(a!=null)return a}};HG.EXTENSION_NAME="VRMC_materials_hdr_emissiveMultiplier";var Rwe=HG,Nwe=Object.defineProperty,Iwe=Object.defineProperties,kwe=Object.getOwnPropertyDescriptors,bU=Object.getOwnPropertySymbols,Owe=Object.prototype.hasOwnProperty,Lwe=Object.prototype.propertyIsEnumerable,_U=(t,e,n)=>e in t?Nwe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ml=(t,e)=>{for(var n in e||(e={}))Owe.call(e,n)&&_U(t,n,e[n]);if(bU)for(var n of bU(e))Lwe.call(e,n)&&_U(t,n,e[n]);return t},wU=(t,e)=>Iwe(t,kwe(e)),Dwe=(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 jwe=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 Dwe(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,E,T,C,O,N,L,F,V,k,U,H,ne,te,pe,oe,ce,B,K,q,$,Z,ge,ae,fe,_e,Se,$e,Me,He,Xe,ue,Q,Ge,je,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,yt)=>yt===3?et:Om(et)),Dt=(y=t.textureProperties)==null?void 0:y._MainTex,jt=Dt!=null?{index:Dt,extensions:ml({},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:ml({},qe)}:void 0,Ae=((E=(w=t.vectorProperties)==null?void 0:w._EmissionColor)!=null?E:[0,0,0,1]).map(Om),re=(T=t.textureProperties)==null?void 0:T._EmissionMap,Fe=re!=null?{index:re,extensions:ml({},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:ml({},qe)}:void 0;let ut=(F=(L=t.floatProperties)==null?void 0:L._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=(U=t.floatProperties)==null?void 0:U._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:ml({},qe)}:void 0,qa=((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 To=(_e=(fe=t.floatProperties)==null?void 0:fe._OutlineWidth)!=null?_e:0;To=.01*To;const sa=(Se=t.textureProperties)==null?void 0:Se._OutlineWidthTexture,cu=sa!=null?{index:sa,extensions:ml({},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:ml({},qe)}:void 0,xe=(We=(je=t.floatProperties)==null?void 0:je._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:qa,parametricRimFresnelPowerFactor:Ns,parametricRimLiftFactor:ia,outlineWidthMode:Ei,outlineWidthFactor:To,outlineWidthMultiplyTexture:cu,outlineColorFactor:uu,outlineLightingMixFactor:du,uvAnimationMaskTexture:Y,uvAnimationScrollXSpeedFactor:xe,uvAnimationScrollYSpeedFactor:Re,uvAnimationRotationSpeedFactor:ke};return wU(ml({},e),{pbrMetallicRoughness:{baseColorFactor:dt,baseColorTexture:jt},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:ml({},y)}:void 0,w={specVersion:"1.0",transparentWithZWrite:a,renderQueueOffsetNumber:c,shadeColorFactor:x,shadeMultiplyTexture:_};return wU(ml({},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)})}},SU=(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,sT=class extends Ts{constructor(t){super(),this._attrPosition=new Qt(new Float32Array([0,0,0,0,0,0]),3),this._attrPosition.setUsage(n6);const e=new Zt;e.setAttribute("position",this._attrPosition);const n=new $r({color:16711935,depthTest:!1,depthWrite:!1});this._line=new Ul(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 MU(t,e){return e.set(t.elements[12],t.elements[13],t.elements[14])}var Uwe=new X,Fwe=new X;function zwe(t,e){return t.decompose(Uwe,e,Fwe),e}function U1(t){return t.invert?t.invert():t.inverse(),t}var sN=class{constructor(t,e){this.destination=t,this.source=e,this.weight=1}},Bwe=new X,Hwe=new X,Vwe=new X,Gwe=new qt,Wwe=new qt,$we=new qt,Xwe=class extends sN{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=Gwe.identity(),e=Wwe.identity();this.destination.parent&&(zwe(this.destination.parent.matrixWorld,t),U1(e.copy(t)));const n=Bwe.copy(this._v3AimAxis).applyQuaternion(this._dstRestQuat).applyQuaternion(t),r=MU(this.source.matrixWorld,Hwe).sub(MU(this.destination.matrixWorld,Vwe)).normalize(),i=$we.setFromUnitVectors(n,r).premultiply(e).multiply(t).multiply(this._dstRestQuat);this.destination.quaternion.copy(this._dstRestQuat).slerp(i,this.weight)}};function qwe(t,e){const n=[t];let r=t.parent;for(;r!==null;)n.unshift(r),r=r.parent;n.forEach(i=>{e(i)})}var Kwe=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)qwe(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)}},Ywe=new qt,Zwe=new qt,Qwe=class extends sN{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=Ywe.copy(this._invSrcRestQuat).multiply(this.source.quaternion),e=Zwe.copy(this._dstRestQuat).multiply(t);this.destination.quaternion.copy(this._dstRestQuat).slerp(e,this.weight)}},Jwe=new X,e1e=new qt,t1e=new qt,n1e=class extends sN{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=e1e.copy(this._invDstRestQuat).multiply(this.source.quaternion).multiply(this._invSrcRestQuatMulDstRestQuat),e=Jwe.copy(this._v3RollAxis).applyQuaternion(t),r=t1e.setFromUnitVectors(e,this._v3RollAxis).premultiply(this._dstRestQuat).multiply(t);this.destination.quaternion.copy(this._dstRestQuat).slerp(r,this.weight)}},r1e=new Set(["1.0","1.0-beta"]),VG=class By{get name(){return By.EXTENSION_NAME}constructor(e,n){this.parser=e,this.helperRoot=n==null?void 0:n.helperRoot}afterRoot(e){return SU(this,null,function*(){e.userData.vrmNodeConstraintManager=yield this._import(e)})}_import(e){return SU(this,null,function*(){var n;const r=this.parser.json;if(!(((n=r.extensionsUsed)==null?void 0:n.indexOf(By.EXTENSION_NAME))!==-1))return null;const s=new Kwe,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[By.EXTENSION_NAME];if(f==null)return;const m=f.specVersion;if(!r1e.has(m)){console.warn(`VRMNodeConstraintLoaderPlugin: Unknown ${By.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 n1e(e,a);if(s!=null&&(l.rollAxis=s),o!=null&&(l.weight=o),this.helperRoot){const c=new sT(l);this.helperRoot.add(c)}return l}_importAimConstraint(e,n,r){const{source:i,aimAxis:s,weight:o}=r,a=n[i],l=new Xwe(e,a);if(s!=null&&(l.aimAxis=s),o!=null&&(l.weight=o),this.helperRoot){const c=new sT(l);this.helperRoot.add(c)}return l}_importRotationConstraint(e,n,r){const{source:i,weight:s}=r,o=n[i],a=new Qwe(e,o);if(s!=null&&(a.weight=s),this.helperRoot){const l=new sT(a);this.helperRoot.add(l)}return a}};VG.EXTENSION_NAME="VRMC_node_constraint";var i1e=VG,L_=(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())}),oN=class{},oT=new X,Hf=new X,GG=class extends oN{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){oT.setFromMatrixPosition(t),Hf.subVectors(this.tail,this.offset).applyMatrix4(t),Hf.sub(oT);const i=Hf.lengthSq();r.copy(e).sub(oT);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}},aT=new X,EU=new Xt,WG=class extends oN{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),EU.getNormalMatrix(t),aT.copy(this.normal).applyNormalMatrix(EU).normalize();const i=r.dot(aT)-n;return r.copy(aT),i}},s1e=new X,$G=class extends oN{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,s1e.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}},gl=new X,o1e=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=gl.copy(this._shape.tail).divideScalar(this.worldScale);this._currentTail.distanceToSquared(n)>1e-10&&(this._currentTail.copy(n),t=!0),t&&this._buildPosition()}_buildPosition(){gl.copy(this._currentTail).sub(this._currentOffset);const t=gl.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(gl.y,Math.sqrt(gl.x*gl.x+gl.z*gl.z)),n=-Math.atan2(gl.z,gl.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}},a1e=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}},l1e=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}},c1e=new X,lT=class extends Ts{constructor(t){if(super(),this.matrixAutoUpdate=!1,this.collider=t,this.collider.shape instanceof $G)this._geometry=new l1e(this.collider.shape);else if(this.collider.shape instanceof GG)this._geometry=new o1e(this.collider.shape);else if(this.collider.shape instanceof WG)this._geometry=new a1e(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=c1e.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(t)}},u1e=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}},d1e=new X,f1e=class extends Ts{constructor(t){super(),this.matrixAutoUpdate=!1,this.springBone=t,this._geometry=new u1e(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=d1e.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(t)}},cT=class extends mn{constructor(t){super(),this.colliderMatrix=new Ct,this.shape=t}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),h1e(this.colliderMatrix,this.matrixWorld,this.shape.offset)}};function h1e(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 p1e=new Ct;function m1e(t){return t.invert?t.invert():t.getInverse(p1e.copy(t)),t}var g1e=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&&(m1e(this._inverseCache.copy(this.matrix)),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}},uT=new Ct,Lm=new X,Iy=new X,ky=new X,Oy=new X,v1e=new Ct,y1e=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{e(i)})}function fP(t,e){t.children.forEach(n=>{e(n)||fP(n,e)})}function b1e(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 AU=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{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;x1e(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)}},TU="VRMC_springBone_extended_collider",_1e=new Set(["1.0","1.0-beta"]),w1e=new Set(["1.0"]),XG=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 L_(this,null,function*(){e.userData.vrmSpringBoneManager=yield this._import(e)})}_import(e){return L_(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 L_(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 AU,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(!_1e.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,E,T,C,O,N,L,F,V,k,U,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[TU];if(this.useExtendedColliders&&B!=null){const K=B.specVersion;if(!w1e.has(K))console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${TU} 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((E=q.sphere.offset)!=null?E:[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((L=q.capsule.tail)!=null?L:[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((U=ce.sphere.offset)!=null?U:[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 E=S.joints,T=(w=S.colliderGroups)==null?void 0:w.map(N=>{const L=x==null?void 0:x[N];return L??(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;E.forEach(N=>{if(O){const L=O.node,F=d[L],V=N.node,k=d[V],U={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,U,T);C&&(H.center=C),c.addJoint(H)}O=N})}),c.setInitState(),c})}_v0Import(e){return L_(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 AU,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((E,T)=>{var C,O,N;const L=new X(0,0,0);return E.offset&&L.set((C=E.offset.x)!=null?C:0,(O=E.offset.y)!=null?O:0,E.offset.z?-E.offset.z:0),this._importSphereCollider(_,{offset:L,radius:(N=E.radius)!=null?N:0,inside:!1})})}});return c==null||c.forEach((y,x)=>{const S=y.bones;S&&S.forEach(_=>{var w,E,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,(E=y.gravityDir.y)!=null?E:0,(T=y.gravityDir.z)!=null?T:0):N.set(0,-1,0);const L=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 U=m==null?void 0:m[k];return U??(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 U;const H=(U=k.children[0])!=null?U:null,ne=this._importJoint(k,H,F,V);L&&(ne.center=L),d.addJoint(ne)})})}),e.scene.updateMatrixWorld(),d.setInitState(),d})}_importJoint(e,n,r,i){const s=new y1e(e,n,r,i);if(this.jointHelperRoot){const o=new f1e(s);this.jointHelperRoot.add(o),o.renderOrder=this.jointHelperRoot.renderOrder}return s}_importSphereCollider(e,n){const r=new $G(n),i=new cT(r);if(e.add(i),this.colliderHelperRoot){const s=new lT(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importCapsuleCollider(e,n){const r=new GG(n),i=new cT(r);if(e.add(i),this.colliderHelperRoot){const s=new lT(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importPlaneCollider(e,n){const r=new WG(n),i=new cT(r);if(e.add(i),this.colliderHelperRoot){const s=new lT(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}};XG.EXTENSION_NAME="VRMC_springBone";var S1e=XG,M1e=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 z_e(t),this.firstPersonPlugin=(r=e==null?void 0:e.firstPersonPlugin)!=null?r:new H_e(t),this.humanoidPlugin=(i=e==null?void 0:e.humanoidPlugin)!=null?i:new K_e(t,{helperRoot:m,autoUpdateHumanBones:y}),this.lookAtPlugin=(s=e==null?void 0:e.lookAtPlugin)!=null?s:new uwe(t,{helperRoot:m}),this.metaPlugin=(o=e==null?void 0:e.metaPlugin)!=null?o:new hwe(t),this.mtoonMaterialPlugin=(a=e==null?void 0:e.mtoonMaterialPlugin)!=null?a:new Cwe(t),this.materialsHDREmissiveMultiplierPlugin=(l=e==null?void 0:e.materialsHDREmissiveMultiplierPlugin)!=null?l:new Rwe(t),this.materialsV0CompatPlugin=(c=e==null?void 0:e.materialsV0CompatPlugin)!=null?c:new jwe(t),this.springBonePlugin=(d=e==null?void 0:e.springBonePlugin)!=null?d:new S1e(t,{colliderHelperRoot:m,jointHelperRoot:m}),this.nodeConstraintPlugin=(f=e==null?void 0:e.nodeConstraintPlugin)!=null?f:new i1e(t,{helperRoot:m})}beforeRoot(){return I_(this,null,function*(){yield this.materialsV0CompatPlugin.beforeRoot(),yield this.mtoonMaterialPlugin.beforeRoot()})}loadMesh(t){return I_(this,null,function*(){return yield this.mtoonMaterialPlugin.loadMesh(t)})}getMaterialType(t){const e=this.mtoonMaterialPlugin.getMaterialType(t);return e??null}extendMaterialParams(t,e){return I_(this,null,function*(){yield this.materialsHDREmissiveMultiplierPlugin.extendMaterialParams(t,e),yield this.mtoonMaterialPlugin.extendMaterialParams(t,e)})}afterRoot(t){return I_(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 mwe({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 E1e(t){const e=new Set;return t.traverse(n=>{if(!n.isMesh)return;const r=n;e.add(r)}),e}function CU(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;cd.getOrCreate(V)).join(","),L=`${C};${w};${N}`;let F=a.get(L);F==null&&(F=T.clone(),I1e(F,O,x),a.set(L,F)),E.geometry.setAttribute("skinIndex",F)}for(const E of y)E.bind(_,new Ct)}}function C1e(t){const e=new Set;return t.traverse(n=>{if(!n.isSkinnedMesh)return;const r=n;e.add(r)}),e}function P1e(t,e){const n=new Set;for(let r=0;rn)return!1;return!0}var dT=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 O1e(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 PU(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 L1e(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=>PU(i)):r&&PU(r))}function D1e(t){t.traverse(L1e)}function j1e(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{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 B1e(t,e,n){const r=e.array,i=new r.constructor(r.length);for(let s=0;s{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}=U1e(i.attributes,s);if(c===l)return;const{originalIndexNewIndexMap:d,newIndexOriginalIndexMap:f}=F1e(a),m=new Zt;z1e(i,m),e.set(i,m),B1e(m,s,d),V1e(m,i.attributes,f),W1e(m,i.morphAttributes,f),r.geometry=m}),Array.from(e.keys()).forEach(n=>{n.dispose()})}function X1e(t){var e;((e=t.meta)==null?void 0:e.metaVersion)==="0"&&(t.scene.rotation.y=Math.PI)}var Xc=class{constructor(){}};Xc.combineMorphs=A1e;Xc.combineSkeletons=T1e;Xc.deepDispose=D1e;Xc.removeUnnecessaryJoints=j1e;Xc.removeUnnecessaryVertices=$1e;Xc.rotateVRM0=X1e;/*! +`;n.vertexShader=i+n.vertexShader,n.fragmentShader=i+n.fragmentShader,r<154&&(n.fragmentShader=n.fragmentShader.replace("#include ","#include "))}}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===xU.ScreenCoordinates}}_updateTextureMatrix(t,e){t.value&&(t.value.matrixAutoUpdate&&t.value.updateMatrix(),e.value.copy(t.value.matrix))}},Twe=new Set(["1.0","1.0-beta"]),BG=class Q_{get name(){return Q_.EXTENSION_NAME}constructor(e,n={}){var r,i,s,o;this.parser=e,this.materialType=(r=n.materialType)!=null?r:Awe,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{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[Q_.EXTENSION_NAME];if(a==null)return;const l=a.specVersion;if(!Twe.has(l)){console.warn(`MToonMaterialLoaderPlugin: Unknown ${Q_.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 _we(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)}};BG.EXTENSION_NAME="VRMC_materials_mtoon";var Cwe=BG,Pwe=(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())}),HG=class dP{get name(){return dP.EXTENSION_NAME}constructor(e){this.parser=e}extendMaterialParams(e,n){return Pwe(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[dP.EXTENSION_NAME];if(a!=null)return a}};HG.EXTENSION_NAME="VRMC_materials_hdr_emissiveMultiplier";var Rwe=HG,Nwe=Object.defineProperty,Iwe=Object.defineProperties,kwe=Object.getOwnPropertyDescriptors,bU=Object.getOwnPropertySymbols,Owe=Object.prototype.hasOwnProperty,Lwe=Object.prototype.propertyIsEnumerable,_U=(t,e,n)=>e in t?Nwe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,gl=(t,e)=>{for(var n in e||(e={}))Owe.call(e,n)&&_U(t,n,e[n]);if(bU)for(var n of bU(e))Lwe.call(e,n)&&_U(t,n,e[n]);return t},wU=(t,e)=>Iwe(t,kwe(e)),Dwe=(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 jwe=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 Dwe(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,E,T,C,O,N,L,F,V,k,U,H,ne,te,pe,oe,ce,B,K,q,$,Z,ge,ae,fe,_e,Se,$e,Me,He,Xe,ue,Q,Ge,je,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,yt)=>yt===3?et:Om(et)),Dt=(y=t.textureProperties)==null?void 0:y._MainTex,jt=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=((E=(w=t.vectorProperties)==null?void 0:w._EmissionColor)!=null?E:[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=(L=t.floatProperties)==null?void 0:L._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=(U=t.floatProperties)==null?void 0:U._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 To=(_e=(fe=t.floatProperties)==null?void 0:fe._OutlineWidth)!=null?_e:0;To=.01*To;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=(je=t.floatProperties)==null?void 0:je._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:To,outlineWidthMultiplyTexture:cu,outlineColorFactor:uu,outlineLightingMixFactor:du,uvAnimationMaskTexture:Y,uvAnimationScrollXSpeedFactor:xe,uvAnimationScrollYSpeedFactor:Re,uvAnimationRotationSpeedFactor:ke};return wU(gl({},e),{pbrMetallicRoughness:{baseColorFactor:dt,baseColorTexture:jt},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 wU(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)})}},SU=(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,sT=class extends Ts{constructor(t){super(),this._attrPosition=new Qt(new Float32Array([0,0,0,0,0,0]),3),this._attrPosition.setUsage(n6);const e=new Zt;e.setAttribute("position",this._attrPosition);const n=new $r({color:16711935,depthTest:!1,depthWrite:!1});this._line=new Ul(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 MU(t,e){return e.set(t.elements[12],t.elements[13],t.elements[14])}var Uwe=new X,Fwe=new X;function zwe(t,e){return t.decompose(Uwe,e,Fwe),e}function U1(t){return t.invert?t.invert():t.inverse(),t}var sN=class{constructor(t,e){this.destination=t,this.source=e,this.weight=1}},Bwe=new X,Hwe=new X,Vwe=new X,Gwe=new qt,Wwe=new qt,$we=new qt,Xwe=class extends sN{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=Gwe.identity(),e=Wwe.identity();this.destination.parent&&(zwe(this.destination.parent.matrixWorld,t),U1(e.copy(t)));const n=Bwe.copy(this._v3AimAxis).applyQuaternion(this._dstRestQuat).applyQuaternion(t),r=MU(this.source.matrixWorld,Hwe).sub(MU(this.destination.matrixWorld,Vwe)).normalize(),i=$we.setFromUnitVectors(n,r).premultiply(e).multiply(t).multiply(this._dstRestQuat);this.destination.quaternion.copy(this._dstRestQuat).slerp(i,this.weight)}};function qwe(t,e){const n=[t];let r=t.parent;for(;r!==null;)n.unshift(r),r=r.parent;n.forEach(i=>{e(i)})}var Kwe=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)qwe(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)}},Ywe=new qt,Zwe=new qt,Qwe=class extends sN{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=Ywe.copy(this._invSrcRestQuat).multiply(this.source.quaternion),e=Zwe.copy(this._dstRestQuat).multiply(t);this.destination.quaternion.copy(this._dstRestQuat).slerp(e,this.weight)}},Jwe=new X,e1e=new qt,t1e=new qt,n1e=class extends sN{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=e1e.copy(this._invDstRestQuat).multiply(this.source.quaternion).multiply(this._invSrcRestQuatMulDstRestQuat),e=Jwe.copy(this._v3RollAxis).applyQuaternion(t),r=t1e.setFromUnitVectors(e,this._v3RollAxis).premultiply(this._dstRestQuat).multiply(t);this.destination.quaternion.copy(this._dstRestQuat).slerp(r,this.weight)}},r1e=new Set(["1.0","1.0-beta"]),VG=class By{get name(){return By.EXTENSION_NAME}constructor(e,n){this.parser=e,this.helperRoot=n==null?void 0:n.helperRoot}afterRoot(e){return SU(this,null,function*(){e.userData.vrmNodeConstraintManager=yield this._import(e)})}_import(e){return SU(this,null,function*(){var n;const r=this.parser.json;if(!(((n=r.extensionsUsed)==null?void 0:n.indexOf(By.EXTENSION_NAME))!==-1))return null;const s=new Kwe,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[By.EXTENSION_NAME];if(f==null)return;const m=f.specVersion;if(!r1e.has(m)){console.warn(`VRMNodeConstraintLoaderPlugin: Unknown ${By.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 n1e(e,a);if(s!=null&&(l.rollAxis=s),o!=null&&(l.weight=o),this.helperRoot){const c=new sT(l);this.helperRoot.add(c)}return l}_importAimConstraint(e,n,r){const{source:i,aimAxis:s,weight:o}=r,a=n[i],l=new Xwe(e,a);if(s!=null&&(l.aimAxis=s),o!=null&&(l.weight=o),this.helperRoot){const c=new sT(l);this.helperRoot.add(c)}return l}_importRotationConstraint(e,n,r){const{source:i,weight:s}=r,o=n[i],a=new Qwe(e,o);if(s!=null&&(a.weight=s),this.helperRoot){const l=new sT(a);this.helperRoot.add(l)}return a}};VG.EXTENSION_NAME="VRMC_node_constraint";var i1e=VG,L_=(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())}),oN=class{},oT=new X,Hf=new X,GG=class extends oN{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){oT.setFromMatrixPosition(t),Hf.subVectors(this.tail,this.offset).applyMatrix4(t),Hf.sub(oT);const i=Hf.lengthSq();r.copy(e).sub(oT);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}},aT=new X,EU=new Xt,WG=class extends oN{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),EU.getNormalMatrix(t),aT.copy(this.normal).applyNormalMatrix(EU).normalize();const i=r.dot(aT)-n;return r.copy(aT),i}},s1e=new X,$G=class extends oN{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,s1e.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,o1e=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}},a1e=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}},l1e=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}},c1e=new X,lT=class extends Ts{constructor(t){if(super(),this.matrixAutoUpdate=!1,this.collider=t,this.collider.shape instanceof $G)this._geometry=new l1e(this.collider.shape);else if(this.collider.shape instanceof GG)this._geometry=new o1e(this.collider.shape);else if(this.collider.shape instanceof WG)this._geometry=new a1e(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=c1e.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(t)}},u1e=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}},d1e=new X,f1e=class extends Ts{constructor(t){super(),this.matrixAutoUpdate=!1,this.springBone=t,this._geometry=new u1e(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=d1e.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(t)}},cT=class extends mn{constructor(t){super(),this.colliderMatrix=new Ct,this.shape=t}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),h1e(this.colliderMatrix,this.matrixWorld,this.shape.offset)}};function h1e(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 p1e=new Ct;function m1e(t){return t.invert?t.invert():t.getInverse(p1e.copy(t)),t}var g1e=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&&(m1e(this._inverseCache.copy(this.matrix)),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}},uT=new Ct,Lm=new X,Iy=new X,ky=new X,Oy=new X,v1e=new Ct,y1e=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{e(i)})}function fP(t,e){t.children.forEach(n=>{e(n)||fP(n,e)})}function b1e(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 AU=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{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;x1e(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)}},TU="VRMC_springBone_extended_collider",_1e=new Set(["1.0","1.0-beta"]),w1e=new Set(["1.0"]),XG=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 L_(this,null,function*(){e.userData.vrmSpringBoneManager=yield this._import(e)})}_import(e){return L_(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 L_(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 AU,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(!_1e.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,E,T,C,O,N,L,F,V,k,U,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[TU];if(this.useExtendedColliders&&B!=null){const K=B.specVersion;if(!w1e.has(K))console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${TU} 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((E=q.sphere.offset)!=null?E:[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((L=q.capsule.tail)!=null?L:[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((U=ce.sphere.offset)!=null?U:[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 E=S.joints,T=(w=S.colliderGroups)==null?void 0:w.map(N=>{const L=x==null?void 0:x[N];return L??(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;E.forEach(N=>{if(O){const L=O.node,F=d[L],V=N.node,k=d[V],U={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,U,T);C&&(H.center=C),c.addJoint(H)}O=N})}),c.setInitState(),c})}_v0Import(e){return L_(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 AU,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((E,T)=>{var C,O,N;const L=new X(0,0,0);return E.offset&&L.set((C=E.offset.x)!=null?C:0,(O=E.offset.y)!=null?O:0,E.offset.z?-E.offset.z:0),this._importSphereCollider(_,{offset:L,radius:(N=E.radius)!=null?N:0,inside:!1})})}});return c==null||c.forEach((y,x)=>{const S=y.bones;S&&S.forEach(_=>{var w,E,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,(E=y.gravityDir.y)!=null?E:0,(T=y.gravityDir.z)!=null?T:0):N.set(0,-1,0);const L=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 U=m==null?void 0:m[k];return U??(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 U;const H=(U=k.children[0])!=null?U:null,ne=this._importJoint(k,H,F,V);L&&(ne.center=L),d.addJoint(ne)})})}),e.scene.updateMatrixWorld(),d.setInitState(),d})}_importJoint(e,n,r,i){const s=new y1e(e,n,r,i);if(this.jointHelperRoot){const o=new f1e(s);this.jointHelperRoot.add(o),o.renderOrder=this.jointHelperRoot.renderOrder}return s}_importSphereCollider(e,n){const r=new $G(n),i=new cT(r);if(e.add(i),this.colliderHelperRoot){const s=new lT(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importCapsuleCollider(e,n){const r=new GG(n),i=new cT(r);if(e.add(i),this.colliderHelperRoot){const s=new lT(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importPlaneCollider(e,n){const r=new WG(n),i=new cT(r);if(e.add(i),this.colliderHelperRoot){const s=new lT(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}};XG.EXTENSION_NAME="VRMC_springBone";var S1e=XG,M1e=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 z_e(t),this.firstPersonPlugin=(r=e==null?void 0:e.firstPersonPlugin)!=null?r:new H_e(t),this.humanoidPlugin=(i=e==null?void 0:e.humanoidPlugin)!=null?i:new K_e(t,{helperRoot:m,autoUpdateHumanBones:y}),this.lookAtPlugin=(s=e==null?void 0:e.lookAtPlugin)!=null?s:new uwe(t,{helperRoot:m}),this.metaPlugin=(o=e==null?void 0:e.metaPlugin)!=null?o:new hwe(t),this.mtoonMaterialPlugin=(a=e==null?void 0:e.mtoonMaterialPlugin)!=null?a:new Cwe(t),this.materialsHDREmissiveMultiplierPlugin=(l=e==null?void 0:e.materialsHDREmissiveMultiplierPlugin)!=null?l:new Rwe(t),this.materialsV0CompatPlugin=(c=e==null?void 0:e.materialsV0CompatPlugin)!=null?c:new jwe(t),this.springBonePlugin=(d=e==null?void 0:e.springBonePlugin)!=null?d:new S1e(t,{colliderHelperRoot:m,jointHelperRoot:m}),this.nodeConstraintPlugin=(f=e==null?void 0:e.nodeConstraintPlugin)!=null?f:new i1e(t,{helperRoot:m})}beforeRoot(){return I_(this,null,function*(){yield this.materialsV0CompatPlugin.beforeRoot(),yield this.mtoonMaterialPlugin.beforeRoot()})}loadMesh(t){return I_(this,null,function*(){return yield this.mtoonMaterialPlugin.loadMesh(t)})}getMaterialType(t){const e=this.mtoonMaterialPlugin.getMaterialType(t);return e??null}extendMaterialParams(t,e){return I_(this,null,function*(){yield this.materialsHDREmissiveMultiplierPlugin.extendMaterialParams(t,e),yield this.mtoonMaterialPlugin.extendMaterialParams(t,e)})}afterRoot(t){return I_(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 mwe({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 E1e(t){const e=new Set;return t.traverse(n=>{if(!n.isMesh)return;const r=n;e.add(r)}),e}function CU(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;cd.getOrCreate(V)).join(","),L=`${C};${w};${N}`;let F=a.get(L);F==null&&(F=T.clone(),I1e(F,O,x),a.set(L,F)),E.geometry.setAttribute("skinIndex",F)}for(const E of y)E.bind(_,new Ct)}}function C1e(t){const e=new Set;return t.traverse(n=>{if(!n.isSkinnedMesh)return;const r=n;e.add(r)}),e}function P1e(t,e){const n=new Set;for(let r=0;rn)return!1;return!0}var dT=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 O1e(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 PU(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 L1e(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=>PU(i)):r&&PU(r))}function D1e(t){t.traverse(L1e)}function j1e(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{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 B1e(t,e,n){const r=e.array,i=new r.constructor(r.length);for(let s=0;s{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}=U1e(i.attributes,s);if(c===l)return;const{originalIndexNewIndexMap:d,newIndexOriginalIndexMap:f}=F1e(a),m=new Zt;z1e(i,m),e.set(i,m),B1e(m,s,d),V1e(m,i.attributes,f),W1e(m,i.morphAttributes,f),r.geometry=m}),Array.from(e.keys()).forEach(n=>{n.dispose()})}function X1e(t){var e;((e=t.meta)==null?void 0:e.metaVersion)==="0"&&(t.scene.rotation.y=Math.PI)}var Xc=class{constructor(){}};Xc.combineMorphs=A1e;Xc.combineSkeletons=T1e;Xc.deepDispose=D1e;Xc.removeUnnecessaryJoints=j1e;Xc.removeUnnecessaryVertices=$1e;Xc.rotateVRM0=X1e;/*! * @pixiv/three-vrm-core v3.5.4 * The implementation of core features of VRM, for @pixiv/three-vrm * @@ -5443,7 +5443,7 @@ void main() { * 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 q1e={leftUpperArm:[0,0,1.2],rightUpperArm:[0,0,-1.2],leftLowerArm:[0,-.2,0],rightLowerArm:[0,.2,0]};function vl(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 K1e(t){var e;for(const[n,r]of Object.entries(q1e))vl(t,n,r[0],r[1],r[2]);(e=t.humanoid)==null||e.update()}function Y1e(t,e,n){const r=Math.sin(e*1.7),i=Math.sin(e*.5),s=Math.min(1,n*1.4);vl(t,"spine",r*.025,i*.03,Math.sin(e*.43)*.015),vl(t,"chest",r*.02,i*.02,0),vl(t,"hips",0,Math.sin(e*.37)*.02,Math.sin(e*.29)*.01),vl(t,"neck",Math.sin(e*.8)*.03+s*.06,Math.sin(e*.31)*.05,0),vl(t,"head",Math.sin(e*.6)*.025+s*.05,Math.sin(e*.27)*.06,Math.sin(e*.5)*.02);const o=Math.sin(e*.8)*.04;vl(t,"leftUpperArm",0,0,1.2+o),vl(t,"rightUpperArm",0,0,-1.2-o),vl(t,"leftLowerArm",0,-.2-Math.sin(e*.8)*.03,0),vl(t,"rightLowerArm",0,.2+Math.sin(e*.8)*.03,0)}const Z1e=["happy","angry","sad","surprised","relaxed"],Q1e={neutral:null,happy:"happy",angry:"angry",sad:"sad",surprised:"surprised",relaxed:"relaxed"};function J1e({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});return R.useEffect(()=>{let l=!1,c=null;const d=new n_e;return d.register(f=>new M1e(f)),d.load(t,f=>{var y;if(l)return;const m=f.userData.vrm;if(!m){r("Datei enthält kein gültiges VRM-Modell.");return}Xc.removeUnnecessaryVertices(f.scene),((y=m.meta)==null?void 0:y.metaVersion)==="0"&&Xc.rotateVRM0(m),m.scene.rotation.y=Math.PI,K1e(m),c=m,s(m)},void 0,f=>{console.error("VRM-Load-Fehler:",f),r("Avatar konnte nicht geladen werden (CORS/URL?).")}),()=>{l=!0,c&&Xc.deepDispose(c.scene),s(null)}},[t,r]),xG((l,c)=>{var m;if(!i)return;const d=((m=e.current)==null?void 0:m.current)??0;Y1e(i,l.clock.elapsedTime,d);const f=i.expressionManager;if(f){const y=(o.current.aa??0)*.4+d*.6;o.current.aa=y,f.setValue("aa",y);const x=Q1e[n.current];for(const w of Z1e){const E=x===w?.75:0,T=o.current[w]??0,C=T+(E-T)*Math.min(1,c*4);o.current[w]=C,f.setValue(w,C)}const S=a.current;S.t+=c,S.active<=0&&S.t>S.next&&(S.active=.16,S.t=0,S.next=3+Math.random()*4);let _=0;if(S.active>0){S.active-=c;const w=1-S.active/.16;_=1-Math.abs(w-.5)*2}f.setValue("blink",Math.max(0,_))}i.update(c)}),i?v.jsx("primitive",{object:i.scene}):null}function eSe({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($be,{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(J1e,{url:t,audioLevel:e,emotion:n,onError:i},t),v.jsx(t_e,{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 tSe="mc2-voice",j0="avatar",KG="uploaded-vrm";function YG(){return new Promise((t,e)=>{const n=indexedDB.open(tSe,1);n.onupgradeneeded=()=>n.result.createObjectStore(j0),n.onsuccess=()=>t(n.result),n.onerror=()=>e(n.error)})}async function nSe(t){const e=await YG();await new Promise((n,r)=>{const i=e.transaction(j0,"readwrite");i.objectStore(j0).put(t,KG),i.oncomplete=()=>n(),i.onerror=()=>r(i.error)})}async function rSe(){const t=await YG();return new Promise((e,n)=>{const i=t.transaction(j0,"readonly").objectStore(j0).get(KG);i.onsuccess=()=>e(i.result??null),i.onerror=()=>n(i.error)})}const ZG=[{id:"sample-a",label:"VRoid Sample A",url:"https://raw.githubusercontent.com/madjin/vrm-samples/master/vroid/stable/AvatarSample_A.vrm",note:"Anime, weiblich"},{id:"sample-b",label:"VRoid Sample B",url:"https://raw.githubusercontent.com/madjin/vrm-samples/master/vroid/stable/AvatarSample_B.vrm",note:"Anime, männlich"},{id:"pixiv",label:"Pixiv Demo",url:"https://raw.githubusercontent.com/pixiv/three-vrm/dev/packages/three-vrm/examples/models/VRM1_Constraint_Twist_Sample.vrm",note:"VRM1-Testmodell"}],iSe=ZG[0].url,sSe=["elevenlabs","edge"],oSe={elevenlabs:"ElevenLabs (premium)",edge:"Edge (natürlich · gratis)"};function aSe({avatarUrl:t,onAvatarChange:e}){const[n,r]=R.useState(""),[i,s]=R.useState([]),[o,a]=R.useState(localStorage.getItem("mc_voice_engine")||"elevenlabs"),[l,c]=R.useState(localStorage.getItem("mc_voice_voice")||""),[d,f]=R.useState(!1),m=R.useRef(null),y=R.useRef(null),x=(N,L)=>{a(N),c(L),localStorage.setItem("mc_voice_engine",N),localStorage.setItem("mc_voice_voice",L)};R.useEffect(()=>{fetch("/api/voice/voices").then(N=>N.ok?N.json():Promise.reject()).then(N=>{const L=N.voices||[];if(s(L),!l){const F=L.find(V=>V.engine===o);F&&x(o,F.id)}}).catch(()=>s([]))},[]);const S=async()=>{var N;if(!d){f(!0);try{const L=await fetch("/api/voice/tts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:"Hallo! So klingt diese Stimme auf Deutsch.",engine:o,voice:l})});if(!L.ok)throw new Error(`TTS ${L.status}`);const F=URL.createObjectURL(await L.blob());(N=y.current)==null||N.pause();const V=new Audio(F);y.current=V,V.onended=()=>URL.revokeObjectURL(F),await V.play()}catch(L){console.error("Probe fehlgeschlagen:",L)}finally{f(!1)}}};R.useEffect(()=>{localStorage.getItem("mc_voice_avatar_uploaded")==="1"&&rSe().then(N=>{N&&e(URL.createObjectURL(new Blob([N],{type:"model/gltf-binary"})))})},[e]);const _=N=>{localStorage.setItem("mc_voice_avatar_url",N),localStorage.removeItem("mc_voice_avatar_uploaded"),e(N)},w=async N=>{const L=await N.arrayBuffer();await nSe(L),localStorage.setItem("mc_voice_avatar_uploaded","1"),localStorage.removeItem("mc_voice_avatar_url"),e(URL.createObjectURL(new Blob([L],{type:"model/gltf-binary"})))},E=()=>{const N=n.trim();N&&_(N)},T=N=>{const L=i.find(F=>F.engine===N);x(N,(L==null?void 0:L.id)||"")},C=i.filter(N=>N.engine===o),O=o==="elevenlabs"&&C.length===0;return v.jsxs("div",{className:"space-y-5 text-sm",children:[v.jsxs("div",{children:[v.jsx("div",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Avatar"}),v.jsx("div",{className:"space-y-1.5",children:ZG.map(N=>{const L=t===N.url;return v.jsxs("button",{onClick:()=>_(N.url),className:`flex w-full items-center justify-between rounded-md border px-3 py-2 text-left transition-colors ${L?"border-primary/50 bg-primary/10 text-primary":"border-border/40 hover:bg-accent"}`,children:[v.jsxs("span",{children:[v.jsx("span",{className:"font-medium",children:N.label}),N.note&&v.jsx("span",{className:"ml-2 text-[11px] text-muted-foreground",children:N.note})]}),L&&v.jsx(bo,{className:"h-4 w-4"})]},N.id)})})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("input",{ref:m,type:"file",accept:".vrm,model/gltf-binary",className:"hidden",onChange:N=>{var F;const L=(F=N.target.files)==null?void 0:F[0];L&&w(L)}}),v.jsxs("button",{onClick:()=>{var N;return(N=m.current)==null?void 0:N.click()},className:"flex w-full items-center gap-2 rounded-md border border-border/40 bg-background/40 px-3 py-2 hover:bg-accent transition-colors",children:[v.jsx(s9,{className:"h-4 w-4"})," Eigenes .vrm hochladen"]}),v.jsxs("div",{className:"flex gap-1.5",children:[v.jsx("input",{value:n,onChange:N=>r(N.target.value),onKeyDown:N=>N.key==="Enter"&&E(),placeholder:"…oder VRM-URL einfügen",className:"min-w-0 flex-1 rounded-md border border-border/40 bg-background/40 px-2.5 py-2 text-xs outline-none focus:border-primary/50"}),v.jsx("button",{onClick:E,className:"rounded-md border border-border/40 bg-background/40 px-2.5 hover:bg-accent",title:"Laden",children:v.jsx(V8,{className:"h-4 w-4"})})]}),v.jsxs("a",{href:"https://hub.vroid.com/en/characters",target:"_blank",rel:"noopener",className:"flex items-center gap-1.5 text-xs text-primary/80 hover:text-primary",children:[v.jsx(yg,{className:"h-3.5 w-3.5"})," Mehr Avatare auf VRoid Hub (kostenlos) → herunterladen & hochladen"]})]}),v.jsxs("div",{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"]}),i.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:sSe.map(N=>v.jsx("button",{onClick:()=>T(N),className:`rounded-md border px-2.5 py-1.5 text-xs transition-colors ${o===N?"border-primary/50 bg-primary/10 text-primary":"border-border/40 hover:bg-accent"}`,children:oSe[N]},N))}),v.jsx("select",{value:l,onChange:N=>x(o,N.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:C.map(N=>v.jsx("option",{value:N.id,children:N.label},N.id))}),v.jsxs("button",{onClick:S,disabled:d||O,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:[d?v.jsx(yP,{className:"h-3.5 w-3.5 animate-spin"}):v.jsx(cF,{className:"h-3.5 w-3.5"}),d?"Spielt …":"Probe hören"]}),o==="elevenlabs"&&!O&&v.jsx("p",{className:"text-[11px] text-muted-foreground",children:"ElevenLabs: deine eigene Stimme, sauberes Deutsch, schnell. Nutze NUR eigene Stimmen — Library-Stimmen sperrt das Free-Tier per API."}),O&&v.jsxs("p",{className:"text-[11px] text-amber-300",children:["Keine ElevenLabs-Stimmen — Key in ",v.jsx("code",{children:"~/.hermes/.env"})," fehlt, oder noch keine eigene Stimme angelegt."]}),o==="edge"&&v.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Edge: native deutsche Stimmen, gratis & ohne Key. Cloud (Text → Microsoft)."})]})]})]})}function lSe(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 cSe{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{if(!l.current){const E=new cSe;E.onSpeaking=T=>e(C=>T?"speaking":C==="speaking"?"idle":C),l.current=E,o.current=E.level}return l.current},[]),f=R.useCallback(async E=>{var ne,te,pe,oe;s(null);const T=d();T.clear(),e("transcribing");let C="";try{const ce=new FormData;ce.append("audio",E,"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}=hSe();let L="",F="";r(ce=>[...ce,{role:"assistant",text:""}]);let V=Promise.resolve(),k=!1,U=!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){U=!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:fSe})});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(` + */const q1e={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 K1e(t){var e;for(const[n,r]of Object.entries(q1e))Ia(t,n,r[0],r[1],r[2]);(e=t.humanoid)==null||e.update()}function Y1e(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 Z1e=["happy","angry","sad","surprised","relaxed"],Q1e={neutral:null,happy:"happy",angry:"angry",sad:"sad",surprised:"surprised",relaxed:"relaxed"};function J1e({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 n_e;return f.register(m=>new M1e(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,K1e(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]),xG((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),Y1e(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 _=Q1e[n.current];for(const T of Z1e){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 E=0;if(w.active>0){w.active-=d;const T=1-w.active/.16;E=1-Math.abs(T-.5)*2}y.setValue("blink",Math.max(0,E))}i.update(d)}),i?v.jsx("primitive",{object:i.scene}):null}function eSe({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($be,{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(J1e,{url:t,audioLevel:e,emotion:n,onError:i},t),v.jsx(t_e,{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 tSe="mc2-voice",j0="avatar",KG="uploaded-vrm";function YG(){return new Promise((t,e)=>{const n=indexedDB.open(tSe,1);n.onupgradeneeded=()=>n.result.createObjectStore(j0),n.onsuccess=()=>t(n.result),n.onerror=()=>e(n.error)})}async function nSe(t){const e=await YG();await new Promise((n,r)=>{const i=e.transaction(j0,"readwrite");i.objectStore(j0).put(t,KG),i.oncomplete=()=>n(),i.onerror=()=>r(i.error)})}async function rSe(){const t=await YG();return new Promise((e,n)=>{const i=t.transaction(j0,"readonly").objectStore(j0).get(KG);i.onsuccess=()=>e(i.result??null),i.onerror=()=>n(i.error)})}const ZG=[{id:"sample-a",label:"VRoid Sample A",url:"https://raw.githubusercontent.com/madjin/vrm-samples/master/vroid/stable/AvatarSample_A.vrm",note:"Anime, weiblich"},{id:"sample-b",label:"VRoid Sample B",url:"https://raw.githubusercontent.com/madjin/vrm-samples/master/vroid/stable/AvatarSample_B.vrm",note:"Anime, männlich"},{id:"pixiv",label:"Pixiv Demo",url:"https://raw.githubusercontent.com/pixiv/three-vrm/dev/packages/three-vrm/examples/models/VRM1_Constraint_Twist_Sample.vrm",note:"VRM1-Testmodell"}],iSe=ZG[0].url,sSe=["elevenlabs","edge"],oSe={elevenlabs:"ElevenLabs (premium)",edge:"Edge (natürlich · gratis)"};function aSe({avatarUrl:t,onAvatarChange:e}){const[n,r]=R.useState(""),[i,s]=R.useState([]),[o,a]=R.useState(localStorage.getItem("mc_voice_engine")||"elevenlabs"),[l,c]=R.useState(localStorage.getItem("mc_voice_voice")||""),[d,f]=R.useState(!1),m=R.useRef(null),y=R.useRef(null),x=(N,L)=>{a(N),c(L),localStorage.setItem("mc_voice_engine",N),localStorage.setItem("mc_voice_voice",L)};R.useEffect(()=>{fetch("/api/voice/voices").then(N=>N.ok?N.json():Promise.reject()).then(N=>{const L=N.voices||[];if(s(L),!l){const F=L.find(V=>V.engine===o);F&&x(o,F.id)}}).catch(()=>s([]))},[]);const S=async()=>{var N;if(!d){f(!0);try{const L=await fetch("/api/voice/tts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:"Hallo! So klingt diese Stimme auf Deutsch.",engine:o,voice:l})});if(!L.ok)throw new Error(`TTS ${L.status}`);const F=URL.createObjectURL(await L.blob());(N=y.current)==null||N.pause();const V=new Audio(F);y.current=V,V.onended=()=>URL.revokeObjectURL(F),await V.play()}catch(L){console.error("Probe fehlgeschlagen:",L)}finally{f(!1)}}};R.useEffect(()=>{localStorage.getItem("mc_voice_avatar_uploaded")==="1"&&rSe().then(N=>{N&&e(URL.createObjectURL(new Blob([N],{type:"model/gltf-binary"})))})},[e]);const _=N=>{localStorage.setItem("mc_voice_avatar_url",N),localStorage.removeItem("mc_voice_avatar_uploaded"),e(N)},w=async N=>{const L=await N.arrayBuffer();await nSe(L),localStorage.setItem("mc_voice_avatar_uploaded","1"),localStorage.removeItem("mc_voice_avatar_url"),e(URL.createObjectURL(new Blob([L],{type:"model/gltf-binary"})))},E=()=>{const N=n.trim();N&&_(N)},T=N=>{const L=i.find(F=>F.engine===N);x(N,(L==null?void 0:L.id)||"")},C=i.filter(N=>N.engine===o),O=o==="elevenlabs"&&C.length===0;return v.jsxs("div",{className:"space-y-5 text-sm",children:[v.jsxs("div",{children:[v.jsx("div",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Avatar"}),v.jsx("div",{className:"space-y-1.5",children:ZG.map(N=>{const L=t===N.url;return v.jsxs("button",{onClick:()=>_(N.url),className:`flex w-full items-center justify-between rounded-md border px-3 py-2 text-left transition-colors ${L?"border-primary/50 bg-primary/10 text-primary":"border-border/40 hover:bg-accent"}`,children:[v.jsxs("span",{children:[v.jsx("span",{className:"font-medium",children:N.label}),N.note&&v.jsx("span",{className:"ml-2 text-[11px] text-muted-foreground",children:N.note})]}),L&&v.jsx(bo,{className:"h-4 w-4"})]},N.id)})})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("input",{ref:m,type:"file",accept:".vrm,model/gltf-binary",className:"hidden",onChange:N=>{var F;const L=(F=N.target.files)==null?void 0:F[0];L&&w(L)}}),v.jsxs("button",{onClick:()=>{var N;return(N=m.current)==null?void 0:N.click()},className:"flex w-full items-center gap-2 rounded-md border border-border/40 bg-background/40 px-3 py-2 hover:bg-accent transition-colors",children:[v.jsx(s9,{className:"h-4 w-4"})," Eigenes .vrm hochladen"]}),v.jsxs("div",{className:"flex gap-1.5",children:[v.jsx("input",{value:n,onChange:N=>r(N.target.value),onKeyDown:N=>N.key==="Enter"&&E(),placeholder:"…oder VRM-URL einfügen",className:"min-w-0 flex-1 rounded-md border border-border/40 bg-background/40 px-2.5 py-2 text-xs outline-none focus:border-primary/50"}),v.jsx("button",{onClick:E,className:"rounded-md border border-border/40 bg-background/40 px-2.5 hover:bg-accent",title:"Laden",children:v.jsx(V8,{className:"h-4 w-4"})})]}),v.jsxs("a",{href:"https://hub.vroid.com/en/characters",target:"_blank",rel:"noopener",className:"flex items-center gap-1.5 text-xs text-primary/80 hover:text-primary",children:[v.jsx(yg,{className:"h-3.5 w-3.5"})," Mehr Avatare auf VRoid Hub (kostenlos) → herunterladen & hochladen"]})]}),v.jsxs("div",{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"]}),i.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:sSe.map(N=>v.jsx("button",{onClick:()=>T(N),className:`rounded-md border px-2.5 py-1.5 text-xs transition-colors ${o===N?"border-primary/50 bg-primary/10 text-primary":"border-border/40 hover:bg-accent"}`,children:oSe[N]},N))}),v.jsx("select",{value:l,onChange:N=>x(o,N.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:C.map(N=>v.jsx("option",{value:N.id,children:N.label},N.id))}),v.jsxs("button",{onClick:S,disabled:d||O,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:[d?v.jsx(yP,{className:"h-3.5 w-3.5 animate-spin"}):v.jsx(cF,{className:"h-3.5 w-3.5"}),d?"Spielt …":"Probe hören"]}),o==="elevenlabs"&&!O&&v.jsx("p",{className:"text-[11px] text-muted-foreground",children:"ElevenLabs: deine eigene Stimme, sauberes Deutsch, schnell. Nutze NUR eigene Stimmen — Library-Stimmen sperrt das Free-Tier per API."}),O&&v.jsxs("p",{className:"text-[11px] text-amber-300",children:["Keine ElevenLabs-Stimmen — Key in ",v.jsx("code",{children:"~/.hermes/.env"})," fehlt, oder noch keine eigene Stimme angelegt."]}),o==="edge"&&v.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Edge: native deutsche Stimmen, gratis & ohne Key. Cloud (Text → Microsoft)."})]})]})]})}function lSe(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 cSe{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{if(!l.current){const E=new cSe;E.onSpeaking=T=>e(C=>T?"speaking":C==="speaking"?"idle":C),l.current=E,o.current=E.level}return l.current},[]),f=R.useCallback(async E=>{var ne,te,pe,oe;s(null);const T=d();T.clear(),e("transcribing");let C="";try{const ce=new FormData;ce.append("audio",E,"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}=hSe();let L="",F="";r(ce=>[...ce,{role:"assistant",text:""}]);let V=Promise.resolve(),k=!1,U=!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){U=!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:fSe})});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;L+=$e,F+=$e,a.current=dSe(L),r(Xe=>{const ue=Xe.slice();return ue[ue.length-1]={role:"assistant",text:L},ue});const{sentences:Me,rest:He}=pSe(F);F=He,Me.forEach(H)}}if(F.trim()&&H(F),await V,!L.trim()){e("idle");return}k||(e("error"),s(U?"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}=lSe(f),S=R.useCallback(()=>{d(),e("listening"),y()},[d,y]),_=R.useCallback(()=>{x()},[x]),w=R.useCallback(()=>{var E;(E=l.current)==null||E.clear(),r([]),s(null),e("idle"),localStorage.removeItem("mc_voice_session"),c.current=RU()},[]);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 gSe={idle:"Bereit — halte zum Sprechen",listening:"Höre zu …",transcribing:"Verstehe …",thinking:"Hermes denkt …",speaking:"Hermes spricht …",error:"Fehler"};function vSe(){const[t,e]=R.useState(()=>localStorage.getItem("mc_voice_avatar_url")||iSe),{status:n,messages:r,error:i,recording:s,audioLevel:o,emotion:a,pressStart:l,pressEnd:c,reset:d}=mSe(),f=R.useRef(!1),m=R.useCallback(S=>e(S),[]);R.useEffect(()=>{const S=E=>E instanceof HTMLElement&&/^(INPUT|TEXTAREA|SELECT)$/.test(E.tagName),_=E=>{E.code!=="Space"||E.repeat||f.current||S(E.target)||(E.preventDefault(),f.current=!0,l())},w=E=>{E.code!=="Space"||!f.current||(E.preventDefault(),f.current=!1,c())};return window.addEventListener("keydown",_),window.addEventListener("keyup",w),()=>{window.removeEventListener("keydown",_),window.removeEventListener("keyup",w)}},[l,c]);const y=n==="speaking",x=n==="transcribing"||n==="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(eSe,{url:t,audioLevel:o,emotion:a})}),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",n==="error"?"text-red-400":y?"text-primary":"text-muted-foreground"),children:[x&&v.jsx(yP,{className:"h-4 w-4 animate-spin"}),y&&v.jsx(cF,{className:"h-4 w-4 animate-pulse"}),v.jsx("span",{children:i||gSe[n]})]}),v.jsx("button",{onPointerDown:S=>{S.preventDefault(),f.current=!0,l()},onPointerUp:()=>{f.current&&(f.current=!1,c())},onPointerLeave:()=>{f.current&&(f.current=!1,c())},className:nt("flex h-20 w-20 items-center justify-center rounded-full border-2 transition-all select-none touch-none",s?"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(oF,{className:nt("h-8 w-8",s?"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 overflow-y-auto scrollbar-thin max-h-[55%]",children:v.jsx(aSe,{avatarUrl:t,onAvatarChange:m})}),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:d,className:"text-muted-foreground hover:text-foreground",title:"Neues Gespräch",children:v.jsx(J8,{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:[r.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."}),r.map((S,_)=>v.jsxs("div",{className:nt("text-sm",S.role==="user"?"text-foreground":"text-primary/90"),children:[v.jsx("span",{className:"mr-1.5 text-[10px] font-semibold uppercase text-muted-foreground",children:S.role==="user"?"Du":"Hermes"}),S.text||v.jsx("span",{className:"text-muted-foreground",children:"…"})]},_))]})]})]})]})}const NU=[{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 ySe(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(_8,{className:"h-3 w-3 opacity-60"})]}),v.jsxs("span",{className:"text-muted-foreground",children:[" — ",n]})]})}function xSe(){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(TT,{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(PT,{className:"h-3.5 w-3.5 text-primary ml-1 mr-0.5 shrink-0"}),(t?NU:NU.slice(0,9)).map(n=>v.jsx("button",{onClick:()=>ySe(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:G1,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:bP,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:CT,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:K8,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:NT,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(W8,{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:Q8,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:`--- diff --git a/frontend/dist/index.html b/frontend/dist/index.html index 361b8b0..f0a6c11 100644 --- a/frontend/dist/index.html +++ b/frontend/dist/index.html @@ -7,7 +7,7 @@ Mission Control 2.0 - + diff --git a/frontend/src/components/voice/Avatar3D.tsx b/frontend/src/components/voice/Avatar3D.tsx index 7dced2d..9dcd608 100644 --- a/frontend/src/components/voice/Avatar3D.tsx +++ b/frontend/src/components/voice/Avatar3D.tsx @@ -29,29 +29,33 @@ function applyRestPose(vrm: VRM) { vrm.humanoid?.update() } -// Lebendige Idle-Animation: prozedural (kein Animations-File). Atmung, langsames Wiegen, -// Kopf-/Blickbewegung und Arm-Pendeln werden überlagert; beim Sprechen (level) nickt der Kopf -// stärker, damit der Avatar „mitgeht". Wird jede Frame über die Ruhepose gelegt. -function applyIdle(vrm: VRM, t: number, level: number) { +// Lebendige Idle-Animation: prozedural (kein Animations-File). Über die Ruhepose gelegt: +// Atmung, langsames Wiegen + Gewichtsverlagerung, Umschauen (lookYaw/Pitch), Vorlehnen beim +// Sprechen (lean) und Arm-Mitbewegung. Die Augen (lookAt) hält die useFrame separat auf die Kamera. +function applyIdle(vrm: VRM, t: number, level: number, lookYaw: number, lookPitch: number, lean: number) { const breathe = Math.sin(t * 1.7) // ~0.27 Hz Atmung - const sway = Math.sin(t * 0.5) + const sway = Math.sin(t * 0.45) // sanftes Wiegen + const weight = Math.sin(t * 0.32) // langsame Gewichtsverlagerung const emphasis = Math.min(1, level * 1.4) + const nod = Math.sin(t * 1.3) * emphasis * 0.06 // Sprech-Nicken - // Rumpf — Atmung + sanftes Wiegen - setBone(vrm, "spine", breathe * 0.025, sway * 0.03, Math.sin(t * 0.43) * 0.015) - setBone(vrm, "chest", breathe * 0.02, sway * 0.02, 0) - setBone(vrm, "hips", 0, Math.sin(t * 0.37) * 0.02, Math.sin(t * 0.29) * 0.01) + // Rumpf — Atmung, Wiegen, Gewichtsverlagerung, Vorlehnen beim Sprechen + setBone(vrm, "hips", 0, weight * 0.045, weight * 0.03) + setBone(vrm, "spine", breathe * 0.025 + lean * 0.07, sway * 0.022, -weight * 0.03) + setBone(vrm, "chest", breathe * 0.02 + lean * 0.02, sway * 0.018, 0) + setBone(vrm, "upperChest", breathe * 0.015, 0, 0) - // Kopf/Hals — langsamer Blick + Atmung + Sprech-Nicken - setBone(vrm, "neck", Math.sin(t * 0.8) * 0.03 + emphasis * 0.06, Math.sin(t * 0.31) * 0.05, 0) - setBone(vrm, "head", Math.sin(t * 0.6) * 0.025 + emphasis * 0.05, Math.sin(t * 0.27) * 0.06, Math.sin(t * 0.5) * 0.02) + // Kopf/Hals — Umschauen (gedriftete Zielwinkel) + Atmung + Sprech-Nicken + setBone(vrm, "neck", lookPitch * 0.4 + nod * 0.5, lookYaw * 0.4, 0) + setBone(vrm, "head", lookPitch * 0.6 + nod * 0.5 + Math.sin(t * 0.6) * 0.015, + lookYaw * 0.6 + Math.sin(t * 0.27) * 0.025, Math.sin(t * 0.5) * 0.02) - // Arme — Ruhepose + leichtes Pendeln - const arm = Math.sin(t * 0.8) * 0.04 - setBone(vrm, "leftUpperArm", 0, 0, 1.2 + arm) - setBone(vrm, "rightUpperArm", 0, 0, -1.2 - arm) - setBone(vrm, "leftLowerArm", 0, -0.2 - Math.sin(t * 0.8) * 0.03, 0) - setBone(vrm, "rightLowerArm", 0, 0.2 + Math.sin(t * 0.8) * 0.03, 0) + // Arme — Ruhepose + leichtes Pendeln + Gewichtsverlagerung + const arm = Math.sin(t * 0.8) * 0.035 + setBone(vrm, "leftUpperArm", 0, 0, 1.18 + arm + weight * 0.04) + setBone(vrm, "rightUpperArm", 0, 0, -1.18 - arm + weight * 0.04) + setBone(vrm, "leftLowerArm", 0, -0.18 - Math.sin(t * 0.8) * 0.03, 0) + setBone(vrm, "rightLowerArm", 0, 0.18 + Math.sin(t * 0.8) * 0.03, 0) } const EXPRESSIONS = ["happy", "angry", "sad", "surprised", "relaxed"] as const @@ -65,6 +69,8 @@ function VrmModel({ url, audioLevel, emotion, onError }: { const [vrm, setVrm] = useState(null) const smooth = useRef>({}) const blink = useRef({ t: 0, next: 3, active: 0 }) + // Umschauen (gedriftete Kopf-Zielwinkel) + geglättetes Lehnen beim Sprechen. + const motion = useRef({ yaw: 0, pitch: 0, tYaw: 0, tPitch: 0, t: 0, next: 2.5, lean: 0 }) useEffect(() => { let disposed = false @@ -98,8 +104,24 @@ function VrmModel({ url, audioLevel, emotion, onError }: { if (!vrm) return const target = audioLevel.current?.current ?? 0 + // Blickkontakt: Augen folgen der Kamera (schaut dich an). + if (vrm.lookAt) vrm.lookAt.target = state.camera + + // Umschauen: alle paar Sekunden neues Kopf-Ziel, sanft hineinlerpen. + const m = motion.current + m.t += delta + if (m.t > m.next) { + m.tYaw = (Math.random() - 0.5) * 0.5 // ±0.25 rad Gieren + m.tPitch = (Math.random() - 0.5) * 0.24 + m.t = 0 + m.next = 2.5 + Math.random() * 3.5 + } + m.yaw += (m.tYaw - m.yaw) * Math.min(1, delta * 1.5) + m.pitch += (m.tPitch - m.pitch) * Math.min(1, delta * 1.5) + m.lean += (Math.min(1, target * 1.6) - m.lean) * Math.min(1, delta * 3) + // Lebendige Idle-/Sprech-Bewegung (über die Ruhepose gelegt). - applyIdle(vrm, state.clock.elapsedTime, target) + applyIdle(vrm, state.clock.elapsedTime, target, m.yaw, m.pitch, m.lean) const em = vrm.expressionManager if (em) {